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.
Thicken doesn't seem robust
marcosinetheta
Member Posts: 2 ✭
I'm trying to make a thin-extrude feature in featurescript. I want to be able to pick a face (or faces) and have it extrude a surface using the edge of that face, thicken that surface, and then delete the body. I thought I had it right but I noticed that when I use it, if I select multiple faces, some thicken in different directions than I want them to. Also, when it regenerates, the parts will sometimes switch which direction they thickened. It doesn't seem very robust. Any suggestions on how to fix this? I currently want to use the feature to make square rectangular tubing slightly easier. Here's the code:
annotation { "Feature Type Name" : "Thin Extrude" }<br>export const thinExtrude = defineFeature(function(context is Context, id is Id, definition is map)<br> precondition<br> {<br> // Define the parameters of the feature type<br> annotation { "Name" : "Select Faces", "Filter" : EntityType.FACE}<br> definition.faces is Query;<br> <br> annotation { "Name" : "Thickness" }<br> isLength(definition.myThickness, LENGTH_BOUNDS);<br> <br> annotation { "Name" : "Length" }<br> isLength(definition.myLength, LENGTH_BOUNDS);<br> <br> <br> <br> }<br> {<br> // Define the function's action<br> opExtrude(context, id + "extrude1", {<br> "entities" : qEdgeAdjacent(definition.faces, EntityType.EDGE),<br> "direction" : evOwnerSketchPlane(context, {"entity" : definition.faces}).normal,<br> "endBound" : BoundingType.BLIND,<br> "endDepth" : definition.myLength<br> });<br> <br> opThicken(context, id + "thicken1", {<br> "entities" : qCreatedBy(id + "extrude1", EntityType.BODY),<br> "thickness1" : 0,<br> "thickness2" : definition.myThickness<br> });<br> <br> opDeleteBodies(context, id + "deleteBodies1", {<br> "entities" : qCreatedBy(id + "extrude1", EntityType.BODY)<br> });<br> <br><br> });
0
Comments
The good news is that when you extrude a solid, we do guarantee that all faces on that solid will have their normals pointing to the outside of that solid.
So the easiest fix I see is to opExtrude the face into a solid, query for all the non-cap faces of the solid (via qSubtraction and qCapEntity), thicken those faces, and delete the solid.