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.
FeatureScript smooth edges
MBartlett21
Member, OS Professional, Developers Posts: 2,054 ✭✭✭✭✭
in FeatureScript, I would like to make my own error message instead of the one generated by opFillet();.
I have written this function to fillet all the edges in a model except the ones that are specified.
https://cad.onshape.com/documents/b7252b2d8824c81fa19efffe/w/62f20e91708c14f2b8e1330f/e/47f23a63404badcd4649270d
I would like it to say that there are no edges that it can fillet if all the edges are smooth
I have written this function to fillet all the edges in a model except the ones that are specified.
https://cad.onshape.com/documents/b7252b2d8824c81fa19efffe/w/62f20e91708c14f2b8e1330f/e/47f23a63404badcd4649270d
I would like it to say that there are no edges that it can fillet if all the edges are smooth
0
Best Answers
-
paul_chastell Onshape Employees Posts: 126If I were to do this I would use evEdgeConvexity. Here's some psuedo-code (I skip passing contexts and other such stuff). Assuming you are doing
opFillet(edgeQuery)
I would do something like this:nonSmooth = false<br>edges = evaluateQuery(edgeQuery)<br>for each edge in edges:<br> if evEdgeConvexity(edge) != SMOOTH:<br> nonSmooth = true<br>if nonSmooth:<br> opFillet(edgeQuery)<br>else:<br> throw regenError("All edges are smooth")
Paul Chastell
TVP, Onshape R&D5 -
MBartlett21 Member, OS Professional, Developers Posts: 2,054 ✭✭✭✭✭@paul_chastell
I have redone the feature.annotation { "Feature Type Name" : "Fillet Everything" } export const filletEverything = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Fillet radius" } isLength(definition.filletRadius, BLEND_BOUNDS); annotation { "Name" : "Don't Fillet", "Filter" : EntityType.EDGE || EntityType.FACE } definition.noFillet is Query; } { //This is the edges that will be filleted const edgesToFillet = qSubtraction( qSubtraction( qBodyType( qEverything( EntityType.EDGE ), BodyType.SOLID ), qEntityFilter( definition.noFillet, EntityType.EDGE ) ), qEdgeAdjacent( qEntityFilter( definition.noFillet, EntityType.FACE ), EntityType.EDGE ) ); //This boolean tells the feature whether the edges are smooth or not var smooth is boolean = true; var edges = evaluateQuery( context, edgesToFillet ); //This for loop detects whether edges are smooth for (var edge in edges) { //This detects whether the selected edge is smooth or not if (evEdgeConvexity( context, { "edge" : edge }) != EdgeConvexityType.SMOOTH) { smooth = false; break; } } if (!smooth) { opFillet( context, id + "fillet1", { "entities" : edgesToFillet, "radius" : definition.filletRadius } ); } else { throw regenError("There are no sharp edges that can be filleted."); } });
1
Answers
TVP, Onshape R&D
Thanks!
IR for AS/NZS 1100
Here is what I was doing:
definition.noFillet is the faces and edges not to fillet.
IR for AS/NZS 1100
I have redone the feature.
IR for AS/NZS 1100
TVP, Onshape R&D