• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Visual LISP, AutoLISP and General Customization

    Reply
    Contributor
    aesh
    Posts: 18
    Registered: ‎02-03-2012

    Re: radio cluster to select next dialog box

    02-24-2012 07:18 PM in reply to: scot-65

    Ahh, I think the light is starting to come on :smileytongue:

    I do have another question though...

     

    Is it possible to have a base list and pull pieces from it to create a popup list?

     

    i.e.  (setq list  '("1" "2" "3" "4" "5"......"20"))

     

    and then later

     

    (start_list "lst1")

      (cond

        if a add "1" "2" "3"

        if b add "5" "6" "9" "10" ?

     

    can't figure out if there is a way to combine the mapcar and nth functions or if i need something else all together. 

    Please use plain text.
    *Pro
    scot-65
    Posts: 1,927
    Registered: ‎12-11-2003

    Re: radio cluster to select next dialog box

    02-27-2012 03:21 PM in reply to: aesh

    aesh wrote:

    Ahh, I think the light is starting to come on :smileytongue:

    I do have another question though...

     

    Is it possible to have a base list and pull pieces from it to create a popup list?

     

    i.e.  (setq list  '("1" "2" "3" "4" "5"......"20"))

     

    and then later

     

    (start_list "lst1")

      (cond

        if a add "1" "2" "3"

        if b add "5" "6" "9" "10" ?

     

    can't figure out if there is a way to combine the mapcar and nth functions or if i need something else all together. 


    You would want to step-through the "master list" (using nth or FOREACH) to create sub-lists.

    Use CONS to create the sub-lists. Study up on FOREACH and CONS.

    The CONS does have a small drawback - the elements of the list are reversed.

    I'm sure you do not want the popup to display this way?

     

    First create the individual variable(s), then mapcar 'add_list the variable.

     

    (setq a nil b nil) ;just to show you that a and b can be nil to start.

    (foreach x list

     (if [whatever] (cons x a))

     (if [whatever] (cons x b))

    );foreach

    (reverse a)

    (reverse b)

     

    Hope this helps.

     

    Please use plain text.