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.
How to query lines or edges where parts meet or intersect in FS?
Asher_Edwards
Member Posts: 6 EDU
So this is my first feature script because I haven't been able to find a tool that does what I want. I can do this with several normal extrudes, but I thought it would be a good exercise for me to get into feature script.
This is my plan:
I am almost done with my feature script, but I haven't been able to implement the last feature I want. I'm talking about the checkbox that is for "Creating walls all around," and when that is unchecked.
I need some help implementing this feature. It seems like it shouldn't be that hard, but I'm having troubles understanding more advanced queries. I'm looking to have the walls that intersect with the part stay, but the shell walls that reach beyond to be discarded and/or not be created at all. I'm not sure what queries or evaluations plus operations would get this result. I think I need to query the edge where the intermediate part meets the main part. Then that edge can be turned into a plane and thickened into a wall.
I also need help dealing with inner closed loops such as holes. It is a problem with the query that gets outside edges.
Finally, and this isn't that important, does anyone have a better name for this other than "Pocket Shell"?
Document:
https://cad.onshape.com/documents/c4fb7c3adbe5270e2b2877d9/v/7c1f6944972c7a99527c5563/e/d26768d160e39ceedb863443 0
Best Answers
-
Asher_Edwards Member Posts: 6 EDUSo I have solved the first part of my question. I have the feature script remove the sketch face through the main part and that creates the desired edges on the main part. I then query for all edges created by the removal extrude, owned by the main part, and on the plane that the selected face is on.Query://query for edges created by extrude 2 but owned by the original partvar edgesByExtrude is Query = qOwnedByBody(qCreatedBy(id + "extrude2", EntityType.EDGE), definition.booleanScope);//Find the topmost edges by getting the first plane that the faces selected are on.
edges = qCoincidesWithPlane(edgesByExtrude, evPlane(context, { "face" : evaluateQuery(context, definition.entities)[0] }));These edges are then feed into opRuledSurface, and then opThicken.
0 -
Asher_Edwards Member Posts: 6 EDUSo I have used qCapEntity, but that was only to help measure the extrude distance so I could remove material later.Currently the indent direction is based solely on the sketch normal, and a swap direction button. I bet it is difficult to have an indent that has its direction tangent to the plane. My feature script is currently working on any linear surface. Slight problems occasionally pop up, like extra faces on the geometry, or swapped normals on one of the many faces selected.Current state: https://cad.onshape.com/documents/c4fb7c3adbe5270e2b2877d9/v/a6ce64d1fe9f1097e98edc1b/e/d26768d160e39ceedb863443Note the extra faces in the middle. This is probably because I create a new body before merging into the part, and the faces overlap exactly. The replace face technique sounds interesting, I'll have to see if it eliminates the extra surfaces too.Items on my list to add in the future: Draft, scaling the end, transforming the end, adding manipulator handles, working with odd shaped surfaces (curves), fillet results, and adding a wrapper for boolean subtracting bodies with wall thickness. I'll get to them when I can, but I think I've almost reached the completion point for my original goal.It's exciting creating my first useful tool for myself and others!BTW I solved the inner loops problem by creating surfaces for all enclosed edge regions and removing that through the body.
1
Answers
edges = qCoincidesWithPlane(edgesByExtrude, evPlane(context, { "face" : evaluateQuery(context, definition.entities)[0] }));
Are you aware of qCapEntity()? Use it with opExtrude() (and some other functions) to get the start and/or end, but not the sides, or qNonCapEntity() for the sides. It can get edges or faces via the entityType field, but my first thought would be to get the faces and use Replace Face.
I recommend considering your flow using the standard Onshape featureset. I imagine that a Replace Face feature might be the best way to get the face flush in the way you want. Here's an example of one way that seems pretty good.