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: 

Global form trigger

2 REPLIES 2
Reply
Message 1 of 3
ysbaodnj
80 Views, 2 Replies

Global form trigger

There are radio buttons A and B in the Inventor global form. I want to set it so that when I click A, the list corresponding to A is retrieved from the list box below, and when I click B, I want to retrieve the list corresponding to B.
A and B are multitext with one parameter, and the list is the same.
For example,
parameter choice: A, B
parameter list: 1,2,3,4,5,6,7,8

The result I want is as follows.
Choice A: 1,2,3,4
Choice B: 5,6,7,8

The current problem is that all lists, whether A or B, appear.
How can this be done?

2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: ysbaodnj

Hi @ysbaodnj.  What version / year of Inventor are you using?  So, are you working with just two multi-value parameters right now, or are there three?  In order to have radio buttons showing in your form, there must be a single multi-value parameter, added into the form, then you have that parameters value being controlled by a radio button group, where there is one radio button for each available value in its multi-value list.  So, in my mind, you must be using one parameter named something like "AorB" or "AB", and it has two Text type values ("A" & "B"), and that is why you have a radio button labeled A, and one labeled B, is that correct?  If not, then can you please explain it clearer, and maybe also include some screen captured images of your form, its settings, and the Parameters dialog?

 

The secondary multi-value UserParameter (the one getting its list of available values changed between one list or another list) would need its list of available values changed every time that other parameter's value changes.  And since this is a global iLogic form, I would use an external iLogic rule to help control this behavior behind the scenes, but I might also include the help of an internal iLogic rule also, to make it more efficient.  The internal iLogic rule could be placed within the document, and would only be used to trigger the external iLogic rule to run whenever that one specific parameter's value changes, by including a 'dummy' variable within the code, with its value set to the blue, unquoted name of that parameter.  Then it will also contain a line of code to run the external iLogic rule.  When that external iLogic rule runs, it will check the value of the 'triggering' Parameter, and depending on its value, will set the list of available values for the other parameter accordingly.  At least that's the plan.

PS:  If you do not want to use an internal iLogic rule for triggering the external rule to run, then you could use the Event Triggers dialog, and put that external iLogic rule under the 'Any User Parameter Change' event.  But then it may run many more times than is really needed, but should still get the job done.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3
WCrihfield
in reply to: ysbaodnj

Hi @ysbaodnj.  Here are a series of screen captured images and iLogic rule code examples to show a scenario like this working.

Here are the parameters in the parameters dialog:

WCrihfield_0-1718973505715.png

WCrihfield_1-1718973549484.png

Here are images of the global iLogic Form editor, showing the settings for both controls (parameters):

WCrihfield_2-1718973684084.png

WCrihfield_3-1718973706478.png

Here screen shots of the finished Form, with either value selected, and showing the resulting values for the other parameter.

WCrihfield_4-1718973797900.png 

WCrihfield_5-1718973833769.png

Here is the internal iLogic rule within the document:

WCrihfield_6-1718974094417.png

And here is the code within that rule:

'AB' is the blue, unquoted name of the one parameter, and due to the way we are using it here, any time its value changes, that will cause this rule to run.  And when this rule runs, it will run the external iLogic rule named here.

oTrigger = AB
iLogicVb.Automation.RunExternalRule(ThisDoc.Document, "Toggle Multi-Values By Param Value Change")

And here is the code within that external iLogic rule named "Toggle Multi-Values By Param Value Change".

The first line is just getting the value of that triggering parameter from the 'ThisDoc.Document' document, that was specified by the other rule as the one this rule should be focused on.  Then it sets a couple options / properties, then it checks the value of that initial parameter, and sets the available values of the other parameter accordingly.

Dim oAB As String = iLogicVb.Automation.ParamValue(ThisDoc.Document, "AB")
MultiValue.UpdateAfterChange = True
MultiValue.SetValueOptions(True)
Dim oValues() As String = {}
If oAB = "A" Then
	oValues = {"1", "2", "3", "4" }
	MultiValue.SetList("ValuesForList", oValues)
ElseIf oAB = "B" Then
	oValues = {"5", "6", "7", "8" }
	MultiValue.SetList("ValuesForList", oValues)
End If

 

 

 

 

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