Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

if statement question in child

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
matthew.nichols
831 Views, 7 Replies

if statement question in child

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!

7 REPLIES 7
Message 2 of 8

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.

Message 3 of 8
TIMOHART
in reply to: JackGregory

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 }

 

 

ETO 2014 R2
HP Z420 / Win7 X64
16GB RAM
Nvidia Quadro K4000

Message 4 of 8

would the same be true in a way in you were wanting to control the suppression of a feature within a child?

Message 5 of 8

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.

 

 

Message 6 of 8

that worked perfectly!  thank you very much for the help!!

Message 7 of 8

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!

Message 8 of 8

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report