What can we help you with today?

Log in and chat with an Applications Engineer now! Check out our chat button in the bottom right corner!

What can we help you with today?

Log in and chat with an Applications Engineer now! Check out our chat button in the bottom right corner!

Change wire names in a bundle based on color and signal name - VBS

Comments

2 comments

  • Christoph Greindl
    Christoph Greindl

    Hello,

    With Pin.CreateWire the return value is the new PinID (=Id of new wire), then you can use .SetName

    If you already hav a  cable overbraid with wires, just loop through the wires in the overbraid.

    I made a quick sample:

    newDevId = Dev.CreateOverbraid("-W100","","","","")
    Dev.SetId newDevId
    newWireId = Pin.CreateWire("","","",newDevId,0,0)
    Pin.SetId newWireId
    Pin.SetName "newWireName"

    Was this Helpful?

    1
  • Brandon Folkers
    Brandon Folkers

    Hey Christoph,

    Thank you for the help! I've been able to learn and get a lot farther thanks to your sample code.

    I've gotten to the point with my loop below where its asks for a user input of which overbraid to read from and outputs the current core id, Wire name, Signal Name, and Wire color. 

    Next I need to figure out a good way to group my wires to rename them based off the color, signal name, and then letter increment multiples of a wire.(a to b to c to etc)

    For i=1 To cableCount
      cable.SetId cabids(i)
          If cable.IsOverbraid AND cable.GetName = overbraidName Then
                  e3.PutInfo 0, "Overbraid " & cable.GetName
                  coreCount = cable.GetCoreIds(coreIds)

                    'Always start the loops for wires at 1 for E3

                  For j = 1 To coreCount
                      core.Setid coreIds(j)
                        e3.PutInfo 0, "Core with id: " & core.GetId() 'Grabs the Id of the core so that it can be looked up and data read from it

                      coreNames = core.GetName ' coreNames returns the device designation as a string. If the device is not a standard device, connector or cable (unassigned symbol), the name will be enclosed in braces. If this is the case, the symbol name will be used for the device name
                        e3.PutInfo 0, "Wire Name: " & coreNames ' Gets the wire name of the wireId from the line before this

                        coreSignalNames = core.GetSignalName ' coreSignalNames returns signal name
                      e3.PutInfo 0, "Wire Signal Name: " & coreSignalNames ' Gets the wire name of the wireId from the line before this

                      coreColors = core.GetColourDescription ' coreColors returns the plain text name from the wire color table. Following values are returned in error case
                      e3.PutInfo 0, "Wire Color: " & coreColors ' Gets the wire name of the wireId from the line before this
                      e3.PutInfo 0, "" ' Make a new line to read groups easier    

                        Next

            'ElseIf cable.IsOverbraid AND cable.GetName <> overbraidName Then           

            End If       

    Next

    Was this Helpful?

    0

Please sign in to leave a comment.