Automatic Variable Name in AutoLISP?

TEAC

Usenet Archive
Joined
Aug 4, 2003
Messages
1
Reaction score
0
Is there a way to have AutoLISP name variables automatically?

ex: If a user is selecting lines, but you do not know how many lines they will select, is there a way to start with (setq line_1 (entsel)) , and continue to line_2, line_3, etc.?

Can anybody think of a better way to do this???
Thanks,
Michelle
 
Yes, it can be done; but doing so can be quite cumbersome. If I were dealing with an unknown number of objects, I'd be more likely to deal with them as a selection set or a list, rather than individual variables.

(setq ss (ssget "\nSelect objects: ")
n (sslength ss)
);;setq
(alert (strcat "You have selected " (itoa n) " objects.")) (while (> n 0) (setq n (1- n) obj (ssname ss n) );;setq (<<process 'obj' here>>)
);;while

___

TEAC said:
Is there a way to have AutoLISP name variables automatically? ex: If a user is selecting lines, but you do not know how many lines they
will select, is there a way to start with (setq line_1 (entsel)) , and continue to line_2, line_3, etc.?
 
Michelle,

I would have to agree with Paul. Depending on what you're trying to do, lists would likely be a much better way to go.

What is it that you're trying to accomplish?
 
without questioning whether or not you *should* do it (as the previous two answers) for *how* to do it see like named post above from nagesh

TEAC said:
Is there a way to have AutoLISP name variables automatically? ex: If a user is selecting lines, but you do not know how many lines they
will select, is there a way to start with (setq line_1 (entsel)) , and continue to line_2, line_3, etc.?
 
Back
Top