VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA - Convert 2010 Acad Drawings to 2004/LT2004

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Millerni456
2223 Views, 5 Replies

VBA - Convert 2010 Acad Drawings to 2004/LT2004

Hey all,

 

I have a simple and quick question:

Is is possitlbe using VBA (not .NET) to open an Acad 2010 Drawing, then re-save it as a Acad 2004/LT2004 Drawing?

 

I need to be able to import the drawing into some third party software, and for some reason, it is incompatible with the newer versions.

 

I would also like to know if it is possible to convert ANY version of a drawings (be it 2007, 2000, 2012, etc...).  Also if at all possible, is there an easy way to re-save a drawing that was created using other software (aka SolidWorks) to use AutoCAD's specific file formatting?  I know that when you try to open a drawing created in SolidWorks (opening in AutoCAD), that it will display a message saying the drawing was created by an external application.  I would like to be able to change the file so that AutoCAD created the drawing.

 

 

Thanks for all your help, it is greatly appreciated! 🙂

God Bless,

-Nick

5 REPLIES 5
Message 2 of 6
Millerni456
in reply to: Millerni456

Okay so after doing some research I came across the following forums.  It looks like I might be able to accomplish this using LISP, but this would still need to be done using VBA (as I need to interface with Microsoft Office).

 

Here's the forum about running LISP using VBA:

http://forums.autodesk.com/t5/Visual-Basic-Customization/Run-lisp-command-in-autocad-from-VBA/td-p/2...

 

Here's the forum about saving as a specified file format.

http://forums.augi.com/showthread.php?50250-Use-Saveas-Command-from-a-Lisp-Routine

 

So, as I try to understand this even further;  if anyone can answer, I'd like to know if taking this route is possible.

 

Can I run a VBA program to open AutoCAD, and then execute a LISP file to save the drawing as a different format?

Message 3 of 6
norman.yuan
in reply to: Millerni456

If you just want to convert drawing format from Acad2010 to Acad2000/4/7, you can use Dwg TrueView to do batch job.

 

If you have to do it with VBA code, you can easily save them as older drawing format all the way back to R14 version (assume you use Acad2010-2012). You certainly do not need to mix your VBA code with LISP code (e.g. you do it either with LISP or VBA, both are simple enough.

 

You do like this (pseudo code, assuming you have a string array of dwg file names):

 

Dim fileNames As String()

Dim saveAsFielNames As strinig()

 

''Then fill the strinig arrays with dwg file names

 

Dim dwg As AcadDocument

Dim app As AcadApplication

Set app=ThisDrawing.Application

 

Dim i As Integer

For i=0 to Ubound(fileNames)

    Set dwg=app.Documents.Open(fileNames(i))

    ''Do something if needed

    dwg.SaveAs saveAsFileName(i), ac2000(4/7))_dwg

    dwg.Close

Next

 

 

Message 4 of 6
Millerni456
in reply to: norman.yuan

Thanks for the reply!

 

It looks like this will work!

However, is it possible you can enumerate all the different dwg file formats?

 

Message 5 of 6
norman.yuan
in reply to: Millerni456

If you open VBA IDE in autoCAd and open Object Browser, find AcSaveAsType in the left and highlight it, you can see all the enum values of it for your versio of AutoCAD.

 

Attached is the screen picture froom my acad2012.Untitled.png

 

 

Message 6 of 6
Millerni456
in reply to: norman.yuan

Wow thanks, that will be very helpful!

 

Again, I appreciate all your efforts!

 

God Bless,

-Nick

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost