FS entity query

graham_lock
graham_lock Member Posts: 277 PRO
Hi all,

If I have a list of faces as a query and then use for ( var face in faces), how do ai pass face to a function that needs a query for its entities such as extrude?

Thank you.

Best Answer

  • Caden_Armstrong
    Caden_Armstrong Member Posts: 472 PRO
    Answer ✓
    Typically you do not need to iterate through a query.
    A query isnt really a list, its more of a set of instructions describing what to do an operation on.

    So for an extrude, your "faces" query can just be passed in directly, and the query is evaluated at runtime.

    If for some reason you do need to iterate through a query, you need to do an evaluateQuery on it first.

    If you havent already, check out the learning centre course on featurescript. Theres a section on queries.
    https://learn.onshape.com/courses/featurescript-fundamentals
    www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
    Experts in Onshape Automation - Custom Features and Integrated Applications

Answers

  • Caden_Armstrong
    Caden_Armstrong Member Posts: 472 PRO
    Answer ✓
    Typically you do not need to iterate through a query.
    A query isnt really a list, its more of a set of instructions describing what to do an operation on.

    So for an extrude, your "faces" query can just be passed in directly, and the query is evaluated at runtime.

    If for some reason you do need to iterate through a query, you need to do an evaluateQuery on it first.

    If you havent already, check out the learning centre course on featurescript. Theres a section on queries.
    https://learn.onshape.com/courses/featurescript-fundamentals
    www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
    Experts in Onshape Automation - Custom Features and Integrated Applications