Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Why do I get a "Duplicate feature parameter" error when defining parameters inside IF...ELSE?
aaron_patty
Member Posts: 3 ✭
Why does the following code throw a "Duplicate feature parameter 'tubeLength'" error when the definition.tubeLength definition can only execute once?
annotation { "Name" : "Type" } definition.tubeTypeTest is TubeTypes;
if(definition.tubeTypeTest == TubeTypes.TOP)
annotation { "Name" : "Length" }
isLength(definition.tubeLength, TOP_TUBE_LENGTH_BOUNDS);
else if(definition.tubeTypeTest == Tube.HEAD)
annotation { "Name" : "Length" }
isLength(definition.tubeLength, HEAD_TUBE_LENGTH_BOUNDS);
More specifically, how do I use the same definition.myVar with different LengthBoundSpec definitions based on the earlier input?
More specifically, how do I use the same definition.myVar with different LengthBoundSpec definitions based on the earlier input?
0
Best Answer
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,215This is a current limitation. You can work around it by using different parameters in the precondition and then doing:
if (definition.tubeTypeTest == Tube.HEAD)
definition.tubeLength = definition.headTubeLength;
in the body.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5
Answers
if (definition.tubeTypeTest == Tube.HEAD)
definition.tubeLength = definition.headTubeLength;
in the body.