- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm looking to craft a lisp that will apply a standard set of layer parameters to a file without fully opening it.
Below is a sample of parameters that are applied to an open drawing:
(setq laytemp "E-COMM")(command "layer" "make" laytemp "color" "TRUECOLOR" "124,0,164" laytemp "ltype" "CONDUIT" laytemp "lweight" "0.25" laytemp "plot" "p" laytemp "")
(setq laytemp "E-COMM-MSC")(command "layer" "make" laytemp "color" "TRUECOLOR" "124,0,164" laytemp "ltype" "Continuous" laytemp "lweight" "0.25" laytemp "plot" "p" laytemp "")
(setq laytemp "XE-COMM")(command "layer" "make" laytemp "color" "TRUECOLOR" "124,0,164" laytemp "ltype" "CONDUIT" laytemp "lweight" "0.25" laytemp "plot" "p" laytemp "")
I think that I want to combine a list like this into something with the vla commands. The below is something we have for freezing layers in closed drawings.
(defun c:clof ()
(vl-load-com)
(setq dwgfile (getfiled "Select a drawing" "" "dwg" 0))
(setq lay (getstring "\nENTER A LAYER TO TURN OFF:"))
(setq cadver(substr (getvar "acadver") 1 2)) ;; get cad version No.
(setq id (strcat "objectdbx.AxDbDocument." cadver)) ;; creat prog id
(setq dbx(vlax-create-object id)) ;; creat dbx object
(vla-open dbx dwgfile)
(setq layers (vla-get-layers dbx)) ;; get layer collection set from dbx
(if (not (vl-catch-all-error-p
(setq vlay(vl-catch-all-apply 'vla-item (list layers lay))))) ;; fild the specified layer in collection
(if (eq (vla-get-layeron vlay) :vlax-true) ;; check layer status
(vla-put-layeron vlay :vlax-false)
)
(print "THE LAYER NOT FOUND ! ")
)
(vla-saveas dbx dwgfile)
(vlax-release-object dbx)
(prin1)
)
Can someone help with this, please?
Much thanks!
Solved! Go to Solution.