+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Full Member
    Computer Details
    neilma's Computer Details
    Operating System:
    Win 7 Prof.
    Computer:
    HP Elitebook
    Using
    Inventor 2012
    Join Date
    Feb 2004
    Location
    Auckland, New Zealand. Ex Swansea, S.Wales. U.K.
    Posts
    40

    Default Help with a lisp routine to turn layers ON/OFF

    Registered forum members do not see this ad.

    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

  2. #2
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    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
    R12 (Dos) - A2K

  3. #3
    Full Member
    Computer Details
    neilma's Computer Details
    Operating System:
    Win 7 Prof.
    Computer:
    HP Elitebook
    Using
    Inventor 2012
    Join Date
    Feb 2004
    Location
    Auckland, New Zealand. Ex Swansea, S.Wales. U.K.
    Posts
    40

    Default

    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...

  4. #4
    Flores
    Guest

    Default

    Another option would be to make an ACAD slideshow (using mslide and scripts).

    Flores

  5. #5
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    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))
    R12 (Dos) - A2K

  6. #6
    Full Member
    Computer Details
    neilma's Computer Details
    Operating System:
    Win 7 Prof.
    Computer:
    HP Elitebook
    Using
    Inventor 2012
    Join Date
    Feb 2004
    Location
    Auckland, New Zealand. Ex Swansea, S.Wales. U.K.
    Posts
    40

    Default

    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

  7. #7
    Flores
    Guest

    Default

    Registered forum members do not see this ad.

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts