list, Appending/Sorting compare to master list

  • Thread starter Thread starter Nick Pirkl
  • Start date Start date
N

Nick Pirkl

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
 
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, it returned the following error.

The following error has occured
bad argument type: listp "l2"
 
(foreach item Master_list
(if (member item new_list) ;if it is in new_list
(setq Formated (append Formated (LIST Item))) ; <NEW HERE added (list )
)
)

the Item needs to be a list for append to work, srry lil overlook :)
 
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,
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
 
Back
Top