Enhance the Attach command

Discussion in 'Cadence' started by eyn, Jun 22, 2009.

  1. eyn

    eyn Guest

    I would like to create a custom Attach command that support batch
    attachment. The way how it will work is that I can select all the
    objects I would like to attach to a parent, and then once I initiate
    this SKILL routine, it will give me a dashline visual feedback much
    like the original attach command, and now I only need to select the
    parent object once and boom, all of my selection will now be attached
    to this object. The original attach command requires me to select
    parent for each of my selection, which can be quite a hassle.

    I was thinking of writing an enterfunction to simulate the behavior of
    the original Attach command, but I am not sure how I can use it to
    select the parent and also give the dashline visual feedback while the
    user move across the layout to find the parent. I believe Virtuoso's
    attach is using the "enterPoint" function to get the point and then
    find the parent located at that point, but I don't know how it can
    highlights each object selected while in enterFunction mode and also
    provide the dashline visual effect.

    Thank you in advance for any inputs and feedback on this. I have
    always wondered how visual feedback can be created in Virtuoso using
    SKILL. Hopefully someone here knows the answer.
     
    eyn, Jun 22, 2009
    #1
  2. eyn

    KB.How Guest

    Hi eyn,

    You can use function leAttachFig to attach a child_obj to parent_obj.
    The syntax is leAttachFig(child_id parent_id)
    I base on your request and wrote a simple skill script, hoping it
    helps you a little.


    procedure( HowAttach(@optional (cv geGetEditCellView()) (win
    hiGetCurrentWindow()))
    let((refPt parent children)

    ;-----------------------------------------------------
    ; Get selected object from cellview
    ;------------------------------------------------------
    if( (children = geGetSelSet()) then

    ;----------------------------------------------------------
    ; Request user to click on parent object
    ; when there are object(s) selected
    ;-----------------------------------------------------------
    refPt = enterPoint(?prompts list("Click on parent to
    attach"))

    when( refPt
    ;-------------------------------------------------------------
    ; Deselect all object and get parent object
    ;---------------------------------------------------------------
    geDeselectAllFig()
    geSingleSelectPoint(win nil refPt)
    parent = car(geGetSelSet())

    ;--------------------------------------------------------
    ; Attach all child object to parent
    ;--------------------------------------------------------
    foreach( child children
    leAttachFig(child parent)
    );foreach
    );when
    else
    warn("No object selected")
    );if
    );let
    );proc

    ;----------------------------------
    ; Set bindkey for attach
    ;-----------------------------------
    hiSetBindKey("Layout" "Shift <Key> 1 " "HowAttach()")


    How to use:
    1. Load the script to CIW
    2. Open a cellview in active mode
    3. Select child's object from the cellview
    4. Hit bindkey 'Shift 1' and then point to parent object
    5. The script will then attach the select child object to the parent


    Regards,
    How
     
    KB.How, Jun 23, 2009
    #2
  3. eyn

    eyn Guest

    Thank you so much How, I tried out your code and it works just great!

    Still, I am wondering if there's a way to produce that dashline visual
    aid effect that is done by attach command when the command starts. And
    instead of guessing which object is located at the refPt with
    geGetSelSet(), it will be great if the enterfunction will highlight
    the object that will be selected before the user click on it.
     
    eyn, Jun 26, 2009
    #3
  4. eyn

    KB.How Guest

    Hi eyn,

    The visual dashline is supported by interactive function leHiAttach
    and only applicable in attaching object one by one at a time. You can
    change the leAttachFig funcion to leHiAttach and try it, and believe
    this will not fullfil your initial requirement.
    How a try ...

    How
     
    KB.How, Jun 29, 2009
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.