Getting Started Common Acronyms FAQ Forum Help Forum TipsSecure File Upload Helpful GuidelinesInserting and Attaching images, videos, or files to postsProduct Community Directory SELECTsupport
Hello,Here's a bit more on our conversion project.We are in the process of moving our mapping efforts from MicroStation to ESRI’s ArcGIS geodatabase. There is an ArcGIS export routine that creates DWG files (there’s a known problem when exporting directly to DGN’s). The DWG’s are in AutoCAD 2007. We currently are running MicroStation V8 2004 (v08.05.02.70) and PowerDraft V8 2004. Therefore, uStn can not open the DWG’s. I must open them in v8i and save as DGN for all other users to access
In an effort to simplify things, I have a batch file routine that converts DWG files to DGN’s via Bentley’s external MSBATCH program. This works fine on machines running MicroStation but not PowerDraft. I was hoping there was some way I could run some of the code from a network drive for all users.
Following is part of my batch file: c: cd c:\program files\bentley\microstation v8i (SelectSeries)\microstation call msbatch batchconvert z:\cadutils\convert\Map_dwg2dgn.bcnv
Any suggestions would be appreciated?Thanks,SKK
Superb - Thank you very much Phil...
Basically (pardon the pun), you can replace all this MicroStation BASIC stuff
Sub main Dim startPoint As MbePoint Dim point As MbePoint, point2 As MbePoint ' Start a command MbeSendCommand "DIALOG SAVEAS " MbeSendCommand "MDL COMMAND MGDSHOOK,fileList_setDirectoryCmd Z:\MAP\" MbeSendCommand "MDL COMMAND MGDSHOOK,fileList_setFileNameCmd base_temp.dgn" MbeSendCommand "MBE1 CLOSEMODAL OK" MbeSendKeyin "task sendtaskchangedasync" MbeSendKeyin "task sendtaskchangedasync ""\Drawing""" End Sub
with just this MicroStation VBA stuff
Sub main ()ActiveDesignFile.SaveAs "Z:\MAP\base_temp.dgn", True, msdDesignFileFormatV8End Sub
If you put that in a MicroStation VBA project named SaveAsDWG.mvba, then you can "run" that in MicroStation as
vba run [saveasdwg]main
and you should be good to go.
I tried placing the ActiveDesignFile code in the VBA routine, but it still exports as [R2007 DWG]. I probably placed it in the wrong location. This is what's confusing with VBA vs. the old MBE. VBA has the Module1 and ClassModule with various parts of the code being placed throughout. I'm no programmer (which I assume is quite obvious) - it is so much easier to follow when all is in one location.
Any other suggestions would be appreciated.
Phil,Could you explain how to "define the filePath? Isn't this done by the following line - MbeSendCommand "MDL COMMAND MGDSHOOK,fileList_setDirectoryCmd Z:\MAP\"
BTW, in VBA, you can use
ActiveDesignFile.SaveAs filePath, True, msdDesignFileFormatV8
to bypass all the dialog finagling. You need to define what filePath is (that is the full drive/file specification).
Okay... that explains things a bit. What that macro is doing is saving the R2007 DWG file (with a .DWG extension) as an R2007 DWG file (with a .DGN extension).
As a test, it's really not too complicated -File > Save as > Save as Type = MicroStation V8 > z:\map\Base_temp.dgn
I attached an example of the MBE code. I tried it in VBA, but does the same thing.
Without seeing what the "macro" is doing, it would be difficult to say definitively. Could you provide that?
I guess that makes sense. But, why can I open a DGN that was manually created from a DWG, yet cannot open a file exported via a macro (VBA or MBE) from the same DWG file. It’s like the macro does not change some parameter setting the output file as MicroStation.
The headers along the top of the files are a bit different. Examples –
Base.dgn [2D – V8 DGN]
Base.dgn [R2007 DWG]
I believe the "issue" is that the DWG file is R2007 format and MicroStation V8 2004 Edition did not support that. Opening the file in MicroStation V8i works because it supports R2007 DWG.
Attached are snips of the original DWG and exported DGN files (I had to reduce the size of the files in order to upload). The original DWG was created from ESRI’s ArcGIS geodatabase. I can open both files in uStn v8i but neither in v2004 (v.08.05.02.70) – see error
Thanks Inga, that did it...
Regarding the files themselves, it would be difficult to offer suggestions without getting an example file that will not open. Also, having a better understanding of how the files are created (specifically, versions used, etc.) might help shed some light on potential issues.
BTW, since we have an ability to work with ArcGIS data, it might be worthwhile (if you have not already) to look at our ProjectWise Connector V8i for ArcGIS offering.
With respect to the files being 3D, does this help: communities.bentley.com/.../convert-dwg-files-to-2d-dgns-instead-of-3d.aspx
Pick the tool. Adjust the settings. Follow the prompts.
I’m attempting to automate a conversion routine for a few files regularly exported from ESRI’s ArcGIS in DWG format. We are predominantly running MicroStation 2004 (v.08-05-02-70). I can not open the DWG files in our version of uStn. It bombs with a dialog error: “The file contains errors that prevent opening it. Do you wish to recover the file by correcting these errors?” However, I can open them in v8i, which I do. I then save them as DGN’s which can be opened in uStn 2004.
I have attempted to create a few MBE and/or VBA routines in v8i that do the exporting for me. However, I receive the same error when attempting to open the automated export files in uStn2004 - they open fine if exported manually. I use the automated “Create a basic macro”, and the “Start VBA” options, but both routines create a problematic file.
I noticed one other thing - The files created via the automated routine have a name on top of the screen stating: parcels.dgn [R 2007 DWG]
The manually exported files state [3D-V* DGN]
Also, is there a way default the exported (or saved as) DGN file in 2D? Currently the DWG is in 3D, and when exported, the DGN is also in 3D. I then must convert the 3D to 2D.