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.

Custom Feature: Query Variable+

13»

Comments

  • armandoRRarmandoRR Member, pcbaevp Posts: 38 PRO
    CleanShot 2026-03-25 at 16.17.13.png

    @Derek_Van_Allen_BD I might just be missing it, but one of my favorite features of Evan's Selection Fillet was this Body>Direction paired with Created By>Feature. Made it extremely easy to make DFM features. Is there a way to do the same Direction (edges normal to a plane, or edge, or mate connector) in QV+?

  • armandoRRarmandoRR Member, pcbaevp Posts: 38 PRO

    The problem I have with this solution is it requires an explicit edge, which is more fragile than using a plane. I could define 3 sketches at the very beginning of my docs with X, Y, Z lines to serve as direction seeds, but would rather just select a default plane that already exists.

  • Derek_Van_Allen_BDDerek_Van_Allen_BD Member Posts: 984 PRO

    I see, in that case you'll want to use the parallelish option in QV+ and feed it another QV of CreatedBy edges as an input. Many of the variables in QV+ act as a filtering operation instead of loading everything in the model as a union or intersection step since I work with a lot of part studios with huge amounts of data. Keeps things lean performance-wise at the small cost of needing to set multiple QVs as a chain.

  • armandoRRarmandoRR Member, pcbaevp Posts: 38 PRO

    Great explanation as to why it doesn't load everything in. That was going to be my next ask since I didn't want to stack queries, but I see that's design for performance reasons. Many thanks! I'll use multiple QVs from now on.

    Now I wish we could have a higher level FS that allows a user to bundle multiple FS. Like how Grasshopper has Clusters.

  • Konst_ShKonst_Sh Member Posts: 156 PRO
    edited April 14

    Hi Derek, might have a request for this feature - could you please expose an attribute query for named ones at least, having attribute pattern expression would also be nice to have, even though it might not work for non-primitive values in map pattern

  • Derek_Van_Allen_BDDerek_Van_Allen_BD Member Posts: 984 PRO

    Attribute queries are starting to become much more relevant for my workflows so I think that's a good next addition. The way I'd like to implement them is to have some kind of quick selection list for the common ones that show up in the native Onshape environment to make them user friendly to navigate, but also the ability to specify custom ones to look for. It would be really nice if I could get a list to auto populate with all attributes found in the studio but I'm not sure that's possible.

  • Konst_ShKonst_Sh Member Posts: 156 PRO

    We can have a custom table for attributes and especially query variables available in the context - its weird that there no native table for QV's and discovering those created by custom features isn't as easy

  • Konst_ShKonst_Sh Member Posts: 156 PRO

    For some reason I thought we could easily reproduce "query filter chain" pattern with Query variable feature, but it seem that "Additional queries" only allows logical boolean operations. I suggest to add a "Filter" variant of behavior where the next query would operate on result of previously evaluated query:

    изображение.png

    so that if first query is "CreatedBy" type and the next is Filter/Positional/ClosestTo the resulting would be equivalient to qCreatedBy() → qClosestTo()

  • eric_pestyeric_pesty Member, pcbaevp Posts: 2,757 PRO

    @Derek_Van_Allen_BD ,

    I think I found a "missing thing":
    I'm trying to get bodies out of a list of selected faces, so the reverse of "owned by"

    I guess that would be qOwnerBody ?

    I don't see a way to do it currently… I tried intersecting all bodies and "adjacent" to the faces but that would only filter faces belonging to bodies (I think…). Anything else I can try?

  • Konst_ShKonst_Sh Member Posts: 156 PRO
    edited April 30

    So I wanted to try one type of query that was missing in your feature, and had to copy it. I ended up adding qNthElement, attribute query, and filtering behaviour (though last is not tested for every query). Feel free to "merge" this changes into your feature, so that we will have a single source of truth:
    https://cad.onshape.com/documents/6b47b3228b86f35c7bb005e9/w/c18850024ba225c3f9585a04/e/cb8362d1a335ce881d0a8ddb

    изображение.png изображение.png
  • Derek_Van_Allen_BDDerek_Van_Allen_BD Member Posts: 984 PRO

    Thanks for doing a bunch of the hard work for me, I'll add it to the list of updates to make when I get back to the states. I'll probably expand on the attribute selection to include quick drop menus for the common types of attribute available in the standard library so I can be lazy and forget about syntax

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.