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.
qSketchRegion with filterInnerLoops
cory_isaacson
Member, Developers Posts: 43 PRO
I am using the filterInnerLoops setting, and with for example a circle sketch embedded in a rectangle it works fine.
I have another use case where I have a 2nd rectangle embedded in a larger one, but they share one side (to cut a rectangular notch out of the larger rectangle). The filterInnerLoops does not work in this case. Shouldn't this still work, as the smaller rectangle is fully contained in the larger one (they just share an edge). If this doesn't work then I will have to do an extrude/remove, which can work but it's much more code to do that.
I have another use case where I have a 2nd rectangle embedded in a larger one, but they share one side (to cut a rectangular notch out of the larger rectangle). The filterInnerLoops does not work in this case. Shouldn't this still work, as the smaller rectangle is fully contained in the larger one (they just share an edge). If this doesn't work then I will have to do an extrude/remove, which can work but it's much more code to do that.
0
Best Answers
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,215Jon's suggestion should work as long as the point is in the interior of the rectangle because the sketch faces are (small rectangle, large rectangle minus small rectangle), not two overlapping rectangles. So I'm guessing something else is going on...Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5
-
jon_sorrells Onshape Employees Posts: 51Like Ilya said, the faces created by the sketch shouldn't overlap. Here's an example of extruding just the U shape from two rectangles: https://cad.onshape.com/documents/eb11fc488b8158487bfc9689/w/de26b5b3ea24f6758a1c393c/e/b9fef0deedd5769e6e4ad00d
5 -
cory_isaacson Member, Developers Posts: 43 PROThanks, I found the problem. I was using a bounding point for the smaller rectangle. When I use one that is inside it, it works fine.
Clarification: Now I understand how this works. If I set a point in the larger rectangle, then it subtracts the smaller nested rectangle automatically. If I set a point that borders the smaller nested rectangle, then both are selected. If I set a point inside the smaller nested rectangle, then only the smaller one is selected. This would be a very good area to clarify in the documentation, with query examples to show how it works.
I am able to make it work now, so that is very good.
0
Answers
If not then I assume I need to make the smaller rectangle it's own sketch, query that using qSketchRegion and then extrude/remove that.
Or could I make 2 sketches on the same plane, use qSubtraction to get just the larger rectangle without the smaller one and extrude that? That would be almost as nice as filterInnerLoops.
The key takeaway is "Onshape will extrude the outermost loop AND any closed sketch loop that has an edge or vertex that touches (or crosses) the outermost loop."
Is the sketch created by your script? You could use skPolyline to create just the region that you want to extrude, and then extrude the sketch. If the sketch already exists in the part studio, you could pick just the face you want instead of selecting the entire sketch.
More info:
I did try some things, and the only thing I can do is to use qSubtraction to get the smaller rectangle by itself. If I try and use qSubtraction to get the larger rectangle without the smaller one it won't work, because the point in qContaintsPoint is in both the smaller and larger rectangle. This is too bad, because that means I cannot just get the larger rectangle less the smaller one, and opExtrude once. Seems like the only option is to opExtrude both rectangles separately and boolean with subtract.
It would be great to be able to do something like qSketchRegion with filterInnerLoops that works for this type of situation.
Clarification: Now I understand how this works. If I set a point in the larger rectangle, then it subtracts the smaller nested rectangle automatically. If I set a point that borders the smaller nested rectangle, then both are selected. If I set a point inside the smaller nested rectangle, then only the smaller one is selected. This would be a very good area to clarify in the documentation, with query examples to show how it works.
I am able to make it work now, so that is very good.