RE: 画多段线投影线 v1.1(2016-8-6更新)
本帖最后由 greg.battin 于 2018-2-14 04:40 编辑here is one that lets you define a line that points are to be projected upon.
;project lines - GREAT FOR CREATING ELEVATIONS
(defun pt?(pt)
(and (vl-consp pt)
(= (length pt) 3)
(vl-every (function (lambda (coord) (= (type coord) 'real)))
pt)))
(defun C:PROJECT(/ osm cmd orth p1 p2 p3 p4 Lb sslp lth cont cont1)
(setqosm(getvar "OSMODE")
cmd(getvar "CMDECHO")
orth (getvar "ORTHOMODE")
sslp (ssadd))
(setvar "CMDECHO" 0)
(setvar "ORTHOMODE" 1)
(setvar "OSMODE" 0)
(if (and (setq p1 (getpoint "\nFirst point: "))
(setq p2 (getpoint "\nSecond point: " p1)))
(progn
(command "_.LINE" p1 p2 "")
(setq L (entlast))
(redraw (entlast) 3)
(setvar "OSMODE" 33)
(initget "Erase")
(setq p3 (getpoint "\n<Enter to exit>/Select point : "))
(if (pt? p3)
(progn
(setvar "OSMODE" 0)
(setq p4 (polar p3 (+ (angle p1 p2) (/ pi 2)) 1))
(command "_.LINE" p3 (inters p1 p2 p3 p4 nil) "")
(redraw (entlast) 3)
(setq sslp (ssadd (entlast) sslp))
(setvar "OSMODE" 33)))
(while (or (pt? p3) (= p3 "Erase"))
(initget "Erase")
(setq p3
(getpoint "\n<Enter to exit>/Select point : "))
(if (pt? p3)
(progn
(setvar "OSMODE" 0)
(setq p4 (polar p3 (+ (angle p1 p2) (/ pi 2)) 1))
(command "_.LINE" p3 (inters p1 p2 p3 p4 nil) "")
(redraw (entlast) 3)
(setq sslp (ssadd (entlast) sslp))
(setvar "OSMODE" 33)))
(if (and (= p3 "Erase") (ssname sslp 0))
(progn
(prompt "\nSelect projection line(s)")
(setq cont10
lb(ssget))
(setq cont 0
lth(sslength lb))
(while (<= cont (- lth 1))
(if (ssmemb (ssname Lb cont) sslp)
(progn
(ssdel (ssname Lb cont) sslp)
(command "_.ERASE" (ssname Lb cont) "") (setq account (1+ cont)))
(setq cont1 (1+ cont1)))))
(prompt (strcat (itoa lth)
" Selected object(s)), "
(itoa cont1)
" Projection line(s) erased"))))
(if (and (= p3 "Erase") (null (ssname sslp 0)))
(prompt "\nProjection line(s) not found to erase")))
(setvar "OSMODE" osm)
(setvar "ORTHOMODE" orth)
(if (ssname sslp 0)
nil
(command "_.ERASE" L ""))))
(setvar "CMDECHO" cmd)
(princ))
(princ) 牛B,好东西 只能多段线吗,楼主开发个直线的么!应该很有用! 有创意,赞一个。 能支持直线吧?平时很少多断线啊 不错很好用谢谢楼主!