Depends what you are doing with the layer names - sending names to a file - freezing/thawing layers - changing layer properties? Maybe your lisp code could be written differently to make it easier to adapt - how are you doing it now?
Registered forum members do not see this ad.
I am a student in high school working on a final project. This project is designing a hotel with 18 floors. With this many layers it is hard to organize my work. But I came up with a layering scheme that is very descriptive and would allow me to filter by floor and type.
Currently, I am using Autolisp to start the -layer command and then using wildcard characters to get all of the layer names of one floor. This is very slow and hard to expand. I was wondering if this can be done with entget and entmod or if it would be better to use vba. Any help and pointers to where I should look for this information would be greatly appreciated.
Brandon




Depends what you are doing with the layer names - sending names to a file - freezing/thawing layers - changing layer properties? Maybe your lisp code could be written differently to make it easier to adapt - how are you doing it now?
Another one of the problems with my method is that it takes up a command for everything layer command. This is especially problematic when I need to undo something because I have to go back a ton of steps. Is there any way that I could change the visibility of the layers without making them actual commands so as to allow me to change something an object, turn on some more layers, and then go back and undo the change without affecting layer status.
I am not sending layer names to a file but I would be willing to do it that way if it would work. I am just concerned with freezing/thawing layers or possibly turning layers off.
Below is some example code:
;--------------------Level One Add---------------------------
(defun oneadd ()
(setq one 1)
(if (= cen 1) (command "-layer" "t" "*Center Sphere.1.*" ""))
(if (= big 1) (command "-layer" "t" "*Big Sphere.1.*" ""))
(if (= out 1) (command "-layer" "t" "*Outer Walkway.1.*" ""))
(if (= sma 1) (command "-layer" "t" "*Small Sphere.1.*" ""))
(if (= inn 1) (command "-layer" "t" "*Inner Walkway.1.*" ""))
)
This basically turns the first floor on. It also cross checks to make sure that the other section of the building is turned on.
;---------------------Center Sphere Add--------------------------
(defun cenadd ()
(setq cen 1)
(if (= one 1) (command "-layer" "t" "*Center Sphere.1.*" ""))
(if (= two 1) (command "-layer" "t" "*Center Sphere.2.*" ""))
(if (= three 1) (command "-layer" "t" "*Center Sphere.3.*" ""))
(if (= four 1) (command "-layer" "t" "*Center Sphere.4.*" ""))
(if (= five 1) (command "-layer" "t" "*Center Sphere.5.*" ""))
(if (= six 1) (command "-layer" "t" "*Center Sphere.6.*" ""))
(if (= seven 1) (command "-layer" "t" "*Center Sphere.7.*" ""))
(if (= eight 1) (command "-layer" "t" "*Center Sphere.8.*" ""))
(if (= nine 1) (command "-layer" "t" "*Center Sphere.9.*" ""))
(if (= ten 1) (command "-layer" "t" "*Center Sphere.10.*" ""))
(if (= eleven 1) (command "-layer" "t" "*Center Sphere.11.*" ""))
(if (= twelve 1) (command "-layer" "t" "*Center Sphere.12.*" ""))
(if (= thirteen 1) (command "-layer" "t" "*Center Sphere.13.*" ""))
(if (= fourteen 1) (command "-layer" "t" "*Center Sphere.14.*" ""))
(if (= fifteen 1) (command "-layer" "t" "*Center Sphere.15.*" ""))
(if (= sixteen 1) (command "-layer" "t" "*Center Sphere.16.*" ""))
(if (= seventeen 1) (command "-layer" "t" "*Center Sphere.17.*" ""))
(if (= eighteen 1) (command "-layer" "t" "*Center Sphere.18.*" ""))
(if (= top 1) (command "-layer" "t" "*Center Sphere.top.*" ""))
)
This turns one section of the building on with respect to the floors that are already on. It helps workflow a lot but there is tons of code because of how many layers there are which makes it hard to add to.
Thanks for all of your help!
Brandon



have you considered using layer states or do you need to so this using Lisp ?
ResourceCAD.... the Resource for your CAD Solutions
I have considered layer states but because of the number of layer states, this would almost be impossible. If there were fewer layers then layer states would work great.
I have looked up how to select all of the objects on one layer by using filters, but couldn't find a way to program freezing layers by filtering for their name.
Brandon




You can control layer visibility/color/etc. by manipulating the table data - 'tblobjname', 'entmod', etc. But the layer changes would also be affected by 'undo'.
Registered forum members do not see this ad.
Thanks for all of the help!
Brandon
Bookmarks