rule delayed running from Forms

rule delayed running from Forms

GeertvanderHeide
Advocate Advocate
476 Views
4 Replies
Message 1 of 5

rule delayed running from Forms

GeertvanderHeide
Advocate
Advocate

I have a pick command to select an occurrence in an assembly. 

Works like a charm, no problems with that. 

 

but when i make a form button in the "BrowserUIFormSpecification" the prompt of the pick function doesn't show after i click the button.

i first have to click once and then the tooltip shows.

 

Dim oOcc As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select model, Exc to Exit")
If oOcc Is Nothing Then Exit Sub

 when excecuting the rule from the rules tab ik does work instantly. 

als when i create a form, and put the rule as a button in that form it also works instatly.

 

Is there any delay, or something that i am missing here? it seems like this is something that should not be possible.

 

kind regards, 

 

Geert

0 Likes
Accepted solutions (1)
477 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @GeertvanderHeide.  I am not familiar with that term "BrowserUIFormSpecification".  Where do you see that?  Is it something new & unique to Inventor 2023?

Edit:  I just found something very similar "iLogicBrowserUiFormSpecification", which was the name of an XML file, where the external iLogic Forms are stored on disk.  Did you add the form button for the rule by editing the XML file directly?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

GeertvanderHeide
Advocate
Advocate
under the forms tab you can add forms. the funny thing is that this tab itself is also a form.
In stead of add form you should be able to choose 'edit'.
"iLogicBrowserUiFormSpecification" is indeed the file where these forms are stored.
you can isntead also add rules here to directly run a rule.
we use this for example to directly run external rules, so it is just like buttons.
This is because you can't add rules as buttons before 2023 i think.
Its a nice way to share quick access to global rules with mulitple users.

This is however also possible within parts/assemblies. i don't know excactly where the xml is stored in this case,, but you can just add rules/ forms with the normal ilogic form edit screen 😉
0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor
Accepted solution

OK.  I knew about adding rule buttons directly to the Forms tab, because we have been able to do that for years, and I used to do that too.  However, now I simply have way too many rules/forms, so I no longer use those direct buttons anymore.  I tested a few things out though by placing a few of my simpler external rules as buttons under the Global Forms tab (which I already have 3 main sub-tabs under), and tested their functionality out.  Most normal stuff still seems to work OK, but just as you said, when using the Pick function right away in the code, it seems like it just creates a 'InteractionEvents' instance, then starts it, because it has the little plus sign by your pointer, but the model space is not yet activated, so you have to click in model space first to activate it, then it will allow you to actually select something with your next click.  I have seen this behavior before when using custom selection procedures from external rules.  I am not sure why it acts this way in this specific scenario, but I assume it is related to when you use an external rule, and have to use the Apply button before it will send changes/edits to the document, instead of it happening automatically/immediately when done with a local form.  This situation might require something like AppActivate(ThisApplication.Caption), to activate Inventor's main window after the Pick function is called, but I don't remember at the moment how we dealt wit that awkward situation in other automation solutions.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

GeertvanderHeide
Advocate
Advocate

pasting the AppActive command before the Pick function seems to work for now! 

i don't think this will work when you paste it after the pick command, because it defines an object in the same line.

 

Thank You!

0 Likes