- 积分
- 13806
- 明经币
- 个
- 注册时间
- 2016-1-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2021-11-13 10:53:36
|
显示全部楼层
;经过测试图纸,图纸中有的标注是多段线,程序运行不了,其他未严格测试,只有自己改才能满足自己要求
- ;|
- Andyhon
- smartstar发表于 2018-8-31 10:45
- http://bbs.mjtd.com/thread-178132-1-1.html
- 202111131034修改,希望抛砖引玉
- |;
- (defun C:try (/ an1 cmdold ee hh i linelen osold pt pt1 pt10 pt11 pt2 pt3 pt4 ptmax ptmid ptmin sc1 ss ss1 ss2)
- (setq cmdold (getvar "CMDECHO"))
- (setq osold (getvar "osmode"))
- (setvar "CMDECHO" 0)
- (setvar "OSMODE" 0)
- (setq i -1)
- (or(setq sc1 (getreal "\n请输入缩放比例<0.25>:"))
- (setq sc1 0.25)
- )
- (command "undo" "be")
- (setq ss1 (ssget '((0 . "line"))))
- (repeat (sslength ss1) (setq ee (entget (ssname ss1 (setq i (1+ i)))))
- (setq pt10 (cdr (assoc 10 ee)))
- (setq pt11 (cdr (assoc 11 ee)))
- (setq ptmin (mapcar 'min pt10 pt11))
- (setq ptmax (mapcar 'max pt10 pt11))
- (setq ptmid (mapcar '(lambda(x)(* x 0.5))(mapcar '+ ptmin ptmax)))
- (setq linelen (distance ptmin ptmax))
- (setq an1 (angle ptmin ptmax))
- (setq pt1 (polar ptmid (- an1(* 0.5 pi)) (* 0.4 linelen)))
- (setq pt4 (polar ptmid (+ an1(* 0.5 pi)) (* 0.4 linelen)))
- (setq pt2 (polar pt1 an1 (* 0.9 linelen)))
- (setq pt3 (polar pt4 an1 (* 0.9 linelen)))
- (setq ss2 (ssget "Cp" (list pt1 pt2 pt3 pt4)))
- (setq pt (cdr (assoc 10(entget (ssname (ssget "p" '((0 . "circle")))0)))))
- ;(command "pline" pt1 pt2 pt3 pt4"c");测试选择范围用
- (command "Scale" ss2 "" pt sc1)
- )
- (command "undo" "e")
- (setvar "CMDECHO" cmdold)
- (setvar "OSMODE" osold)
- (prin1)
- )
- (prompt "\n****<c:try>****")
- (prompt "\n程序为二位前辈创建,仅稍作修改供交流")
- (prin1)
-
|
|