E³ scripting select symbol method

I'm looking for a method that selects a symbol by its id. I want to select a symbol, run a script, and have all other symbols of that SymbolTypeName selected for editing. I assume a selection interface would make most sense to be at the app or job level but I haven't found any such interface. Ideas?



  • Job.GetSelectedSymbolIds

    Comment actions Permalink
  • Paul,

    Thanks for your quick reply. Job.GetSelectedSymbolIds is perfect for returning the symbols that the user has already selected, but is only part of what I need.

    What I'm trying to do is batch select symbols based on some criteria. For example, all symbols with Sym.GetSymbolTypeName = SPLICE¶SMALL.

    Here is what I'm after:

    1. Select a symbol,

    2. run my script, which goes something like this

    <cnt = Job.GetSelectedSymbolIds(symids)

    <If cnt = 1 Then

    <sym.SetId symids(0)

    <temp = sym.GetSymbolTypeName 'MY SELECTED SYMBOL'S NAME

    <cnt = sht.GetSymbolIds (symids) 'GET THE REST OF THE SYMBOLS ON THE SHEET

    <For i = 1 To cnt

    <sym.SetId symids(i)

    <If sym.GetSymbolTypeName = temp Then sym.Select (E³ SELECTS THIS SYMBOL)


    <End If

    3. Observe that all other symbols on this sheet, that are like the one I originally selected, are also now selected


    Comment actions Permalink
  • I see; no, I don't think there is any multi-select method.  Maybe you can find someway to simulate a Shift + LMB click on each matching symbol or maybe temporary change the color of the symbols..

    Comment actions Permalink
  • I don't think there's a method that would allow you to select all symbols at once.

    Once you have the IDs of the symbols, then run your batch process.


    Option Explicit
    Dim e3  : Set e3 = CreateObject("CT.Application")
    Dim job : Set job = e3.CreateJobObject
    Dim sht : Set sht = Job.CreateSheetObject
    Dim pin : Set pin = Job.CreatePinObject
    Dim sym : Set sym = Job.CreateSymbolObject

    sht.SetId job.GetActiveSheetId

    Dim intSymCount, sids
    intSymCount = job.GetSelectedSymbolIds(sids)
    if intSymCount = 1 then
        sym.SetId sids(1)
        Dim symTypeName : symTypeName = sym.GetSymbolTypeName()
        e3.PutMessage symTypeName
        Dim symIdsOnSheet : Set symIdsOnSheet = GetSymbolIdsOnSheetByTypeName(symTypeName, sht.GetId())
        e3.PutMessage "found symbol count: " & symIdsOnSheet.Count
        ' Run batch routine on symbols
    Dim id
        For Each id in symIdsOnSheet
            sym.SetId id
            e3.PutMessage sym.GetName(), id
    End If

    Function GetSymbolIdsOnSheetByTypeName(ByVal symTypeName, ByVal curSheetId)
        Dim list : Set list = CreateObject("System.Collections.ArrayList")
        Dim K, intProjSymCount, prjSymIds
        intProjSymCount = Job.GetSymbolIds(prjSymIds, symTypeName)
        For K = 1 to intProjSymCount
            sym.SetId prjSymIds(K)
            sht.SetId prjSymIds(K)
            If sht.GetId() = curSheetId Then
                list.Add sym.GetId()
            End If
        Set GetSymbolIdsOnSheetByTypeName = list
    End Function
    Comment actions Permalink
  • Paul, Bob,

    I'd suspected there isn't an interface. It's too bad; I find E³ selection tools to be pretty lacking when compared with other CAD systems. Was hoping I could build some filtering functionality...

    Anyhow, thanks for your inputs. Cheers

    Comment actions Permalink
  • I hear you. I've programmed with both Autocad and Inventor.

    What type of action are you attempting by selecting all symbols at once?

    Comment actions Permalink
  •  Could be really helpful when having to toggle attribute text visibility, symbol scaling, switching symbol characteristic, etc. Anything that can be edited from the symbol properties dialog box could benefit from this

    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post