Hi,
I currently have ilogic code that automatically saves a template Inventor dawing as a job drawing. However the problem I am having is when it does this save it takes forever as it seems to be also saving the linked model also. Is there a way to save this Inventor dwg without saving the linked model? The reason why I do not want this model save is because after the drawing is outputted the user is given options to write part numbers and dxf files if required which requires a model save anyway.
Sample of code used:-
ThisDoc.Document.SaveAsInventorDWG(ThisDoc.Path & "\2D_DRAWINGS (Inventor dwg)\" & iProperties.Value("Custom", "Drawing No.") & ".DWG", True)
Hi,
You are just assuming that the model is being saved because of the long time the save as dwg takes or does the modified date of the model file actually changes?
Cheers,
Hi,
I could not reproduce the issue. When I used your code inside my drawing it did not save the part it was referencing.
Can you reproduce the behaviour with any model? Could you create a most basic, non-confidential one as a sample and send it?
Do you by any chance have any other rules/AddIn running that might do a save on the model?
Cheers,
Hi
It is an assembly that is refeenced in the drawing and not a part.
Just tried it again now. The drawing save takes about 10 - 20 seconds. I then close the template drawing without a save and I can then close the assembly without it prompting for a save. One closed I can re-open it to the state the latest configuration.
The drawing save with the configuration I have changed it to takes about 15 seconds.
Thanks
Hi,
It's worth checking things in the UI. When I tried to save the drawing to Inventor DWG this dialog popped up:
And now I could reproduce the behaviour through the API as well, even with a part document.
So it seems the API behaviour is in sync with what is suggested through the UI - i.e. the part will be saved.
To avoid that, we could go through the referenced documents, make them non dirty, save the drawing, then set those docs dirty again.
Sort of the opposite of this solution: http://forums.autodesk.com/t5/Inventor-Customization/How-to-save-all-changes-via-macro/td-p/2823330
This seemed to work fine on my side:
Dim doc As Document doc = ThisDoc.Document ' To avoid saving documents ' let's set them non-dirty Dim rd As Document Dim rdd As DocumentDescriptor ' Collection for dirty documents Dim tr As TransientObjects tr = ThisApplication.TransientObjects Dim dd As ObjectCollection dd = tr.CreateObjectCollection ' Make all the referenced documents non-dirty For Each rdd In doc.ReferencedDocumentDescriptors rd = rdd.ReferencedDocument If rd.Dirty Then Call dd.Add(rd) rd.Dirty = False End If Next ' Save Call doc.SaveAsInventorDwg( _ ThisDoc.Path & "\2D_DRAWINGS (Inventor dwg)\" & _ iProperties.Value("Custom", "Drawing No.") & ".DWG", _ True) ' Set the dirty status back For Each doc In dd doc.Dirty = True Next
Cheers,