How can I create a selection of adjacent edges using Scripting?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 470
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭

How can I create a selection of adjacent edges using Scripting?

Comments

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 470
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭

    You need to define an initial selection using the Geometrical ID, for example let us start with an edge ID 180 and then collect all the adjacent selections and create a named selection:

    # create a new empty selection
    tempSel = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
    # provide list of Ids of entities to select
    tempSel.Ids = [180]
    
    
    ExtAPI.SelectionManager.ClearSelection()
    ExtAPI.SelectionManager.AddSelection(tempSel)
    
    
    ExtAPI.Application.ScriptByName("jscript").ExecuteCommand("DS.Script.doGraphicsAdjacentSelect();")
    cs = ExtAPI.SelectionManager.CurrentSelection
    
    
    ns = Model.AddNamedSelection()
    ns.Location = cs
    ns.Name = "Loop_1"