Visual LISP, AutoLISP and General Customization

Reply
Active Contributor
arulanand12
Posts: 32
Registered: ‎04-01-2008
Message 1 of 28 (14,887 Views)

Batch convert DGN to DWG

14887 Views, 27 Replies
11-23-2011 01:46 AM

Hi All,

 

My work needs to convert thousands of DGN files to DWG. We are using AutoCAD 2012. Is it possible to batch convert dgn files with a LISP and a mapping file? Anyone have a LISP for this?

 

Any help is appreciated.

 

Arul

Valued Contributor
rick.hberg
Posts: 70
Registered: ‎06-27-2011
Message 2 of 28 (14,871 Views)

Re: Batch convert DGN to DWG

11-23-2011 11:22 AM in reply to: arulanand12

Is it safe to say you don't have any Microstation installs?  If you do, or if you can find one, use Utilities -> Batch Convert.

 

Otherwise, hopefully someone else can respond....

 

If I attach a dgn and then type  -xref, ?, *,  to list all xrefs, the dgn is not listed, so I don't know what it is inside the dwg.

Civil 3D 2011
Windows 7 x64
Valued Mentor
alanjt_
Posts: 470
Registered: ‎08-25-2008
Message 3 of 28 (14,868 Views)

Re: Batch convert DGN to DWG

11-23-2011 11:36 AM in reply to: rick.hberg

Do you have the DGNIMPORT command in 2012?

Active Contributor
arulanand12
Posts: 32
Registered: ‎04-01-2008
Message 4 of 28 (14,859 Views)

Re: Batch convert DGN to DWG

11-23-2011 07:19 PM in reply to: alanjt_

First of all thank you for your replies.

 

Hi rick.hberg,

We do not have Microstation.

 

Hi alanjt_ ,

Yes. We have DGNIMPORT command in AutoCAD 2012.

Distinguished Contributor
lgabriel
Posts: 108
Registered: ‎05-01-2003
Message 5 of 28 (14,838 Views)

Re: Batch convert DGN to DWG

11-27-2011 07:47 AM in reply to: arulanand12

Very easy to write a batch Autolisp routine. All you would need is to create an ASCII text file (flat file) of all of the *.dgn files you wish to import, including full path. Autolisp program would then open file, read the first line, import the *.dgn file into AutoCAD, save as a *.dwg file , close, read the next line and repeat until all *.dgn files have been imported.

 

I can write the program for you, however I need for you to send me a *.dgn file to complete the program. Not familiar with *.dgn files and need a sample file to see how the DGNIMPORT function works.

Active Contributor
arulanand12
Posts: 32
Registered: ‎04-01-2008
Message 6 of 28 (14,815 Views)

Re: Batch convert DGN to DWG

11-30-2011 04:21 AM in reply to: lgabriel

Hi Gabriel,

 

Hope your method will help for me. I have attached a .DGN file here.

 

Thanks,

Arul

Contributor
Unitedfireprotection
Posts: 25
Registered: ‎07-26-2006
Message 7 of 28 (14,765 Views)

Re: Batch convert DGN to DWG

12-07-2011 01:37 PM in reply to: arulanand12

Any luck with this LISP?  I'm also looking to batch convert alot of DGN files to DWG.  I've just begun learning programming (LISP & C) so I'm not anywhere close to the level of knowledge I need to create such a LISP.  However we are working on a project which is dragging because of the number of dgn files we must import & view.  Very exhausting. 

Active Contributor
arulanand12
Posts: 32
Registered: ‎04-01-2008
Message 8 of 28 (14,755 Views)

Re: Batch convert DGN to DWG

12-08-2011 12:10 AM in reply to: arulanand12

Still digging for it. I will post here, once I get LISP code.

New Member
huaer605
Posts: 1
Registered: ‎03-21-2012
Message 9 of 28 (14,292 Views)

Re: Batch convert DGN to DWG

03-21-2012 08:45 PM in reply to: arulanand12

Free download Professional batch DGN to DWG Converter in various version

Distinguished Contributor
mmoolhuysen
Posts: 159
Registered: ‎08-26-2003
Message 10 of 28 (14,182 Views)

Re: Batch convert DGN to DWG

03-30-2012 07:22 AM in reply to: arulanand12

I've written the attached Lisp routine for converting multiple DGN files into DWG files. It expects a text file with the drawing names to convert as input. I've used it to convert large quantities of drawings.

 

The user has to make the necessary adjustments to the following variables:

tx1 = path and name of a file that holds a list with names for all the *.dgn's to be imported, names of *.dgn drawings may be written without extension, as well as with extension, in plain text format, no return after the last line.
tx2 = the path for the input folder, containing the actual *.dgn files to import.
tx3 = the path for the output folder, where the drawings converted into *.dwg will be saved, (routine assumes that the *.dwg files do not exist yet)
tx4 = name of the drawing model to import

Start the command by typing DGNI

 

The routine reads drawing names from the file given in tx1 line-for-line.
In each loop it performs a DGNIMPORT from the folder given as tx2 into the existing AutoCAD drawing,
does a Zoom Extends, saves the converted drawing result as *.dwg in the folder given as tx3,
and finally restores the drawing to its original state, ready to receive the next DGNIMPORT loop.

 

The DGNIMPORT command trips when the name of the *.dgn to be imported contains a comma, I advise to rename the drawings having this issue.

With friendly greetings, M. Moolhuysen.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community