Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for the LISP. I will post my feedback later after running it.
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I didn't implemented any mapping setup in my lisp file. If you need this, you should insert it as the 4th parameter of the DGNIMPORT command, in other words, replace the last pair of double quotes with the name of the mapping setup prepared in the defauld startup drawing.
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
DGN files have external links for title blocks. I have put all these external linked files in the same folder where input DGN files are. But the LISP loop is breaking when it looks for the external link. Is it possible to locate it from within LISP? I would appreciate your help.
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
The setting to include references can't be changed with command line version of DGNIMPORT. However, it can be set by in the dialogue box of the the regular DGNIMPORT command. I suspect that the stetting is saved in the registry, because it persist from drawing session to drawing session, and that last property is good news for us.
So, as a workaround to change things towards a behavior as desired by you, try this:
Import one random DGN-file using the regular DGNIMPORT command. In the dialogue box, look for a framed section named External DGN references, in there, select the radio button in front of option Translate references to blocks or xrefs. Allow the import to proceed by clicking on the OK button.
After this, I've opened a new drawing and run the LISP routine I've posted before, and now it did include the references.
With friendly greetings, Manfred.
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you for the lisp file. However, I have not been able to perform a DGNIMPORT with 2012. I have been able to run the command in 2011. Could you advise me as to how to modify the lisp routine to be compatible with 2011?
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
We haven't installed version 2011, so you will have to do some testing yourself:
- Type -DGNIMPORT (dash in front of command name) at the command line prompt, to see what options this command expects without the use of a dialogue box.
- I believe system variable DGNIMPORTMODE does not exist yet in version 2011, so you have to drop the line (setvar "DGNIMPORTMODE" 1). I do not know if standard behavior of DGNIMPORT in version 2011 is to import into the existing drawing or always create a new drawing (this is controlled by the setting of system variable DGNIMPORTMODE in version 2012)
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I did remove the line (setvar "DGNIMPORTMODE" 1) as 2011 does not have that variable. And 2011 does open a new drawing.
In an attempt to run down the problem I changed the variables from LOCAL to GLOBAL. I then loaded the LISP and executed the DGNI command. I received error: bad argument type: FILE nil. I then queried variables tx1-tx4 and they were correct. However tx5 returns "nil" as does the variable fil.
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Variable fil staying nil suggests that line (setq fil (open tx1 "r") was not successfully executed.
- Please check if variable tx1 holds the correct filename inclusive path for the txt file containing the names of the drawings you want to convert.
- You're not able to re-open the file because a previous run of the routine did come to the point it supposed to close the file at line (close fil) or was not able to close it properly.
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have solved the "fil variable problem" of the LISP. (I had included the file path in my DGNConvertList)
I begin in Drawing1. I load the LISP and type the DGNI command. AutoCAD opens the 1st dgn "TopoA" in Drawing2. The program stops with the dgn displayed. If I toggle back to Drawing1 then the LISP continues and the Drawing1 is saved as a TopoA.dwg. It then proceeds to open the 2nd dgn "TopoB" in Drawing3 and once again the program stops. If I once again toggle back to the original drawing whose name is now TopoA, the process resumes. This continues until the last dgn has been opened. It has saved the dgns as dwgs in the target folder, but I have to manually switch each time a dgn is imported.
Re: Batch convert DGN to DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have solved the "fil variable problem" of the LISP. (I had included the file path in my DGNConvertList)
The problem now is that in AutoCAD 2011 the DGNIMPORT command opens a new drawing each time.
I begin in Drawing1. I load the LISP and type the DGNI command. AutoCAD opens the 1st dgn "TopoA" in Drawing2. The program stops with the dgn displayed. If I toggle back to Drawing1 (or close Drawing2) then the LISP continues and the Drawing1 is saved as a TopoA.dwg. It then proceeds to open the 2nd dgn "TopoB" in Drawing3 and once again the program stops. If I once again toggle back to the original drawing whose name is now TopoA (or close Drawing3), the process resumes. This continues until the last dgn has been opened. It has saved the dgns as dwgs in the target folder, but I have to manually switch each time a dgn is imported.
Is there a routine or command that I can insert into the LISP to return AutoCAD to the original drawing to allow the process to continue?



