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!

Get Device Information From Attribute Text Template C#

Comments

3 comments

  • bob larranaga
    bob larranaga

     

    Pass the id of the symbol into the Device.SetId() method.

    Example:

    foreach(int id in (symIds as object[]).Skip(1)
    {
    int symId = sym.SetId(id);
    int devId = dev.SetId(id);
    e3.PutMessage($"Symbol: {sym.GetName()}", symId);
    e3.PutMessage($"Device: {dev.GetName()}", devId);
    }

    Was this Helpful?

    1
  • Joshua Porch
    Joshua Porch

    Bob,

    I don't know how much money you make, but you need more of it!

    Works perfectly!

    Thank you, sir!

    Was this Helpful?

    1
  • bob larranaga
    bob larranaga

    I don't know how much money you make, but you need more of it!

    noted. :)

    fyi... there are other objects that behave in this manner. for example, you could do the same to find the parent cable of a conductor

    foreach(int id in (corIds as object[]).Skip(1)
    {
    int corId = cor.SetId(id);
    int cabId = cab.SetId(id);
    e3.PutMessage($"Core Name: {cor.GetName()}", corId);
    e3.PutMessage($"Cable Name: {cab.GetName()}", cabId);
    }

    the information comes from examining the buried scripts in the COM Help documentation.  the section called "Internal Identifier Handling" shows relationships between objects. you can get an idea of the parent/child relations between objects where you can use the SetId() to find the parent of an object. unfortunately some items don't support this... i don't recall specifics.

    sometimes you have to just have to hack at it.

    or ask questions.

    Was this Helpful?

    0

Please sign in to leave a comment.