Query for specific SheetMetalDefinitionEntityType

MBartlett21
MBartlett21 Member, OS Professional, Developers Posts: 2,064 ✭✭✭✭✭
I would like to filter my edges (from qEverything) to be of a certain SheetMetalDefinitionEntityType, so i can pass them into sheetMetalCornerBreak without it erroring out.
Is there any way to do this?
mb - draftsman - also FS author: View FeatureScripts
IR for AS/NZS 1100
Tagged:

Best Answers

  • lana
    lana Onshape Employees Posts: 782 image
    Answer ✓
    We don't have a query filter for this. I'd go a different rout. 

    1. getSMDefinitionEntities(context, qEverything(EntityType.BODY), EntityType.BODY) would give you all the definition bodies.

    2. Collect their vertices

    3.  getSMCorrespondingInPart(context, qUnion(vertices), EntityType.EDGE)

    These edges can be sent to sheetMetalCornerBreak() 

    You still will be getting warnings for vertices next to bend edges, so it might be a good idea to filter out those in step 2.



  • MBartlett21
    MBartlett21 Member, OS Professional, Developers Posts: 2,064 ✭✭✭✭✭
    Answer ✓

Answers

  • lana
    lana Onshape Employees Posts: 782 image
    Answer ✓
    We don't have a query filter for this. I'd go a different rout. 

    1. getSMDefinitionEntities(context, qEverything(EntityType.BODY), EntityType.BODY) would give you all the definition bodies.

    2. Collect their vertices

    3.  getSMCorrespondingInPart(context, qUnion(vertices), EntityType.EDGE)

    These edges can be sent to sheetMetalCornerBreak() 

    You still will be getting warnings for vertices next to bend edges, so it might be a good idea to filter out those in step 2.



  • emagdalenaC2i
    emagdalenaC2i Member, Developers, Channel partner Posts: 867 ✭✭✭✭✭
    edited June 2018
    Maybe this example can help you

                annotation { "Name" : "Entities to fillet",
                            "Filter" : ((ActiveSheetMetal.NO && ((EntityType.EDGE && EdgeTopology.TWO_SIDED) || EntityType.FACE))
                                        || (EntityType.EDGE && SheetMetalDefinitionEntityType.VERTEX))
                                && ConstructionObject.NO && SketchObject.NO && ModifiableEntityOnly.YES,
                            "AdditionalBoxSelectFilter" : EntityType.EDGE }
                definition.entities is Query;
    Here is the full FS, so you can take a look to the complete code
    C2C - Full Round Fillet



    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • MBartlett21
    MBartlett21 Member, OS Professional, Developers Posts: 2,064 ✭✭✭✭✭
    Answer ✓
  • emagdalenaC2i
    emagdalenaC2i Member, Developers, Channel partner Posts: 867 ✭✭✭✭✭
    Ok, you already have my vote
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común