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
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
Solved by norman.yuan. Go to Solution.
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:
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?
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
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?
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.
Norman Yuan
Wow thanks, that will be very helpful!
Again, I appreciate all your efforts!
God Bless,
-Nick