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: 

Does iLogic event properties "AfterAnyUserParamChange" not work with DrawingDocument Objects in 2023?

5 REPLIES 5
Reply
Message 1 of 6
dwlawrence
254 Views, 5 Replies

Does iLogic event properties "AfterAnyUserParamChange" not work with DrawingDocument Objects in 2023?

I've borrowed some code to trigger iLogic using external rules on events for use on legacy documents by using the "temporary rule to give it Document Interest" trick and am finding that the "AfterAnyUserParamChange", 3000) arguments work in part files, but not in a drawing file. I've attached the rule that was taken from a posting by @MjDeck  and @Charlies_3D_T some time ago and have attached it.

 

I started off, before finding this helpful info, by trying to listen for DrawingEvents but abandoned that idea in favor of this (commented code) still to be cleaned up in the rule as I'm testing.

 

The idea is I've got to inject these rules into certain event triggers in order to get them to create parameters and change their values in a template. And I have the iLogic_Rule_Batch_Tool.exe that started out to (I believe) be the code Injector tool.

 

If this doesn't work for Drawings, I'll have to get creative.

 

Thanks.

 

Inventor 2023.5.1 on a Win 11 system.

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

I am not sure about 2023.5.1, but manually, that general event does work just fine in 2024.3.1 (which I am currently using).  I just tested it.  I have worked with the iLogic Event Triggers 'local' settings by code off and on for several years now, and it has been a bumpy road, to say the least.  I even published multiple articles about it in the knowledge.autodesk.com area, but they (and all others like it) got taken down a year or two ago.  There are far simpler ways to get that PropertySet, if it even exists at all yet.  It will not exist yet if there has never been any interactions with it yet in the history of that file.  When creating new entries (adding new properties) into that PropertySet, in a specific PropID range, I have made it a habit (in my code process) to always check for existing properties in that area first, then if some are found, increment the 'Index' at the end of the property's name, and the PropID value to the next available Index within that PropID range.  I always add that Index number value to the end of the Property.Name, which starts with the event's internal name, then that index value.  When we add rules to it manually (which creates a new property), the first one added in that area (under that type of event - within that PropID range), its 'name' usually gets a zero added to the end of it.  Not just the event's internal name alone.  This keeps each property's name unique.  I also noticed in your rule example that you are using two different code phrases for specifying what document you want the code to be using (ThisApplication.ActiveDocument & ThisDoc.Document).  That is usually not a good practice, because there are situations where those two can have different values (represent different Documents).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6
dwlawrence
in reply to: dwlawrence

Thanks, Wesley. And good catch on that ThisApplication.ActiveDocument vs. ThisDoc.Document....I, since posting, saw that too and changed it ThisDoc.Document.

 

I also have, since posting, used a For PropID As Integer = 3000 To 3099/Next and it failed in 2023.5.1 as well on me.

 

I'm going to try it in Inventor 2025 and see if it works in that version.

Message 4 of 6
dwlawrence
in reply to: dwlawrence

It worked in 2025 and, curiously, in 2023 now. Though, in 2023, I had an event trigger for a rule on "AfterDocOpen" that triggered a series of rules (this one included) that went like Dominoes. So, I tried with a brand new document just using the "AfterAnyParamChange" to trigger my one rule on and that worked also. 

 

"Bumpy road" is the correct term!

 

It appears to be working fine, though. Thanks!

Message 5 of 6
MjDeck
in reply to: dwlawrence

Hi @dwlawrence - glad you got it working. If you want it to be more general you might have to add code to check for event trigger properties that already exist in the document. There can't be duplicate values for Name and PropId. Look for existing values and use them to adjust your arguments in the call to add a property (PropertySet.Add).

We have a plan to add a dedicated API for event triggers. That would make it much easier. This is internal number INVGEN-3643.

If you want this behavior on all drawings, you could add it in the Drawings tab of the Event Triggers dialog.


Mike Deck
Software Developer
Autodesk, Inc.

Message 6 of 6
dwlawrence
in reply to: MjDeck

Great! Thanks, Mike!

 

-Daren

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

Post to forums  

Autodesk Design & Make Report