Got a question about how to create an if statement in a child of an ETO assembly.
I want to have an if statement as follows:
if parameter <= value then
suppress feature
else
unsuppress feature
end if
how would i go about doing this in a ETO assembly child?
Thank you for the help!
Solved! Go to Solution.
Solved by JackGregory. Go to Solution.
Assuming you want the child to be conditional, you replace the "Design name" in the Child rule with an expression returning a design name, and if the expression is false, then it should return :NullDesign. Like this
Child Maybe_Baby As (If param1 > 0 Then :MyBaby Else :NullDesign)
head_diameter = param1
End Child
Null instances actually exist, but they don't show up in the tree. You could ask Maybe_Baby.IsNull? and it would return true if param1 was zero. So your other code could detect the presence or absence of it without having to know its criteria for existence.
I do this with an extra rule.
within the child you apply a paramter list to suppressed features
child ....
...
suppressed feature = parameterList
...
end child
Rule ParamterList
if para1 > 1 then ParameterList = { suppressed features }
else
ParameterList = { other suppressed features }
would the same be true in a way in you were wanting to control the suppression of a feature within a child?
I specifically didn't address feature suppression in the orginal response, because they weren't mentioned in the subject line. ETO allows the control of suppression of features via two list parameters on IvAdoptedPart. So it only works for adopted parts, and you need to know the names of the features in that part. So, altering my earlier example a little, you would do something like this:
Parameter Rule suppressBoss? As Boolean = false
Child Maybe_Boss As :MyBaby
suppressedFeatures = (If suppressBoss? Then {"extrusion1"} Else {})
End Child
You can also unsuppress features with the unsuppressedFeatures parameter. Having both of these means you don't have to list all the others when you are dealing with many. The two lists are processed in suppress, then unsuppress order. So If you put the same feature name in both, the feature will be unsuppressed on update.
Be wary of order here; these lists are processed in order, and you can cause Inventor to be really confused if you try to suppress something that already disappeared because of a dependency. Just write them in the same order you would perform them when sitting in front of Inventor.
I have a question on nulling out a child and the constraints. how do i control the constraints when i am turning off and on a part within an assembly?
for example...i am working on a basketball court, and am making it to where if the court length is under 50' then only 1 lane will show, and when i do that it removes the constraints and then when i change the parameters to where the 2nd lane comes back on the constraints aren't there anymore.
How do i fix this?
thank you for the help!
Can you start a new queston for this? And when you do, I think we need an example or something. Constraints are children too, and they are also dependent. So you might have to handle them with the same logic as the main child.