Invoke save dialog

Invoke save dialog

j.pavlicek
Collaborator Collaborator
474 Views
5 Replies
Message 1 of 6

Invoke save dialog

j.pavlicek
Collaborator
Collaborator

Is possible to invoke save dialog by iLogic (like hitting save icon in an assembly)?

jpavlicek_0-1640096424161.png

 



Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes
Accepted solutions (2)
475 Views
5 Replies
Replies (5)
Message 2 of 6

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Have you tried to disable "Silent mode" in the iLogic Options for this rule? This option suppress Inventor dialogs and is enabled by default.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 6

JelteDeJong
Mentor
Mentor

can you try:

Dim doc As Document = ThisDoc.Document
doc.Save()

' other posebilities
' ---> doc.Save2(Optional SaveDependents As Boolean = True, Optional DocumentsToSave As Object = Nothing) <---
' Summary:
'     Method that saves the document and the specified dependent documents.
'
' Parameters:
'   SaveDependents:
'     Optional 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.
'
'   DocumentsToSave:
'     Optional 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.

' ---> doc.SaveAs(FileName As String, SaveCopyAs As Boolean) <--
' Summary:
'     Saves this document into a file of the specified name.
'
' Parameters:
'   FileName:
'     Input String that specifies the name of the file to save the document into.
'
'   SaveCopyAs:
'     Input Boolean that indicates whether the file to be saved is new or is a copy
'     of a previously existing file.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 4 of 6

JelteDeJong
Mentor
Mentor

Or if you want the dialogue to appear always you could use:

Dim Dialog As Inventor.FileDialog
ThisApplication.CreateFileDialog(Dialog)
Dialog.Filter = ("Assembly file *.iam|*.iam")
Dialog.ShowSave()

Dim doc As Document = ThisDoc.Document
doc.SaveAs(Dialog.FileName, False)

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 5 of 6

j.pavlicek
Collaborator
Collaborator
Accepted solution

@Ralf_Krieg Thank you, this is what I need.

Note: For disabling Silent Operation you have to add this line at top of your code.

 

' <SilentOperation>False</SilentOperation>

 

Or you can use GUI

jpavlicek_0-1640165636847.png



Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes
Message 6 of 6

j.pavlicek
Collaborator
Collaborator
@JelteDeJong Thank you, your answers are good and useful, but not exactly what I want. In my special case I want to be sure that the assembly is saved, but in case there are some "dirty" files among referenced files, user is asked to save (but he is still able to refuse).

It's lazy solution for checking all referenced files for "dirtiness" before the main assembly manipulation.


Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes