วันพฤหัสบดีที่ 7 ธันวาคม พ.ศ. 2566

Points to Polyline.

 Points to Polyline.


;|

Select object (point only) and draw polyline

|;

(defun c:p2pl (/ sset p1 n p2 ss1 ss2)

(setq old_cmdecho  (getvar "cmdecho"))

(setq old_osnap (getvar "osmode"))

(setq old_pedit (getvar 'peditaccept))

(setvar 'peditaccept 1)

(setvar "cmdecho" 0)    

(prompt "\nDraw Polyine From Points")

(Setq sset (ssget '((0 . "POINT"))))

(Setq p1 nil

  ss1 nil

)

(setvar "osmode" 0) 

(repeat (setq n (sslength sset))

(setq p2 (cdr (assoc 10 (entget (ssname sset (setq N (- N 1)))))))

(if (/= p1 nil)

(progn

(command "_.pline" "_none" p1 "_none" p2 "")

    (setq ss2 (entlast))

)

)

(if (/= ss1 nil)

(progn

(command "_.pedit" "_multiple" ss1 ss2 "" "_join" "0.0" "")

(setq ss1 (entlast))

)

(setq ss1 ss2)

)

(setq p1 p2) 

)

(setvar 'PEDITACCEPT old_pedit)

(setvar "cmdecho" old_cmdecho)

(setvar "osmode" old_osnap)

(princ)

)

ไม่มีความคิดเห็น:

แสดงความคิดเห็น