Kokhanetz Posted April 2, 2023 Posted April 2, 2023 Hi Guys, im trying and bugging all day long and i think im not seeing: (defun c:xra ( / ss) (setq ss (ssget "_X" (list (cons 0 "LWPOLYLINE")(cons 8 "~*ET_LS*")))) * (princ "\nDone") (princ) ) setq works because i want to turn off all layers except layer with *ET_LS* but command line: (command "-LAYER" "OFF" ss "") doesnt seem to work another thing i want to exclude is all xrefs: (setq xref (cdr(assoc 2 (entget(car(entsel)))))) it should be smoething with that, but im really struggeling getting it all to work in 1 command. I thought it was a easy script... Hope you guys can help me again with the whole code. Thnx in advance.. Greetz Quote
Steven P Posted April 2, 2023 Posted April 2, 2023 --- Sunday so CAD is off and not checked this but -- Your layer command (command "-layer" "off" ss "") (command - yes, makes sense, "-layer" - yes got to say what command to use "off" - yes makes sense, tell the layer to be off ss - the layer name to turn off - which I think you are using a selection set reference (a list of objects in the drawing) and not a layer name? "" - yes makes sense, end the command Though with CAD off, google still works and this (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/turning-off-layers-in-autolisp/td-p/6339611) from Kent Cooper might help - turn off all layers however you want and then turn on any with *ET_LS using the WCMatch, and removing the question Quote
Tharwat Posted April 2, 2023 Posted April 2, 2023 (while (setq l (tblnext "LAYER" (not l))) (or (wcmatch (setq n (cdr (assoc 2 l))) "*ET_LS*,*|*") (or (minusp (setq v (cdr (assoc 62 (setq e (entget (tblobjname "LAYER" n))))))) (entmod (append e (list (cons 62 (- v))))) ) ) ) 1 Quote
BIGAL Posted April 2, 2023 Posted April 2, 2023 (edited) Another (defun c:loffs ( / ss) (setq ss (ssget "_X" (list (cons 0 "LWPOLYLINE")(cons 8 "~*ET_LS*")))) (repeat (setq x (sslength ss)) (command "-layer" "off" (cdr (assoc 8 (entget (ssname ss (setq x (1- x)))))) "") ) (princ) ) Edited April 3, 2023 by BIGAL Quote
Kokhanetz Posted April 3, 2023 Author Posted April 3, 2023 (edited) @Tharwat, the code worked,: 10 hours ago, Tharwat said: (while (setq l (tblnext "LAYER" (not l))) (or (wcmatch (setq n (cdr (assoc 2 l))) "*ET_LS*,*|*") (or (minusp (setq v (cdr (assoc 62 (setq e (entget (tblobjname "LAYER" n))))))) (entmod (append e (list (cons 62 (- v))))) ) ) ) @BIGAL , I noticed on your code it does work, but it keeps on loading in drawing. I need to do ESC to finish the command. 6 hours ago, BIGAL said: (setq ss (ssget "_X" (list (cons 0 "LWPOLYLINE")(cons 8 "~*ET_LS*")))) (repeat (setq x (sslength ss)) (command "-layer" "off" (cdr (assoc 8 (entget (ssname ss (setq x (1- x)))))) "") ) Thnx again both for the help. Gonna learn from it. Edited April 3, 2023 by Kokhanetz Quote
BIGAL Posted April 3, 2023 Posted April 3, 2023 Had a quick look and need to check for current layer problem. If one of the plines is current layer will not work. Quote
Recommended Posts
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.