A lisp to load Layer and line types.

A lisp to load Layer and line types.

3arizona
Advocate Advocate
1,777 Views
3 Replies
Message 1 of 4

A lisp to load Layer and line types.

3arizona
Advocate
Advocate

I have this lisp that loads layers, a line type "Hidden2" and sets text style to MS REFERENCE SANS SERIF.  Everything works but when done last layer (60) line type changes to Hidden2.

 

I want lisp to finish like this:

  • load layers 
  • load line type(s)
  • set text style 
  • change back to previous layer

 

Lisp:

 

(defun c:TEST1()
(setq oldlay (getvar "clayer"))
(COMMAND "-LAYER" "M" "8" "C" "8" "" "")
(COMMAND "-LAYER" "M" "5" "C" "2" "" "")
(COMMAND "-LAYER" "M" "15" "C" "3" "" "")
(COMMAND "-LAYER" "M" "10" "C" "4" "" "")
(COMMAND "-LAYER" "M" "60" "C" "5" "" "")
(COMMAND "-LAYER" "l" "hidden2" "" "")
(COMMAND "-style" "standard" "MS REFERENCE SANS SERIF" "0" "1" "0" "n" "n")
(setvar "clayer" oldlay))
)
(prin1)
)

0 Likes
Accepted solutions (1)
1,778 Views
3 Replies
Replies (3)
Message 2 of 4

rkmcswain
Mentor
Mentor
Accepted solution

Maybe this?

 

(defun c:TEST1( / oldlay expert)
  (setq oldlay (getvar "clayer"))
  (COMMAND "-LAYER" "M" "8" "C" "8" "" "")
  (COMMAND "-LAYER" "M" "5" "C" "2" "" "")
  (COMMAND "-LAYER" "M" "15" "C" "3" "" "")
  (COMMAND "-LAYER" "M" "10" "C" "4" "" "")
  (COMMAND "-LAYER" "M" "60" "C" "5" "" "")
  (setq expert (getvar "expert"))
  (setvar "expert" 3)
  (vl-cmdf "linetype" "load" "hidden2" "acad.lin" "")
  (setvar "expert" expert)
  (COMMAND "-style" "standard" "MS REFERENCE SANS SERIF" "0" "1" "0" "n" "n")
  (setvar "clayer" oldlay)
  (princ)
)
R.K. McSwain     | CADpanacea | on twitter
Message 3 of 4

john.uhden
Mentor
Mentor

Well that's what you programmed it to do.

 

(COMMAND "-LAYER" "l" "hidden2" "" "") ;; sets the linetype "hidden2" for the current layer, which you just made "60" in the line before,

 

I am wondering if you really wanted to

(command "-ltype" "Load" "hidden2")

John F. Uhden

0 Likes
Message 4 of 4

3arizona
Advocate
Advocate

rkmcswain

 

this is what i was looking for.  Thank you, for your time!