Hi.
I want to use a parameter in my assembly as the name of a part i'm referring to in a rule but so far I have had no luck making it work. My knowledge of iLogic is pretty limited.
I am making a configurator for a staircase and I am working on the stringers now. There will be 3 or 4 different stringers (each one is a separate part) and the configurator lets you choose things like the angle, length and height of the staircase by entering values for those in a form in the assembly. Once you are done entering the values, there will be an update button that will send all the parameters to the different parts that are in the assembly and have them change accordingly. Now, say I want the length to change. I enter a length and press update and here's my problem. To which stringer-part is it going to send the length to? I can make it send to all parts but that means that I have to write one line of code for each part and if I ever add a new kind of stringer, I need to check all the rules and new lines where needed. I would like to make this dynamic by having only one line in which the part name is the same as a parameter I have in my assembly
I can either write it like this:
Parameter("Stringer1:1", "Length") = Length Parameter("Stringer2:1", "Length") = Length Parameter("Stringer3:1", "Length") = Length Parameter("Stringer4:1", "Length") = Length
But I would like to write it like:
Parameter(""Assemblyparameter":1", "Length") = Length
Where Assemblyparameter is a text parameter and simply the name of the part that is inserted.
When I choose, for example, stringer 3 in my form, Assemblyparameter will be Stringer3. This would save lots of time in the future whenever new parts are added.
I hope I explained this good enough.
Any help would be greatly appreciated.
/ Peter Ö
Hi and welcome to the forum!
Try something like this:
Parameter(Assemblyparameter & ":1", "Length") = Length
If this doesn't work, try this instead:
oCompName = Assemblyparameter & ":1"
Parameter(oCompName, "Length") = Length
You can concatenate separate text entities (link them together in a series) into a single text string by using & between them.
I wonder if there is an even better way of solving this problem, however. How exactly are you making it change between the three stringer types? Are you using component suppression, visibility, or maybe component replace? Depending on how you are doing this, there may be a more elegant solution.
Cameron Whetten
Inventor 2012
Please click "Accept as Solution" if this response answers your question.