SELECTING FROM THE FEATURE TREE

papawo
papawo Member, Developers Posts: 206 PRO
Is it possible to select a derived feature in the feature tree without user selecting it?
Tagged:

Best Answer

  • kevin_o_toole_1
    kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565 image
    Answer ✓
    Generally, FS features are not aware of feature history, only the geometry those features created, so the technical answer is no. Geometric queries and evaluations are much more robust to different user workflows, and much more transparent to the end user.

    If you don't intend for your feature to be used in a Part Studio with irrelevant geometry, you can simply query for all geometry that said feature will have created, e.g.
    const existingParts = qBodyType(qEverything(EntityType.BODY), BodyType.SOLID);
    const existingSurfaces = qBodyType(qConstructionFilter(qEverything(EntityType.BODY), ConstructionObject.NO), BodyType.SHEET); // Includes sketches but not default planes
    

Answers

  • kevin_o_toole_1
    kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565 image
    Answer ✓
    Generally, FS features are not aware of feature history, only the geometry those features created, so the technical answer is no. Geometric queries and evaluations are much more robust to different user workflows, and much more transparent to the end user.

    If you don't intend for your feature to be used in a Part Studio with irrelevant geometry, you can simply query for all geometry that said feature will have created, e.g.
    const existingParts = qBodyType(qEverything(EntityType.BODY), BodyType.SOLID);
    const existingSurfaces = qBodyType(qConstructionFilter(qEverything(EntityType.BODY), ConstructionObject.NO), BodyType.SHEET); // Includes sketches but not default planes
    

  • papawo
    papawo Member, Developers Posts: 206 PRO
    Thanks Kevin.