Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Querying and extruding rectangles

jeff_day734jeff_day734 Member Posts: 9
edited August 23 in FeatureScript

FeatureScript noob here: I've spent hours trying to understand how to query and extrude faces on a sketch. I have a set of rectangles inside a larger rectangle, and I want to find and extrude the inner rectangles and outer rectangle to different heights. I have no problem getting the outer rectangle using this: var entities = qSketchRegion(id + "sketch", true);

But I can't figure out how to query the inner rectangles. Or, to be more precise, when I try to operate on what I believe is a valid query, I get empty array errors.

Here's the sketch in question. It's named "sketch1." Any tips on how to find and extrude all the faces?

Comments

  • Caden_ArmstrongCaden_Armstrong Member Posts: 195 PRO
    edited August 23

    You can use the filter inner loops to get the whole region and the outer area and subtract to get the inner area.
    var outerRegion = qSketchRegion(id +"sketch1", true); // extrude this at one height
    var wholeRegion = qSketchRegion(id +"sketch1", false); // used to help get the inner region
    var innerRegion = qSubtraction(wholeRegion,outerRegion); // extrude this at the other height

    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • jeff_day734jeff_day734 Member Posts: 9

    This worked. Thanks @Caden_Armstrong. Gives me a better sense on how to use and perform set operations on queries.

Sign In or Register to comment.