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.

Allow selection of only flattened geometry

reuben_den_boer163reuben_den_boer163 Member, csevp Posts: 4 PRO
edited June 2023 in FeatureScript
I hacked together a Featurescript based on smPerforateBend but with simple holes instead of slots to better suit my application: Bend Holes

I also added an option to 'suppress' holes that are too close to a reference edge/vertex. The issue is this only behaves appropriately when selecting geometry in the flat pattern. 
Selecting a matching vertex in the folded 3D model vs. flat pattern yields very different coordinates (as can be expected?) which effectively breaks the function. 

Is there a query filter to allow only flattened geometry to be selected? Or is there an alternative solution?

@MBartlett21
Tagged:

Answers

  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭
    edited June 2023
    Tricky one. I see the filter to AllowFlattenedGeometry, and limit it to only ActiveSheetMetal, but I don't see one that limits it to ONLY flat geometry. If you can't find some way of doing it, you could use qSheetMetalFlatFilter in an Editing Logic Function to check selections and remove any that aren't on flat geometry, or you could just filter them out in the feature. That might look like.
    const faces = qSheetMetalFlatFilter(definition.selectedFaces, SMFlatType.YES);
    Evan Reese
  • reuben_den_boer163reuben_den_boer163 Member, csevp Posts: 4 PRO
    Thanks @Evan_Reese

    I tried the suggested qSheetMetalFlatFilter, which mostly works, but for some reason it only determines edges to be valid. All vertices are filtered out, which is undesirable as it is quite useful to select midpoints etc. 

    I also tried qCorrespondingInFlat but it didn't give the bahaviour I was hoping for.

    Alternatively I thought I could "manually" check whether the selected reference edge/vertex was on the same plane as the sketch being created, but I don't really understand how to do that. The debug visualiser seems to indicate all SM flat pattern sketches are created on the 'Top' plane (Z = 0) although the debug console is printing different coordinate values than that (for the circle centerpoints). 
Sign In or Register to comment.