Skipping question ' save changes to ... and its dependents? '

Skipping question ' save changes to ... and its dependents? '

Anonymous
Not applicable
900 Views
6 Replies
Message 1 of 7

Skipping question ' save changes to ... and its dependents? '

Anonymous
Not applicable
Hi,

I have a little problem:

When I save my assembly (Assemblydoc.save) my VB-routine stops and I get the question: "Do you want to save changes to ... and its dependents?"

Is it possible to skip this question and automatically save the assembly and his dependents?

Greets,
Peter
0 Likes
901 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Try this:

 

oApp.SilentOperation = True

Assemblydoc.Save

oApp.SilentOperation = False

 

When SilentOperation is True, Inventor doesn't
display any dialogs but proceeds using what the default of the dialog would have
been.

 

-Brian


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,

I have a little problem:

When I save my assembly (Assemblydoc.save) my VB-routine stops and I get
the question: "Do you want to save changes to ... and its dependents?"

Is it possible to skip this question and automatically save the assembly
and his dependents?

Greets,
Peter

0 Likes
Message 3 of 7

Anonymous
Not applicable
Try this:

  

      Dim oFileSaveAs As
FileSaveAs


        Set
oFileSaveAs = oApprentice.FileSaveAs

        Call
oFileSaveAs.AddFileToSave(oDoc,
SvAs)
        Call
oFileSaveAs.ExecuteSave

 

Mike Martin


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Try this:

 

oApp.SilentOperation = True

Assemblydoc.Save

oApp.SilentOperation = False

 

When SilentOperation is True, Inventor doesn't
display any dialogs but proceeds using what the default of the dialog would
have been.

 

-Brian


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,

I have a little problem:

When I save my assembly (Assemblydoc.save) my VB-routine stops and I get
the question: "Do you want to save changes to ... and its dependents?"

Is it possible to skip this question and automatically save the assembly
and his dependents?

Greets,
Peter

0 Likes
Message 4 of 7

Anonymous
Not applicable
Thank you Brain,

It works!

Greets

Peter
0 Likes
Message 5 of 7

Anonymous
Not applicable

Where do you put that code?

0 Likes
Message 6 of 7

MechMachineMan
Advisor
Advisor

After you assign the application object variable and before you start doing anything with it, then also add the inverse before your code exits.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 7 of 7

Anonymous
Not applicable

The API includes a Document.Save2 Method (PartDocument, AssemblyDocument, DrawingDocument, PresentationDocument as well) that saves the document and dependent documents. This would prevent the need to mess around with the Application object. This is directly from the API docs. NOTE the RED text in the Remarks section.

 

Document.Save2 Method

Document.Save2 Method

Parent Object: Document

Description

Method that saves the document and the specified dependent documents.

Syntax

Document.Save2( [SaveDependents] As Boolean, [DocumentsToSave] As Variant )

Parameters

NameDescription
SaveDependentsOptional input Boolean that specifies whether or not to save dependent documents that have been dirtied. Defaults to True indicating that the dependents will be saved. If the DependentsToSave argument is not specified, all dirty dependents are saved. If the argument is specified as False, only this document will be saved. The argument is ignored if the document doesn't have any dependents needing save.
DocumentsToSaveOptional input ObjectCollection that contains the Document objects to save. Use the Document.AllReferencedDocuments property to iterate over all dependent documents and find the ones that need to be saved (i.e. Dirty property returns True). If the SaveDependents argument is True and this argument is not specified, all dirty documents are saved. The argument is ignored if the document doesn't have any dependents needing save.

Remarks

If the document has never been saved, calling this method prompts the user for a file name just like the Save method. Calling Document.Save2 without specifying any arguments results in the dirty dependents getting saved. The "Save Dependents" dialog is not displayed (the Save method does display the dialog).

Version

Introduced in Inventor version 2010

0 Likes