list, Appending/Sorting compare to master list

Discussion in 'AutoCAD' started by Nick Pirkl, Mar 30, 2005.

  1. Nick Pirkl

    Nick Pirkl Guest

    Bob at ECCAD, wrote a routine for me that grabs all blocks in a drawing per
    a list and inserts a different block per a second list with some attribute
    values from the intial blocks. This is used to create a legend. I am
    trying to figure out if I can append the final_list (each list item has 3
    parts) prior to inserting the blocks and then sort the list per a master
    block list. Something like:

    (defun c:listtest ()
    (setq list1 (list "l1" "l2" "l3" "l5" "l6" "l8" ))
    (setq list2 (list "l4a"))
    (setq master_list (list "l2" "l4" "l1" "l4a" "l3" "l5" "l8" "l6" "l7" ))
    (setq new_list (append list1 list2))

    ;sort new_list per master_list format and create final list
    )

    This is where I get lost. How do I sort the new_list per the master format
    "master_list" knowing that not all the items in the masterlist will be in
    the new_list? I was trying to use vl-sort but can't seem to get it to work.

    Nick
     
    Nick Pirkl, Mar 30, 2005
    #1
  2. Nick Pirkl

    Shane-W Guest

    Maybe something like

    (foreach item Master_list
    (if (member item new_list) ;if it is in new_list
    (setq Formated (append Formated Item)) ; add it in the order of the master list
    )
    )

    try that. its untested
     
    Shane-W, Mar 30, 2005
    #2
  3. Nick Pirkl

    Nick Pirkl Guest

    Shane, it returned the following error.

    The following error has occured
    bad argument type: listp "l2"
     
    Nick Pirkl, Mar 30, 2005
    #3
  4. Nick Pirkl

    Shane-W Guest

    (foreach item Master_list
    the Item needs to be a list for append to work, srry lil overlook :)
     
    Shane-W, Mar 30, 2005
    #4
  5. Nick Pirkl

    ECCAD Guest

    Nick,
    I'm on-line.
    Give me an E-Mail
    Bob
     
    ECCAD, Mar 30, 2005
    #5
  6. Nick Pirkl

    Nick Pirkl Guest

    Shane, thanks for the information, I will try it soon. I will also ask Bob
    for his help as well.
    Thanks again for responding!

    Nick
     
    Nick Pirkl, Mar 30, 2005
    #6
  7. Nick Pirkl

    ECCAD Guest

    Nick,
    Thanks for the E-Mail, see my response.
    I'm not sure what you are trying to accomplish.
    Best not to try to merge new list to final_lst, since
    that list has quantities, and attribute values to fill-in
    as it builds the legend.

    Bob
     
    ECCAD, Mar 30, 2005
    #7
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.