Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

createExecutionHandler - customFeature timeline grouping

0 REPLIES 0
Reply
Message 1 of 1
riik_b
185 Views, 0 Replies

createExecutionHandler - customFeature timeline grouping

hey,

 

I'm trying to create a custom feature where i create a hole in a body and place a new body in part of the hole (i'm not certain if the new body will connect in part directly to the starting body). I have got everything working except the timeline grouping into a singular feature.

 

i can use the customFeatureInput.setStartAndEndFeatures but when i incorperate all the sub features the model doesnt change, when i leave a singular sub feature out it works as intented.

 

i hope that someone can help me with this.

 

inner_body = createRoundCylinder(-inner_box.realValue, inner_box.realValue)
outer_body = createRoundCylinder(-outer_box.realValue, outer_box.realValue)

 

face = getFaceUnderPoint(sketch_point.worldGeometry)
target_body = face.body
target_component = target_body.parentComponent

base_feature_outer = target_component.features.baseFeatures.add()
base_feature_outer.startEdit()
target_component.bRepBodies.add(outer_body, base_feature_outer)
base_feature_outer.finishEdit()

tool_bodies_outer = adsk.core.ObjectCollection.create()
tool_bodies_outer.add(base_feature_outer.bodies.item(0))

negative_input = target_component.features.combineFeatures.createInput(target_body, tool_bodies_outer)
negative_input.operation = adsk.fusion.FeatureOperations.CutFeatureOperation
negative_feature = target_component.features.combineFeatures.add(negative_input)

base_feature_inner = target_component.features.baseFeatures.add()
base_feature_inner.startEdit()
target_component.bRepBodies.add(inner_body, base_feature_inner)
base_feature_inner.finishEdit()

tool_bodies_inner = adsk.core.ObjectCollection.create()
tool_bodies_inner.add(base_feature_inner.bodies.item(0))

positive_input = target_component.features.combineFeatures.createInput(target_body, tool_bodies_inner)
positive_input.operation = adsk.fusion.FeatureOperations.JoinFeatureOperation
positive_feature = target_component.features.combineFeatures.add(positive_input)

design: adsk.fusion = _app.activeProduct
default_units = design.unitsManager.defaultLengthUnits
custom_feature_input = target_component.features.customFeatures.createInput(_customFeatureDefinition)

custom_feature_input.addCustomParameter("inner_box", "inner bos", inner_box, default_units, True)
custom_feature_input.addCustomParameter("outer_box", "outer bos", outer_box, default_units, True)
custom_feature_input.addDependency("point", sketch_point)

custom_feature_input.setStartAndEndFeatures(base_feature_outer, positive_feature)
                target_component.features.customFeatures.add(custom_feature_input)

 

Labels (3)
0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report