以指定長度創建一條与已知線段平行的線段,類似OFFSET(等距線)命令。
;;parline.lsp;;以指定长度创建一条与已知线段平行的线段,类似OFFSET(等距线)命令。
;;再简化
(defun C:PARLINE (/ HOLDECHO HOLDOSMODE D
L PICK ENT TYPE1 TYPE2 ENT1
PT2 NEWENTP1 P2
)
(setq HOLDECHO (getvar "cmdecho"))
(setq HOLDOSMODE (getvar "osmode"))
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(setq D (getreal "\n输入偏移距离: "))
(setq L (getreal "\n输入新的实体长度: "))
(setq PICK (entsel "\n拾取要偏移的对象:"))
(setq ENT (car PICK))
(setq TYPE1 (entget (car PICK)))
(setq ENT1 (cdr (assoc 0 TYPE1)))
(if (= ENT1 "LINE")
(progn
(setq PT2 (getpoint "\n往哪边偏移: "))
(command "offset" D ENT PT2 "")
(setq NEWENT (entlast))
(setq TYPE2 (entget NEWENT))
(setq P1 (cdr (assoc 10 TYPE2)))
(setq P2 (cdr (assoc 11 TYPE2)))
(command "_.scale"
NEWENT
""
(mapcar '/ (mapcar '+ P1 P2) '(2 2 2))
(/ L (distance P1 P2))
)
)
(prompt "\n该实体不是一条线!")
)
(setvar "osmode" HOLDOSMODE)
(setvar "cmdecho" HOLDECHO)
(princ)
)
(prompt "\n键入PARLINE唤起命令: ") 龍龍仔寫的好 ! <p>顶龙龙仔</p> 谢谢分享,学习一下
页:
[1]