leAttachFig

Discussion in 'Cadence' started by PolyPusher, Jun 17, 2009.

  1. PolyPusher

    PolyPusher Guest

    All,

    I have some code(didn't write it) that is bound to the keyboard and
    moves data around that is selected. The issue that I am seeing is if
    there is text, etc that is attached(leAttachFig) to another object and
    both are selected(object and text) then the text moves once with the
    object and again after that. So, is there away to "see" the attached
    data and not move it, just have it move with the object?

    Thank you in advance for any help,
    Eric




    procedure( MyyMoveRelativeDOWN(); use users y with a minus, zero
    out x with var ZeroX
    let((i)
    foreach(i geGetSelectedSet()
    if( geIsFigPartiallySelected(i) then ;( i ~>
    shape || i ~> path ) then
    leStretchShape( i list( ZeroX -Myy )
    geGetSelSetFigPoint( i ) t )
    else
    dbMoveFig( i nil list( list( ZeroX -
    Myy ) "R0" ) )
    )
    )
    )
    printf("You have moved objects down %L\n" Myy)
    )
     
    PolyPusher, Jun 17, 2009
    #1
  2. PolyPusher

    KB.How Guest

    Hi PolyPusher,

    Just additional info for you. You can find whether the object is
    attached or not by seeking for its property.

    objectId~>parent = nil ( not attached )
    objectId~>parent = dbxxxxx ( attached )

    You may use this info to do some checking before moving it.

    Regards,
    How
     
    KB.How, Jun 18, 2009
    #2
  3. PolyPusher

    PolyPusher Guest

    How,

    I was able to update the code to not move a "child" object by checking
    to see if there is a parent, now there is the case where if the user
    selects attached data (child object) the code reports that I moved
    something but didn't! Basically, the code as I have it moves only
    the parents and children ride for free ;)

    It seems I need to

    1.Move the parent if the parent and child is selected.

    2.When the parent is not selected but the child is, move the child.

    Remember, my original case was the code moved the attached("child
    data") and it got moved again when the parent moved.

    Any ideas?

    Thank you for your help, really appreciate it!
    Eric




    procedure( OneManGridMoveRelativeRIGHT()
    let((i)
    foreach(i geGetSelectedSet()
    if( geIsFigPartiallySelected(i) &&
    i~>parent==nil then
    leStretchShape( i list( OneManGridX
    ZeroY ) geGetSelSetFigPoint( i ) t )
    else
    if(i~>parent==nil
    dbMoveFig( i nil list( list
    ( OneManGridX ZeroY ) "R0" ) ))

    )
    )
    )
    printf("You have moved objects right %L\n" OneManGridX)
    )
     
    PolyPusher, Jun 18, 2009
    #3
  4. PolyPusher

    KB.How Guest

    Hi PolyPusher,

    When the object is attached to each other, when you move the parent,
    the attached child will move together with the parent as well. And
    when you move the child, the parent will remain not move. To avoid
    moving object (child) for 2 times, you need to store the parent db
    into a list and check each object before moving them.

    I did some modification for the code, when the object has parent and
    parent is selected, then move the parent ( child will move along with
    parent), if not, move only the child.

    * I was in hurry and doesn't not test the code yet, do testing before
    use k. Thanks

    procedure( OneManGridMoveRelativeRIGHT(@optional (cv geGetEditCellView
    ()))
    let((i moveItems)

    ;----------------------------------------------
    ; Process each selected object
    ;----------------------------------------------
    foreach(obj geGetSelectedSet()

    ;-----------------------------------------------------------------------
    ; Stretch the shape is object is partially selected
    ; and no attached to any parent
    ;-------------------------------------------------------------------------
          if( geIsFigPartiallySelected(obj) && obj~>parent then
            leStretchShape( obj list( OneManGridX ZeroY )
    geGetSelSetFigPoint( obj ) t )
    else
    ;-------------------------------------------------------------
    ; Process object when not in move item list
    ;-------------------------------------------------------------
    unless( member(obj moveItems)
    ;------------------------------------------------------------------------------------------------
    ; If attached to parent, check whether the parent
    is selected or not
    ; If selected, move the parent, and the child will
    move along as well
    ;--------------------------------------------------------------------------------------------------
    if( obj~>parent && geIsFigSelected(obj~>parent)
    then
    dbMoveFig( obj~>parent cv list( list
    ( OneManGridX ZeroY )  "R0" ) )
    moveItems = cons(obj~>parent moveItems)
    else
    dbMoveFig( obj cv list( list ( OneManGridX
    ZeroY ) "R0" ) )
    );if

    ;-----------------------------------------------------
    ; Store moved items into a list
    ;------------------------------------------------------
    moveItems = cons(obj moveItems)
    );unless
    );if
    );foreach

    printf("You have moved objects right %L\n" OneManGridX)
    );let
    );proc



    Regards,
    How
     
    KB.How, Jun 19, 2009
    #4
  5. PolyPusher

    PolyPusher Guest

    How,

    I was able to get some of the code working(I obviously am still a
    begineer).

    Now I have the following.

    If the child data is selected, it is moved.

    If parent is selected it moves and the attached moves with it

    BUT if the parent and the child is selected, they are both moved
    TWICE.

    I think that the if then else is not quit right, I may have goofed it
    up.

    I know I am asking alot, but could you help me get over this hurdle?

    Thank you,
    Eric




    procedure(OneManGridMoveRelativeRIGHT(@optional (cv geGetEditCellView
    ()))
    let((i moveItems)
    ;----------------------------------------------
    ; Process each selected object
    ;----------------------------------------------
    foreach(obj geGetSelectedSet()
    ;-----------------------------------------------------------------------
    ; Stretch the shape if object is partially selected
    ; and not attached to any parent
    ;-------------------------------------------------------------------------
    if(geIsFigPartiallySelected(obj) && obj~>parent==nil then
    leStretchShape(obj list(OneManGridX ZeroY)
    geGetSelSetFigPoint( obj ) t )
    else
    ;-------------------------------------------------------------
    ; Process object when not in move item list
    ;-------------------------------------------------------------
    unless(member(obj moveItems)
    ;--------------------------------------------------------------------------­----------------------
    ; If attached to parent, check whether the parent
    is selected or not
    ; If selected, move the parent, and the child will
    move along as well
    ;--------------------------------------------------------------------------­------------------------
    if( obj~>parent && geIsFigSelected(obj~>parent)
    then
    dbMoveFig(obj~>parent cv list(list(OneManGridX
    ZeroY) "R0" ))
    moveItems = cons(obj~>parent moveItems)
    else
    dbMoveFig(obj cv list(list(OneManGridX ZeroY)
    "R0" ))
    );if
    ;-----------------------------------------------------
    ; Store moved items into a list
    ;------------------------------------------------------
    moveItems = cons(obj moveItems)
    );unless
    );if
    );foreach
    printf("You have moved objects right %L\n" OneManGridX)
    );let
    );proc
     
    PolyPusher, Jun 19, 2009
    #5
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.
Similar Threads
Loading...