View Full Version : Help with a lisp routine to turn layers ON/OFF
neilma
17th Feb 2004, 08:13 pm
Hello everyone,
I was wondering if anyone can help me out. I have a drawing file which has numerous layers each showing a single component of the whole project.
For internal presentation purposes I thought it would be cool to "Build" the project starting with a blank screen (all layers =OFF) then display one by one (by turning a layer ON), each step invoked by a keyboard entry (Press Enter to Continue...)
I imagine this would be quite simple to achieve using lisp, but I don't know how to go about it (lisp novice)
Any help would be greatly appreciated...
Neil
David Bethel
17th Feb 2004, 10:35 pm
The base engine could look like this;
(command "_.LAYER" "_Thaw" "0" "_ON" "0" "_Set" "0" "")
(while (setq tdef (tblnext "LAYER" (not tdef)))
(setq ln (cdr (assoc 2 tdef)))
(command "_.LAYER" "_ON" ln "_Thaw" ln "")
(princ (strcat "\nLayer " ln " Now Visible"))
(getstring"\nPress Enter To Continue: "))
The order of the layers in this scenario would be in order of the layers creation.
You could make a list of all layers, then sort them alphabetically, then feed it to a similar engine, or have a preset layer list. -David
neilma
17th Feb 2004, 11:37 pm
Thanks David,
Its very exciting seeing the objects appear.
It would be even better if I could have more control over this though.
Once the lisp is loaded, how can I envoke it from the command line? and perhaps I could set the scene (all layers = off/frozen, view = Saved view name, gouraud shading = on). Also, please step by step a method of changing the order in which the layers are handled.
I am very grateful for the help so far, Please continue...
Flores
17th Feb 2004, 11:45 pm
Another option would be to make an ACAD slideshow (using mslide and scripts).
Flores
David Bethel
19th Feb 2004, 12:45 pm
Simply fill in laylist with your layers names in the order in which you whish them to appaer. -David
(defun c:steplay (/ tdef laylist)
(setq laylist '("0" "LAY1" "LAY2" "LAY3" "LAY4" "1D" "2D" "3D"))
(command "_.LAYER" "_Thaw" "0" "_ON" "0" "_Set" "0" "")
(foreach ln laylist
(if (tblsearch "LAYER" ln)
(progn
(command "_.LAYER" "_ON" ln "_Thaw" ln "")
(princ (strcat "\nLayer " ln " Now Visible"))
(getstring"\nPress Enter To Continue: "))))
(princ))
neilma
19th Feb 2004, 08:22 pm
Thank You David for your help,
I appreciate the time you have taken to help me.
I also explored the Script option suggested by Flores and have a model that builds itself using time delays.
The lisp routine offers more control as I can pan, zoom and 3D orbit in-between layers displaying.
Thanks again David & Flores
Flores
19th Feb 2004, 09:05 pm
David's routine is much more easier to use than the old slideshow way. Back in college, the instructors always said they were going to remove the lecture on mslides and slideshows because it is rarely used in the industry. The only things that I have found mslides helpful for are in dialog boxes and lisp routines.
Flores
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.