Jump to content

HELP: Lisp to isolate a set of predefined layers base on their layer names.


vernonlee

Recommended Posts

I merged your two threads on this topic, you can ask for a LISP and/or a Macro in the same thread, no need for two threads on same question, it makes things confusing.

Link to comment
Share on other sites

I like to re-open this thread again as I frequently found out that instead of a fixed layer name, i have encounter layers that share the same name but with a slight difference.

So is it possible to incoporate a wildcard name eg. *rev*

 

Thanks

 

Yes, my posted code already allows you to do this.

Link to comment
Share on other sites

Yes, my posted code already allows you to do this.

 

 

Last night I realized that by adding * at the from & back of the text it works for the macro script.

 

Lee, this applies for your lisp as well? btw, can it isloate in paperspace now?

 

Thanks

Link to comment
Share on other sites

try this, you can set upto x no. of layers.

;;predefine selection
(setq lay1 "?") ;;isolate layer 0 as (default)
;;define function
(defun c:test () 
;;turn on the echo command
(setvar "cmdecho" 1)
;;enter a layer name or press ENTER to skip
(setq clay1 (getstring (strcat "\nEnter layer name list <" lay1 ">: ")))
(if (= clay1 "")
    (setq clay1 lay1)
    (setq lay1 clay1)
)
;;Main
(command "-layer" "OFF" "*" "Y" "")
(command "-layer" "ON" lay1 "" "")
(command "zoom" "0.85x")
(princ)
)
(defun c:ret () ;;define function
(command "-layer" "ON" "*" "") ;;turn on all layers
(command "zoom" "e")
(princ)
)
(princ "\nEnter test to isolate & ret to return.")
(princ "\nttray33y @ CADTUTOR.")
(princ)

 

i know someone here can write a shorter version for this, but anyway i am just sharing.

Edited by ttray33y
revised to add list of layers.
Link to comment
Share on other sites

try this, you can set upto x no. of layers.

;;predefine selection
(setq lay1 "?") ;;isolate layer 0 as (default)
;;define function
(defun c:test () 
;;turn on the echo command
(setvar "cmdecho" 1)
;;enter a layer name or press ENTER to skip
(setq clay1 (getstring (strcat "\nEnter layer name list <" lay1 ">: ")))
(if (= clay1 "")
    (setq clay1 lay1)
    (setq lay1 clay1)
)
;;Main
(command "-layer" "OFF" "*" "Y" "")
(command "-layer" "ON" lay1 "" "")
(command "zoom" "0.85x")
(princ)
)
(defun c:ret () ;;define function
(command "-layer" "ON" "*" "") ;;turn on all layers
(command "zoom" "e")
(princ)
)
(princ "\nEnter test to isolate & ret to return.")
(princ "\nttray33y @ CADTUTOR.")
(princ)

 

i know someone here can write a shorter version for this, but anyway i am just sharing.

 

 

Thanks bro. I do need to have an option to have predefined layers within the lisp itself though.

 

Interesting lisp nevertheless

Link to comment
Share on other sites

Thanks bro. I do need to have an option to have predefined layers within the lisp itself though.

 

Interesting lisp nevertheless

 

youre welcome bro.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...