Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ilogic Rule to delete iproperties fields, during file "save as"

5 REPLIES 5
Reply
Message 1 of 6
MarcoMoura9852
446 Views, 5 Replies

Ilogic Rule to delete iproperties fields, during file "save as"

Hi Everyone.

 

I need help with an ilogic rule and/or trigger.

 

When performing a inventor file (assembly / part)  "SAVE AS", I want to delete exisitng values on the following iproperties fields:

iProperties.Value("Summary", "Title") = ""
iProperties.Value("Summary", "Subject") = ""
iProperties.Value("Summary", "Author") = ""

 I only want to do this operation in case I perform a "SAVE AS" operation. That must be the trigger.

 

Explaining the reason for this need:

When performing a "SAVE AS" of a part, with the intent to change it, it's usual to forget to update the fields mentioned above, and this causes errors on the part-lists I used. If the values are deleted, the mistake is easily detected.

 

Can anynone help me to get this specific rule and/or trigger event?

 

 

5 REPLIES 5
Message 2 of 6
WCrihfield
in reply to: MarcoMoura9852

Do you want to delete those values from the original document, or from the new document?  The ApplicationEvents.OnDocumentSave Event says that it only works for regular Save and SaveCopyAs (does not mention SaveAs), so I don't know if this would work for your situation or not.  And the ApplicationEvents.OnNewDocument Event may not work either, because there is no filter for 'only when made by SaveAs'.

 

If you did use the OnNewDocument event, I suppose you could use the returned document object to check to see if those iProperties have any current values, and if so, set them to empty strings.  This might mess some stuff up though if your template has some 'starter' or 'default' entries in those positions, and you use the New command to create a new document based on that template.  And might mess something up when using SaveCopyAs.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6
MarcoMoura9852
in reply to: WCrihfield

Hi,

 

Thank you for the fast reply.

I intend to delete iproperties on the new file (created during the save as).

 

I'll try the two options you've mentioned.

 

Best Regards.

Message 4 of 6
WCrihfield
in reply to: MarcoMoura9852

I don't know if you are familiar with how to use those types of events or not, but I actually created a contribution post that attempts to explain the process of creating your own custom event handler codes that you might find helpful.  Below is a link to that resource.

Create & Use Event Handler(s) (Triggers) In iLogic Rule Other Than Ones In Event Triggers Dialog 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 6

Looking for the same functionality, commenting so I can get updates on this thread.  

Message 6 of 6
WCrihfield
in reply to: BeasterlyJEC92

Hi @BeasterlyJEC92.  Unfortunately, this is an old discussion thread, so it may not get many future updates.  And the link I posted in my last reply here, back in early 2022 is now broken, because its destination web page was taken down.  Back at that time, users had the ability to post what were known at the time as 'contribution posts', which were associated with our Autodesk Community account.  People could click on our user name, then click on our contribution posts to see them.  All those were taken down a couple years ago.  They restructured the 'community' and needed to make room for various other avenues of online interactions.

 

Luckily, I copied the contents of that contribution post to a Microsoft Word document, then exported it as a PDF, to preserve it locally.  I will post that PDF below, so you can read it for yourself.  It probably needs to be updated by now, but should still be helpful...at least I hope so.  There are now several more example codes present on this forum that use these than there were back then.  So, if you use the search functionality of this forum, an type in something like "EventHandler", "AddHandler", "WithEvents", or just "event handler", you should find some discussion topics involving those terms, and they will likely include some example codes.  Although, these are generally better suited for use within Inventor add-ins, than within regular iLogic rules.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report