What can we help you with today?

Log in and chat with a service agent now! Check out our help button in the bottom right corner!

[E3 library] How to highlight a device by coding

Comments

10 comments

  • Avatar
    Paul Bloom

    I think the Hihglight method is only available is the Option interface.  Dev.Jump might work for you.

    0
    Comment actions Permalink
  • Avatar
    jn dufay

    Sorry, I don't know what is dev.Jump, could you explain me, please ?

     

    0
    Comment actions Permalink
  • Avatar
    Paul Bloom

    Jump is a command which automatically opens the sheet which the particular device is located and highlights it.  Dev refers to the device object. The .Jump method, according the help, is the way to do that via scripting.

    I am not sure if I grasp the scope of what your trying to do but the highlight is not permanent; it is removed when you jump tp a new device.  (i.e. you can't highlight multiple devices at once)

    0
    Comment actions Permalink
  • Avatar
    jn dufay

    Thank you, I have try this solution with the following code (nId containing the device id)

    IDeviceInterface e3SelDevice = m_e3Job.CreateDeviceObject();
    e3SelDevice.SetId(nId);
    int nRet = e3SelDevice.Jump();

    But I can't see something on the scheme and the Jump function return 1.

    Do you think this value is ok or not ok ?

    0
    Comment actions Permalink
  • Avatar
    Paul Bloom

    Sorry, I read the help file on this again; it looks like the jump command, when used in a script, only works with E3.panel stuff.

    If you can get the coordinates of the devices symbol being used, probably though the SymbolInterface, you draw a rectangle or something around it.  Use Dev.GetSymbolIds.  That is may only other suggestion.

    0
    Comment actions Permalink
  • Avatar
    Tyler Smith

    If you want to use Jump function you can just use it like this:

    job.JumpToId(nId); // nId contains the device id

    0
    Comment actions Permalink
  • Avatar
    jn dufay

    Thank you !

    The job.JumpToId(nId); selects the device in the left panel, it's better. But, no highlight of the device.

    Do you know, how to do it ?

    0
    Comment actions Permalink
  • Avatar
    Tyler Smith

    To highlight device symbol on the sheet you would do it like this:

    dynamic symbol = job.CreateSymbolObject(); // ISymbolInterface instead of dynamic if you want autocomplete

    symbol.SetId(nId)  // nId contains the device Id

    var symId = symbol.GetID(); // need to get symbol Id

    job.JumpToId(symId);

    0
    Comment actions Permalink
  • Avatar
    jn dufay

    Thank you for your answer.
    Sorry, I worked on another subject, but, i will try your method.

    0
    Comment actions Permalink
  • Avatar
    jn dufay

    Hello,

     

    Thank you @Tyler Smith, with your solution I success to highlight a device.

    But, now my application users want to configure the color for the device highlighted.

    So, I search how to draw a rectangle  over the existing device.

    Do you have an idea ?

     

    I success to get X and Y coordinates of my device with the following source code:

    dynamic symbol = m_e3Job.CreateSymbolObject(); // ISymbolInterface instead of dynamic if you want autocomplete

    symbol.SetId(Convert.ToInt32(strDeviceId)); //the device Id

    var symId = symbol.GetID(); // need to get symbol Id

    symbol.GetSchemaLocation(ref refX, ref refY, ref refGrid);

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.