Help Xline Layer Control

Help Xline Layer Control

Temssi.d
Enthusiast Enthusiast
342 Views
3 Replies
Message 1 of 4

Help Xline Layer Control

Temssi.d
Enthusiast
Enthusiast

hi'

I have this script,

(defun C:2 (/ dis)
  (setvar 'cmdecho 1)
  ; Create the first Xline
  (command "_.xline" "_ver" pause "")
 
  (while (setq dis (getdist "\nDistance to next Xline: "))
    (command "_.copy" "_last" "" "_non" "@" "_non" (polar (getvar 'lastpoint) 0 dis))
  ); while  

  (prin1)
)

 

I need to change it so it will create vertical Xlines and Place all Xlines on a designated layer (e.g., "layer1") without permanently altering the current layer setting.

 

thanks!!!

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

komondormrex
Mentor
Mentor
Accepted solution

hi,

like that?

 

(defun C:2 (/ dis)
  (setvar 'cmdecho 1)
  ; Create the first Xline
  (command "_.xline" "_ver" pause "")
  (vla-put-layer (vlax-ename->vla-object (entlast)) "layer1") ;added. puts 1st xline to existing "layer1"
 
  (while (setq dis (getdist "\nDistance to next Xline: "))
    (command "_.copy" "_last" "" "_non" "@" "_non" (polar (getvar 'lastpoint) 0 dis))
  ); while  

  (prin1)
)

 

Message 3 of 4

paullimapa
Mentor
Mentor

May want to check to make sure layer1 exists and if not create it


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 4

Temssi.d
Enthusiast
Enthusiast

yep!

thanks 👏😃

0 Likes