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.

Query filter MeshGeometry.YES not working

EvanReeseEvanReese Member, Mentor Posts: 2,868 PRO

I want to filter a query param for only mesh vertices. Here's what I have:

annotation { "Name" : "Mesh verticies", "Filter" : EntityType.VERTEX && AllowMeshGeometry.YES && MeshGeometry.YES } definition.points is Query;

But it's highlighting MeshGeometry.YES with the message "Unhandled enum type MeshGeometry". I get this even if it's the only filter enum I use.

Looking a the documentation for UI queries here it seems like it should work since MeshGeometry is on the list. What am I missing?

Evan Reese
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com

Best Answers

  • MichaelPascoeMichaelPascoe Member Posts: 2,817 PRO
    edited February 2025 Answer ✓

    You could try this:

    annotation { "Name" : "Bodies", "Filter" : EntityType.VERTEX && AllowMeshGeometry.YES && !BodyType.POINT }
    definition.entity is Query;
    

    Oh wait, never mind. I was just checking against the origin..

    Looks like it isn't supported by annotations yet, or maybe unhandled? All of the other ones specify that they can be used in annotations.
    https://cad.onshape.com/documents/12312312345abcabcabcdeff/v/6d1c0e255e851eaf6831cf72/e/9fde5dffaf8d4e4c99aaa22c

    Perhaps it's only to be used with:

    qMeshGeometryFilter(queryToFilter, MeshGeometry.YES)
    
    image.png

    You could always use some edit logic to get rid of non mesh points as they are clicked.


    RENDERCAD
    rendercad.ai - Photorealistic product rendering.

    ▚▞▚▞▚▞▚▞▚
    ________________________________________________________________________
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,255 image
    Answer ✓

    I'll fix the doc — thanks for pointing out.

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc

Answers

  • MichaelPascoeMichaelPascoe Member Posts: 2,817 PRO
    edited February 2025 Answer ✓

    You could try this:

    annotation { "Name" : "Bodies", "Filter" : EntityType.VERTEX && AllowMeshGeometry.YES && !BodyType.POINT }
    definition.entity is Query;
    

    Oh wait, never mind. I was just checking against the origin..

    Looks like it isn't supported by annotations yet, or maybe unhandled? All of the other ones specify that they can be used in annotations.
    https://cad.onshape.com/documents/12312312345abcabcabcdeff/v/6d1c0e255e851eaf6831cf72/e/9fde5dffaf8d4e4c99aaa22c

    Perhaps it's only to be used with:

    qMeshGeometryFilter(queryToFilter, MeshGeometry.YES)
    
    image.png

    You could always use some edit logic to get rid of non mesh points as they are clicked.


    RENDERCAD
    rendercad.ai - Photorealistic product rendering.

    ▚▞▚▞▚▞▚▞▚
    ________________________________________________________________________
  • EvanReeseEvanReese Member, Mentor Posts: 2,868 PRO

    Thanks Michael. I'm not sure what "unhandled" actually means. I considered the Editing Logic solution, but I hoped to avoid it. I'll probably just leave it as is for now.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • EvanReeseEvanReese Member, Mentor Posts: 2,868 PRO

    @ilya_baran I hope I'm not bothering you with unimportant things, but the list of possible filters for Query Params in the documentation here does include MeshGeometry so at some point it should be made to work, or removed from the list.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,255 image
    Answer ✓

    I'll fix the doc — thanks for pointing out.

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • EvanReeseEvanReese Member, Mentor Posts: 2,868 PRO

    Just following up here for posterity. After looking at the Constrained Surface code in the standard library, it seems like we can filter out non-mesh geometry with !AllowMeshGeometry.NO which is what I was going for.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • MichaelPascoeMichaelPascoe Member Posts: 2,817 PRO

    Shouldn't !AllowMeshGeometry.NO be the same thing as AllowMeshGeometry.YES or am I missing something?


    RENDERCAD
    rendercad.ai - Photorealistic product rendering.

    ▚▞▚▞▚▞▚▞▚
    ________________________________________________________________________
  • EvanReeseEvanReese Member, Mentor Posts: 2,868 PRO
    edited March 2025

    It feels like a double negative, but it seems like AllowMeshGeometry.YES will is "all bodies, including mesh ones" and AllowMeshGeometry.NO is "all bodies excluding mesh ones" while !AllowMeshGeometry.NO seems to be "only mesh bodies". There's a venn diagram in there somewhere.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • MichaelPascoeMichaelPascoe Member Posts: 2,817 PRO
    edited March 2025

    I guess this means that AllowMeshGeometry.NO isn't the opposite of AllowMeshGeometry.YES… 😩


    RENDERCAD
    rendercad.ai - Photorealistic product rendering.

    ▚▞▚▞▚▞▚▞▚
    ________________________________________________________________________
Sign In or Register to comment.