TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Prickle Farmer on June 21, 2018, 04:14:52 AM

Title: Using variables in extended entity data
Post by: Prickle Farmer on June 21, 2018, 04:14:52 AM
The following line is supposed to have a value put in where hand is.

(setq newent '((-3 ("HIMS" (1000 . hand)))))

The value of newent end up as ((-3 ("HIMS" (1000 . HAND))))

I don't want HAND to be literal. I want to use a variable.  I know it has something to do with the quote but don't know how to resolve it. :x :x
Title: Re: Using variables in extended entity data
Post by: Coder on June 21, 2018, 04:57:19 AM
Read about LIST function and it may help.
Title: Re: Using variables in extended entity data
Post by: Marc'Antonio Alessi on June 21, 2018, 06:29:48 AM
Comando: (setq hand 99999)
99999

Comando: (setq newent '((-3 ("HIMS" (1000 . hand)))))
((-3 ("HIMS" (1000 . HAND))))

Comando: (setq newent (list (list -3 (list "HIMS" (cons 1000 hand)))))
((-3 ("HIMS" (1000 . 99999))))

Title: Re: Using variables in extended entity data
Post by: Prickle Farmer on June 21, 2018, 06:04:31 PM
Create the list rather than quote the list structure.  I get it. Thanks people.
Title: Re: Using variables in extended entity data
Post by: Lee Mac on June 21, 2018, 06:48:30 PM
This explanation (http://lee-mac.com/quote.html) may help with your understanding.
Title: Re: Using variables in extended entity data
Post by: Prickle Farmer on June 29, 2018, 02:11:33 AM
Thanks Lee. Awesome as always.