Hello,
We want to change iassemblies in a table using macro. When we change an iassemblies, inventor asks "Do you want to save changes to ......?". There are many iassemblies in our model, so it takes serious amount of time. We can disable all messages using macro, But this time after macro completion, there may be some errors in model, because we dont accept all changes. How can we accept all changes while running macro?
We use SilentOperation property. but in Save dialog, there are some parts indicated "yes" and some indicated "no". how can we change them "yes" and save all dependents?
Thank you in advance
Solved! Go to Solution.
Solved by YuhanZhang. Go to Solution.
Use Save2 you can specify if you want to save all the dependent documents if they are dirty with setting the DocuemntsToSave argument.
Hope this helps!
Thank you Zhang for your reply.
we used save2. it saved all dependents have default "Yes" but there were "No" selected items in the list as seen in the attachment named resim2.jpg. As you say,we should use DocumentsToSave option, but we dont know what to type there (resim1.jpg). can you explain what it stands for? what should we write there to save all dependents selected "No" as default.
Thank you again.
Seems that you want to save all the dependent(referenced) documents no matter they need a "save" or not, right? As usual only the document which is dirty(modified/migrated) will need a save, so Inventor will detect this and set the "No" to a dependent if it is not dirty. While if you still want to change the "No" to "Yes", from API side what you should do is to set the Document.Dirty = True. So in your case if you want to save all the dependents no matter they are dirty or not, you could transverse over all the ReferencedDocumentDescriptors, and set them to dirty. Below is a sample VBA code:
' This is the document being saved Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument Dim oRefDoc As Document Dim oRefDocDesc As DocumentDescriptor ' make all the referenced documents dirty For Each oRefDocDesc In oDoc.ReferencedDocumentDescriptors Set oRefDoc = oRefDocDesc.ReferencedDocument oRefDoc.Dirty = True Next ' Save the document and its dependents. Call oDoc.Save2(True)
Hi, im having the same problem, ive got a program that goes through a for loop and generates multiple drawings from a list of parts. I cant use the Save2 or Save commands because the drawing hasnt been created yet. And every loop it keeps asking "Do you want to save changes to "Part1.idw" and its dependents?"
Please help!
Thanks in advance
You can use SilentOperation to suppress the dialogs like below:
invApp.SilentOperation = True For Loop Start TempFileName = "NewPartEachTime.ipt" oPartDoc = invApp.Documents.Open(TempFileName) oDrawDoc = invApp.Documents.Add(Inventor.DocumentTypeEnum.kDrawingDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2013\Templates\\IDW PART.idw", True) Str = Destination & oPartDoc.DisplayName & ".idw" oPartDoc.Close(True) oDrawDoc.SaveAs(Str, False) oDrawDoc.Close(True) Next invApp.SilentOperation = False
how would i suppress the following image with this silent option or code?
The SilentOperation should work for Inventor dialogs, but not work for other dialogs, so you can try other code like SendKeys in VB to send keys to the active dialog to suppress it.
Hope this helps!