Moving elements between mark IDs

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi,

 

Is it possible to move elements present one mark ID to another without deleting the elements already present in the former mark ID ? I have elements in two diff mark IDs and I need to make use of both sets of elements by referring only one mark ID.

Answers

  • tinh
    tinh Altair Community Member
    edited November 2015

    Hi,

    I do not clearly understand your mind... :rolleyes:/emoticons/default_rolleyes.gif' title=':rolleyes:'>

     

    If you have some elems in mark 1, and you want to move it to mark 2, you can do:

    eval *createmark elems 2 [hm_getmark elems 1]

     

    mark 1 still stores those elems. so the two marks are equal

     

     

    But I think you are in this scene:

    - you have some elems in mark 1, and some others in mark 2

    - you want to do some tasks need mark 1 but want to remember elems in mark 1, too

    There are several ways without affect to mark 2

    1) you can store elems in mark 1 into a variable and restore them later, forexample

    set ElemList1 [hm_getmark elems 1]

    # do something using mark 1

    ...

    #restore mark 1:
    eval *createmark elems 1 $ElemList1

     

    2) store elems in mark 1 into usermark, then restore later:

    *marktousermark elems 1

    #  do something using mark 1

    ...

    #restore mark 1:

    *createmark elems 1 retrieve

     

    3) store elems in mark 1 into a table, then restore later:

    hm_marktotable elems 1 elem_table_name

    #  do something using mark 1

    ...

    #restore mark 1:

    hm_tabletomark elem_table_name 1

    hm_tableclear elem_table_name ; #free memory

     

    If you are manipulating on many mark, moving to table is good choice. It's fast, and you can do intersection, union, cut, remove same with mark

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2015

    Hi,

    I do not clearly understand your mind... :rolleyes:/emoticons/default_rolleyes.gif' title=':rolleyes:'>

     

    If you have some elems in mark 1, and you want to move it to mark 2, you can do:

    eval *createmark elems 2 [hm_getmark elems 1]

     

    mark 1 still stores those elems. so the two marks are equal

     

     

    But I think you are in this scene:

    - you have some elems in mark 1, and some others in mark 2

    - you want to do some tasks need mark 1 but want to remember elems in mark 1, too

    There are several ways without affect to mark 2

    1) you can store elems in mark 1 into a variable and restore them later, forexample

    set ElemList1 [hm_getmark elems 1]

    # do something using mark 1

    ...

    #restore mark 1:
    eval *createmark elems 1 $ElemList1

     

    2) store elems in mark 1 into usermark, then restore later:

    *marktousermark elems 1

    #  do something using mark 1

    ...

    #restore mark 1:

    *createmark elems 1 retrieve

     

    3) store elems in mark 1 into a table, then restore later:

    hm_marktotable elems 1 elem_table_name

    #  do something using mark 1

    ...

    #restore mark 1:

    hm_tabletomark elem_table_name 1

    hm_tableclear elem_table_name ; #free memory

     

    If you are manipulating on many mark, moving to table is good choice. It's fast, and you can do intersection, union, cut, remove same with mark

     

     

    Thanks for the reply. Sorry for the confussion. Here's what I want to do. Suppose I have some elems in mark ID 1 and some in mark ID 2. And now I want to move elems from mark ID 2 to ID 1, without deleting elems already present in mark ID 1, so that in mark ID 1 I have all the elems. Hope now its clear.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2015

    Thanks for the reply. Sorry for the confussion. Here's what I want to do. Suppose I have some elems in mark ID 1 and some in mark ID 2. And now I want to move elems from mark ID 2 to ID 1, without deleting elems already present in mark ID 1, so that in mark ID 1 I have all the elems. Hope now its clear.

     

    From point of view of TCL programming:

    • Put mark ID 1 into a list (called List-1)
    • Add items from mark ID 2 into List-1 (by using lappend)
    • Create mark ID 1 from List-1

    Maybe there's better (Hyperworks's) way to do that.

  • tinh
    tinh Altair Community Member
    edited November 2015

    Oh, so it is simple append it like above post or

    eval *appendmark elems 1 [hm_getmark elems 2]