iLogic, temporary preselection in MultiValueList

iLogic, temporary preselection in MultiValueList

BRLMCHKD
Advocate Advocate
960 Views
8 Replies
Message 1 of 9

iLogic, temporary preselection in MultiValueList

BRLMCHKD
Advocate
Advocate

Hi 🙂

 

My question integrated the inserted screen photo.

 

2020-11-23_09-52-06.png

0 Likes
Accepted solutions (1)
961 Views
8 Replies
Replies (8)
Message 2 of 9

WCrihfield
Mentor
Mentor

Here is a link to a fairly well known iLogic example by Curtis Waguespack which demonstrates setting up multiple dynamically filtered multi-value lists based on selections from prior multi-value lists.

https://inventortrenches.blogspot.com/2017/02/ilogic-dynamic-multivalue-parameter.html 

Maybe this will help you set-up the scenario your trying to achieve.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 9

J-Camper
Advisor
Advisor

I think you can set up your second list to have the first list as an option:

List 1List 1List 2 with List 1 as an optionList 2 with List 1 as an option

Setting them in a rule would look like:

MultiValue.SetList("LIST1", "1.0 in", "2.0 in", "3.0 in", "4.0 in", "5.0 in")

MultiValue.SetList("LIST2", "LIST1", "1.0 in", "2.0 in")

 

Let me know if this is enough for your intention, or if you have any questions

0 Likes
Message 4 of 9

JMGunnar
Collaborator
Collaborator

You can use expression 

 

Parameter.Param("ConTck").Expression = "HeaderTck"

 I add one ipt exampe  with forms 

 

Best Johan

0 Likes
Message 5 of 9

BRLMCHKD
Advocate
Advocate

Hi 🙂

 

I have tried to make a preselection of ConTck with the code added in the foto,

but errors occurs, what am I doing wrong?

 

2020-11-24_15-31-54.png

 

KR/

 

0 Likes
Message 6 of 9

WCrihfield
Mentor
Mentor

I'm assuming (from the error message file extension) that you are working with an assembly, and that the form shown in your first post is a local iLogic form, which is local to this assembly, and that the iLogic rule we're attempting to create is going to be a local rule, and local to this assembly?

If all that is true, this might work for you.

Since the form is local, it should immediately react to your parameter changes within it.  And if the rule is also local to this document, it should recognize local parameters and turn them blue within your rule editor.  If so, we can use this to trigger the rule to run immediately when the first parameter is changed, by setting up a 'dummy variable' and make it equal to the local (blue) parameter name of the first parameter.  That's our trigger.  Now for the rest of the code to change the current value of the second multi-value parameter to equal the value of the first parameter, then allow you to change it later.  Here's what I think may work for your situation.  When you get the actual UserParameter object, you can access and work with its ExpressionList property, which should make this work.

Here's the code.

(on your machine, the parameter name after oDV = , should turn blue (by default) if it is a local parameter.)

 

oDV = HeaderTck_iLoForm

'Get the UserPameters collection for the active document
Dim oUParams As UserParameters = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters

'Get the current value of the parameter that triggered this (as a String)
Dim oVal As String = oUParams.Item("HeaderTck_iLoForm").Value.ToString

'Get the ExpressionList (Array of String) from the target param, so we don't loose it when we set the value
Dim oUParam2 As UserParameter = oUParams.Item("ConTck_iLoForm")
Dim oUP2Values() As String = oUParam2.ExpressionList.GetExpressionList

'Get the 'Index' of the source value within the target param's ExpressionList array
Dim oIndex As Integer = Array.IndexOf(oUP2Values, oVal)

'Set the same list back to the target param,
'but change its current value to the value at that 'index' of its values
oUParam2.ExpressionList.SetExpressionList(oUP2Values,True,oIndex)

 

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

If you have time, please... Vote For My IDEAS 💡and Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 9

BRLMCHKD
Advocate
Advocate

Hi W.Crihfield

Yes correct, the rule is added local in the specified assembly.

This morning, I have tried the rule code you have specified.

I could only succeed to change the "ConTck" parameter once.But subsequently it has not changed value when

"HeaderTck" value have been changed? Your code see inserted foto, sorry for the poor quality, I work home on a VPN connection.

But I just mean that I in the past, have seen a simpler code to do this trick. 

 

2020-11-25_09-04-10.png

 

 

 

 

0 Likes
Message 8 of 9

WCrihfield
Mentor
Mentor

I'm curious why you seem to have two versions of every parameter.  One that seems like the original, and one with "_iLoForm" at the end of it.  Judging by the image in your previous post, you seem to be referencing a model file found within your Vault system.  And the original parameter's seem to be found within that, then you've created copies of all those parameters within the active assembly.  Are you attempting to 'drive' all those parameters within the referenced model by the local model's parameters?  Since I'm not currently working with Vault, I wouldn't really know how that interaction should function, so I wouldn't be able to offer any advice there.

   In your last post, within the rule named "Rule for Form", I assume this is just to push all those parameter values out to the referenced model file, right, and not intended to aid in firing the following rule named "PreSelect of ConTck"?  So, these rules should fire in the order they are listed within the document, unless otherwise specified.  If so, you've already pushed the value of both of those parameters out to the referenced model, without the value of "ConTck_iLoForm" having been changed by the third rule yet.  Perhaps adding a line of code to the end of that third rule that will do as it does in the second rule, and push its value out to the referencing model, after it has been changed would work for you (or vise versa).  You may also need to change the order the rules are running, but I'm not sure.  And if you don't need to maintain a multi-value list within the referenced model file, you could likely just eliminate the list preservation technique within my last posted code, and just set the value  directly.

   Also within your iLogic rule editor dialog box, while you've got each of those rules open, make sure that on the Options tab, under "Behavior of this Rule" the "Silend operation" option is checked, and the "Fire dependent rules immediately" option is checked.  And make sure the following options are turned off:  "Don't run automatically", "Straight VB code", "Suppressed".

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 9

BRLMCHKD
Advocate
Advocate
Accepted solution

Hi W.Crihfield

Why I have two versions of the same parameter, when the only difference is the suffix _iLoForm?

The reason is, that I have a Skeleton part, where I control certain key parameters in my assembly

via a Form called ‘Rule for Form’ see inserted foto.

 

But I have now concluded that it is actually not such a good idea anyway, with the temporary

preselection in the MultiValueList. It is difficult to explain why, but I give it a try.

 

First I liked the idea that “ConTck” automatically adjusts when I changed on the value of “HeaderTck”

(because that’s how it will be, for the most part, in reality). But there may also be cases where I

change the “HeaderTck”, but where I still want the “ConTck” unchanged.

 

Therefore, it is actually not very appropriate to set up any rule for this anyway. As first assumed.

Sorry for the inconvenience I have caused, and Thanks for all the helpfulness. 🙂

 

KR/2020-11-26_07-38-05.png

0 Likes