大家好
我在通过lisp偏移两边的多段线时遇到了一些问题。我可以在一侧偏移多段线。但很难在另一侧执行偏移。我写的代码显示在下面。请检查并帮助解决问题。提前感谢(定义c:p()
(vl load com)
(setq ply(ssget“x”(列表(cons 0“lwpolyline”)(cons 8“Property\u Boundary”)))
(setq dist(getreal“指定偏移距离:”))
(setq slen(sslength ply))
(设置编号0)
(重复slen
(setq pl_序列(entget(ssname ply nos)))
(setq实体名称(cdr(assoc-1 pl\U序列)))
(setq startpt(vlax curve getstartPoint entity_name))
(setq endpt(vlax curve getEndPoint entity_name))
(setq len(距离startpt endpt))
(setq pt(极性startpt(setq ang(角度startpt endpt))(/透镜2)))
(setq ang(角度startpt endpt))
(setq ang_pnt(极性pt ang dist))
(命令“offset”dist entity\u name ang\u pnt“”)
(设置数量(+1个))
)
) 也许是这个未经测试
(defun c:p (/ ply dist slen nos pl_sequence entity_name startpt endpt len pt ang_pt)
(vl-load-com)
(setq ply (ssget "x" (list (cons 0 "lwpolyline") (cons 8 "Property_Boundary"))))
(setq dist (getreal "Specify offset distance :"))
(setq slen (sslength ply))
(setq nos 0)
(repeat slen
(setq pl_sequence (entget (ssname ply nos)))
(setq entity_name (cdr (assoc -1 pl_sequence)))
(setq startpt (vlax-curve-getstartPoint entity_name))
(setq endpt (vlax-curve-getEndPoint entity_name))
(setq len (distance startpt endpt))
(setq pt (polar startpt (setq ang (angle startpt endpt)) (/ len 2)))
(setq ang_pnt (polar pt (+ ang (/ pi 2)) dist))
(command "offset" dist entity_name ang_pnt "")
(setq nos (+ 1 nos))
) ;_end repeat
(princ)
) ;_end defun
页:
[1]