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.

Gotcha! Unexpected order of sketchRegions for concentric shapes

blackslateblackslate Member Posts: 16
To see a demo of this issue, please visit my Region Order Test document and double-click on the Region Order Test feature to open the dialog and show debug feedback.

You should see a set of concentric circles. The outermost circle is MAGENTA. However, it is the second region returned by...

    evaluateQuery(context, qSketchRegion(id + "sketch1"))

... and not the last, even though the circle sketches were drawn from the inside out. If you deselect the "Inside out?" button in the feature dialog, you will see that now it is the innermost circle that becomes MAGENTA.

It's not just a circle thing. It happens with rectangles too. You can test it.

Why is the last region that is sketched placed second in the array returned by evaluateQuery? Is this a bug or a feature that I can depend on?

Best Answer

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,688
    Answer ✓
    I would not rely on the order the regions were created. 
    Senior Director, Technical Services, EMEAI

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,688
    Answer ✓
    I would not rely on the order the regions were created. 
    Senior Director, Technical Services, EMEAI
  • blackslateblackslate Member Posts: 16
    In that case, is there a way for me to sort the regions by the diameter of the circles?
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,688
    If they are just circles then you could find the bounding box of each region (evBox3d) or if you just want the largest you could combine the query with qLargest
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.