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 Feature Script opExtrude REMOVE not working and making a NEW part?
shimon_shmulman
Member Posts: 5 ✭



Hello,
I am trying to shorten the cylinder by opExtrude with the following code:
FeatureScript 1301;
import(path : "onshape/std/geometry.fs", version : "1301.0");
annotation { "Feature Type Name" : "Face 03" }
export const face03 = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
annotation { "Name" : "Face", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }
definition.prop_face is Query;
}
{
opExtrude(context, id + "extrude1", {
"operationType" : NewBodyOperationType.REMOVE,
"entities" : definition.prop_face,
"direction" : evPlane(context, { "face" : definition.prop_face }).normal * -1,
"endBound" : BoundingType.BLIND,
"endDepth" : 200 * millimeter
});
});
For some reason NewBodyOperationType.REMOVE tag is not working and a new part is generated.
Please help, what can be done?
Shimon
For some reason NewBodyOperationType.REMOVE tag is not working and a new part is generated.
Please help, what can be done?
Shimon
Tagged:
0
Best Answer
-
More efficient to use opExtrude opBoolean
Senior Director, Technical Services, EMEA5
Answers
-
operationType is not a parameter for opExtrude. You will need to do an opBoolean to remove the body created by your opExtrude. This is the preferred method.The extrude function includes opBoolean and so operationType is valid for that.Senior Director, Technical Services, EMEA0
-
Neil,
Thank you for your answer. I tried to use extrude, but it has no effect on the part.
I must be doing something wrong.FeatureScript 1301;import(path : "onshape/std/geometry.fs", version : "1301.0");annotation { "Feature Type Name" : "Face 03" }export const face03 = defineFeature(function(context is Context, id is Id, definition is map)precondition{annotation { "Name" : "Face", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }definition.prop_face is Query;}{extrude(context, id + "extrude1", {"entities" : definition.prop_face,"direction" : evPlane(context, { "face" : definition.prop_face }).normal * -1,"operationType" : NewBodyOperationType.REMOVE,"defaultScope" : true,"endBound" : BoundingType.BLIND,"depth" : 200 * millimeter});});0 -
More efficient to use opExtrude opBoolean
Senior Director, Technical Services, EMEA5 -
Neil,
Thanks for your help!
Shimon0 -
Just want to share with the community the working code for this issue:
<b>FeatureScript 1301;</b><br><b>import(path : "onshape/std/geometry.fs", version : "1301.0");</b><br><b>annotation { "Feature Type Name" : "Face 03" }</b><br><b>export const face03 = defineFeature(function(context is Context, id is Id, definition is map)</b><br><b> precondition</b><br><b> {</b><br><b> annotation { "Name" : "Face", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }</b><br><b> definition.prop_face is Query;</b><br><b> annotation { "Name" : "Solid", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 1 }</b><br><b> definition.prop_body is Query;</b><br><b> </b><br><b> }</b><br><b> {</b><br><b> opExtrude(context, id + "extrude1", { </b><br><b> "operationType" : NewBodyOperationType.REMOVE, </b><br><b> "entities" : definition.prop_face,</b><br><b> "direction" : evPlane(context, { "face" : definition.prop_face }).normal * -1,</b><br><b> "endBound" : BoundingType.BLIND,</b><br><b> "endDepth" : 200 * millimeter</b><br><b> });</b><br><b> opBoolean(context, id + "boolean1", {</b><br><b> "tools" : qBodyType(qCreatedBy(id + "extrude1", EntityType.BODY), BodyType.SOLID),</b><br><b> "targets" : definition.prop_body,</b><br><b> "operationType" : BooleanOperationType.SUBTRACTION</b><br><b> });</b><br><b> </b><br><b> });</b>0 -
FYI @shimon_shmulman
You can hit the "code" formatting button:
And then paste code from your feature studio into the yellow box that shows up.example
Jake Rosenfeld - Modeling Team0 -
Jake,
I did hit the code format, but then only the first line was visible.
Is it supposed to work this way?
In addition, I still do not understand what was wrong with my extrude function.
Shimon0


