Results 1 to 4 of 4

Thread: LISP CHALLENGE - symbols created within routine

  1. #1
    AUGI Addict bowlingbrad's Avatar
    Join Date
    2003-11
    Location
    Chicago
    Posts
    1,233
    Login to Give a bone
    0

    Default LISP CHALLENGE - symbols created within routine

    I cannot figure this one out so I thought I would post a challenge.

    I have several lists created in a routine:
    (setq layers-PLAN (list .....))
    (setq layers-RCPL (list .....))
    (setq layers-ELEV (list ...))
    (setq layers-SECT (list ...))

    I am trying to return these lists when a user clicks a radio button with key values as follows: (setq user_input $key)
    PLAN
    RCPL
    ELEV
    SECT

    I know how to use the set command to SET an expression to a symbol.
    (set (read (strcat "layers-" $key)) (list ....))

    What I do not know is how to return a value by building a symbol from user input.
    (setq user_input_layers (read (strcat "layers-" $key))) returns LAYERS-PLAN and not the predefined list.

    Any help would be appreciated. If you help out, I'll put in a good word to Santa.

  2. #2
    I could stop if I wanted to
    Join Date
    2007-08
    Posts
    202
    Login to Give a bone
    0

    Default Re: LISP CHALLENGE - symbols created within routine

    Hi,

    Not sure having understood the request cause of my poor English, but may be with eval function ?

    Code:
    (setq user_input_layers (eval (read (strcat "layers-" $key))))

  3. #3
    Active Member
    Join Date
    2002-12
    Posts
    77
    Login to Give a bone
    0

    Default Re: LISP CHALLENGE - symbols created within routine

    how are the layers themselves named? it may be easier to just make one big list and (vl-sort) them to get what you need?

  4. #4
    AUGI Addict bowlingbrad's Avatar
    Join Date
    2003-11
    Location
    Chicago
    Posts
    1,233
    Login to Give a bone
    0

    Default Re: LISP CHALLENGE - symbols created within routine

    Quote Originally Posted by 'gile' View Post
    Hi,

    Not sure having understood the request cause of my poor English, but may be with eval function ?

    Code:
    (setq user_input_layers (eval (read (strcat "layers-" $key))))
    WOO HOO!!

    I think you did it! I just had the eval function in the wrong place during my tests!!!

    Thanks again. (Santa will be notified)

Similar Threads

  1. Anyone up for a LISP challenge?
    By Rroger_D in forum AutoLISP
    Replies: 3
    Last Post: 2015-08-06, 02:37 AM
  2. Select the last N entities created in a lisp routine.
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 7
    Last Post: 2015-06-23, 04:36 PM
  3. Help with a lisp routine to add a 12" line to this routine
    By Orbytal.edge341183 in forum AutoLISP
    Replies: 3
    Last Post: 2012-11-14, 10:33 PM
  4. LISP CHALLENGE: Explode Polyline and Keep Width
    By bowlingbrad in forum AutoCAD Customization
    Replies: 14
    Last Post: 2009-08-29, 05:52 PM
  5. LISP Challenge - draw a specialized leader
    By fletch97 in forum AutoLISP
    Replies: 5
    Last Post: 2006-02-28, 08:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •