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
-
NeilCooke Moderator, Onshape Employees Posts: 5,714More efficient to use opExtrude opBoolean
Senior Director, Technical Services, EMEAI5
Answers
Thank you for your answer. I tried to use extrude, but it has no effect on the part.
I must be doing something wrong.
Thanks for your help!
Shimon
<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>
You can hit the "code" formatting button:
And then paste code from your feature studio into the yellow box that shows up.
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.
Shimon