iLogic rule to save an assembly

iLogic rule to save an assembly

luke.scottWYFAG
Contributor Contributor
333 Views
2 Replies
Message 1 of 3

iLogic rule to save an assembly

luke.scottWYFAG
Contributor
Contributor

Hi All,

I have (i think) a simple issue, I would like to create an iLogic rule that when run will save the assembly I have open, Is this something that can be done?

I have seen lots of info about save as and different file types but nothing on a plane old save.

 

I need to do this as I have an odd situation where I have a rule that deletes suppressed parts and then changes the level of detail of all the assemblies in my top level, but unless there is a save between these two rules the deleted suppressed parts come back.

those extra few lines about is a bit of foreshadowing for if I'm told it can be done.

 

(I guess this is something that can be done with VB.Net as well but i have zero idea of where to even start with that).

 

 

0 Likes
Accepted solutions (2)
334 Views
2 Replies
Replies (2)
Message 2 of 3

dalton98
Collaborator
Collaborator
Accepted solution

Could you post your code? I'm having a hard time understanding what your doing exactly.

Heres how you would save the active file:

ThisApplication.ActiveDocument.Save    

 

Message 3 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @luke.scottWYFAG.  Just to add to what @dalton98 already contributed...if the Save needs to happen between two rules running, it would most likely be best to include a Save at the end of your first rule's code, because that rule will most likely contain a variable which represents the main assembly that the Save method needs to target.  You could use that variable, for example 'oMainAssemblyDoc' to save that main assembly like this:

oMainAssemblyDoc.Save
'or, if you do not want to save dependants
oMainAssemblyDoc.Save2(False)

Besides that tip.  If the independent rule you create to save the main assembly is a local/internal rule, saved within the main assembly document, it might be better to use:

ThisDoc.Document.Save

...because that will target the 'local' document (the document that the rule is saved within), to avoid confusion, just in case the main assembly is not currently the 'active' document when that rule gets ran.  Just some thoughts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)