- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This occasionally bugs me like crazy, when I have to work on code having to do with layer colors.
It seems totally logical to me, that it might be handy to have an associative list of all possible layer colors.
As in ((1 . 1) (2 . 2) (3 . 3) ... (255 . 255))
But regardless if you feel that is useful, there is certainly no reason I shouldn't be able to create such a list, yes?
There's no reason the AutoLISP engine would not like that, the same is if I wanted a string variable of "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".
It's my variable, I can do with it what I want, right?
So why does this crash AutoCAD?
(setq i 1) (while (< i 256) (setq mylist (append mylist (list (cons i i)))) (setq i (1+ i)) )
Okay, to be fair, *that* doesn't crash AutoCAD. Only doing this afterwards:
!mylist
Or this:
(print mylist)
It's like some sort of AutoLISP Kryponite or something.
I don't suppose someone has a whimsical explanation for why this is?
Because it feels rather like saying Beetlejuice three times -- "Don't make an assoc list of the numbers 1 throuth 255!"
Oh, and sorry I didn't say this earlier -- be sure to save any important document before copying and pasting the above code.
Thanks for any assistance!
--J
Solved! Go to Solution.