Hi all
Is it possible not to have inventor prompt to save or not to save all parts in an assembly when pressing save?
I would prefer all parts to be automatically saved with no prompt box when I run thisdocument.save
Solved! Go to Solution.
Solved by mrattray. Go to Solution.
Tx Mike
As I posted my reply I stumbled upon this:
' This is the document being saved Dim oDoc As Document oDoc = ThisApplication.ActiveDocument Dim oRefDoc As Document Dim oRefDocDesc As DocumentDescriptor ' make all the referenced documents dirty For Each oRefDocDesc In oDoc.ReferencedDocumentDescriptors oRefDoc = oRefDocDesc.ReferencedDocument oRefDoc.Dirty = True Next ' Save the document and its dependents. Call oDoc.Save2(True)
which includes the Document.Save2
Hi and thanks for your contribution.
I tried this code but got an error when one of the components was patterned and one instance of the pattern was suppressed
Error:
Error in rule: Change hood, in document: Rect Hood.iam
Object reference not set to an instance of an object.
Took my a couple of hours to find the cause because it had been working untill I suppresed an instance of the pattern through iLogic.
It seems to stumble on the mark dirty part of the refence documents, from what I can see at least (beiing the beginner programmer I am)
If I comment out the following it works again:
Dim oRefDocDesc As DocumentDescriptor ' make all the referenced documents dirty For Each oRefDocDesc In oDoc.ReferencedDocumentDescriptors oRefDoc = oRefDocDesc.ReferencedDocument oRefDoc.Dirty = True Next
Is there a trick to get past this? Because I need to get all the parts updated before I export them to a drawing.
Cheers
Rudrugis
I changed the Call to Save2 to:
SyntaxEditor Code Snippet
Call oDoc.Save2(True,SaveDependents)
And it seems to do what I'm after
Cheers
Rudrugis
The deeper I dig the more unnecessary the loop seems to be because from what I gather the call to Save2:
SyntaxEditor Code Snippet
Dim oDoc As Document oDoc = ThisApplication.ActiveDocument Call oDoc.Save2(True)
Does infact safe all dependents i.e. searches for parts marked as "dirty" and saves them if they have changed.
I might be wrong of course but maybe someone can set me straight regarding this or confirm it?
Cheers
Rudrugis