Routine request - Set some lay
Hi!I have many layers i would like to see them forced to specific linetypes.
Let say;
Layers.............Linetypes
M-N-INC-25--->Hidden-25
M-N-INC-32--->Hidden-32
I would like to bind this function to a button and each time i click the button it set the layers to the specific linetypes above.. and when i click button one more time it set all these layers back to "By Layer" ...
if its not possible i could use 2 button instead but its less impressive
Thanks in advance. used as a learning experience... minimal error checking and testing
Edit as necessary
BTW... you can't set a layer's linetype to Bylayer, I used Continuous
(defun c:test (/ laylist) (setq laylist (list "M-N-INC-25" "M-N-INC-32")) (if (eq (getvar "useri1") 0) (progn (foreach ln laylist (if (tblsearch "ltype" (strcat "Hidden-" (substr ln (- (strlen ln) 1)))) (command "layer" "l" (strcat "Hidden-" (substr ln (- (strlen ln) 1))) ln "") (alert (strcat "Load linetype " (strcat "Hidden-" (substr ln (- (strlen ln) 1))) " first")) );if ) ;foreach (setvar "useri1" 1) ) ;progn (progn (foreach ln laylist (command "layer" "l" "continuous" ln "") ) ;foreach (setvar "useri1" 0) ) ;progn ) ;if) ;defun Wow it work really good
I would like to understand few things on how it work.
i am still at the "hello world" state.
(tblsearch "ltype" (strcat "Hidden-" (substr ln (- (strlen ln) 1))))
(command "layer" "l" (strcat "Hidden-" (substr ln (- (strlen ln) 1))) ln "")
(alert (strcat "Load linetype " (strcat "Hidden-" (substr ln (- (strlen ln) 1))) " first"))
First line, i beleive you are gathering ltype into the *.lin file...
one line 2 you force the layer to be on a linetype...
line 3 (alert) no idea...
Can you please tell me how it work i dont see how you call Hidden-25 line type..
and i would like to add more layer/Ltype in the future
Let say
M-N-MAIN-100 --to ltype--- CENTER-100
how can i do that? First line > takes the layer's name, strips all but the last 2 characters and tacks it on to Hidden-, then searches to see if the linetype Hidden-nn is loaded. If it is loaded it sets the layer's linetype to Hidden-nn (line 2). If the linetype is not loaded it skips to line 3 and gives you an alert to load it first.
As far as the rest, I suppose it could done, but maybe layer states would be easier.
页:
[1]