I'm using AutoCAD 2012 version 18.2. I need to programmatically open .dxf file, change font and save as .dwg version AC1800. I do it with the folowing code http://pastie.org/3745519. The problem is that after saving as AC1800 and open the result file, Autocad says that some errors occured and offer to recover file. After this it works fine. If I save as DwgVersion.Current or DwgVersion.Newest it works fine.
Does anyone have ideas what I'm doing wrong?
please paste code here and not on any other server (as of security, I don't love it to go to some servers I don't now and so don't trust).
Have you tried to open the dxf manually and save it in 2004-format?
Where does the DXF come from, what software (and version) wrote these files?
Have you tried to create a new file, save it as DXF and try your code then?
If you have some proxy-objects (or you are running something like ACA, MEP, Civi3D, ....) then saving back to 2004 may result in defect DWG's anyway.
Upload one of these DXF's, that may help. Also give us the info of how you get these code-lines startet (did you create a command that is executed by hand or by script or how is this code called?). The reason why I ask this is your estimation that after using the DocumentManager.Open function makes this document current so you can get it then with MdiActiveDocument ... may be but must not be.
- alfred -
Thanks for your reply. Sorry for not answering for two days. Got problems with my Internet connection.
It works fine when I open it manually and save it in 2004 format. Unfortunatelly I have no idea where these drawings come from. I'm attaching the sample DXF to this post.
In addition, I've noticed that it saves fine in Current or Newest version so it seems that the opened document indeed becomes MdiActiveDocument. I've tested saving in 2007 and 2010 formats. It works fine, too. Also it would be nice if you can provide the information about differences between DwgVersion.Current and DwgVersion.Newest.
before I try anything with coding:
Have you tried _AUDIT after opening the DXF and before saving it to 2004? AutoCAD 2013 gives one error that has to be repaired. Try it first and let me know if that was already what you where looking for?
- alfred -
Files that are saved back to 2004 will fail to open properly because of the "Genuine AutoCad check" it does. So it may ask you to repair the file to open it. if the file is resaved as 2010 file in code then it won't have this issue.
>> Files that are saved back to 2004 will fail to open properly because of the "Genuine AutoCad check"
So why does that only occur when saving by application and it does not occur when doing a manual SAVEAS?
Back in my brain (very very far away) there are some red lamps telling me "there was something with 2004 and programatic save" but it doesn't come to front of my remembering ;(
- alfred -
I don't have any special insite as to why.
My Assumtion is that the object types that are contained in the drawing are still 2010 objects and they have been put in a 2004 wrapper. Where the Save As actually converts each item into a 2004 type object.
I know in MEP / Architecture there is a specific Export To function for turning all of the objects into 2004 objects.
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!