zhd81617 发表于 2007-12-30 15:04

尺寸驱动tt

转载
尺寸驱动tt;;;编写: BDYCAD
;;;时间: 2005-03-18
;;;开发用时26分钟
;;;功能: 尺寸驱动
(defun c:tt(/ BLB EP ESPL N-EP N-SP NEW-T SD SD-DXF SEA SEB SP SS1 SS2 SS3)
(setq SD (entsel "\n选择驱动尺寸:"))
(if SD
    (PROGN
      (SETQ SD-DXF (ENTGET (CAR SD)))
      (WHILE (NOT (wcmatch (CDR (ASSOC 0 SD-DXF)) "*DIM*"))
(setq SD (entsel "\n选择驱动尺寸:"))
(SETQ SD-DXF (ENTGET (CAR SD))))
      (SETQ SP (CDR (ASSOC 13 SD-DXF))
   EP (CDR (ASSOC 14 SD-DXF))
   ESPL (DISTANCE SP EP)
   SEA (ANGLE SP EP)
   SEB (ANGLE EP SP)
   NEW-T (getdist "\n新的长度:"))
      (while (eq nil NEW-T)
(setqNEW-T (getdist "\n新的长度:")))
      (if NEW-T
(progn
      (setq BLB (* 0.5 (abs (-NEW-T ESPL))))
      (if (> ESPL NEW-T )
(setq N-SP (POLAR SP SEA BLB)
       N-EP (POLAR EP (+ PI SEA) BLB))
(setq N-SP (POLAR SP SEB BLB)
       N-EP (POLAR EP (+ PI SEB) BLB))
)
      (setvar "osmode" (logior (getvar "osmode") 16384))
      (setvar "cmdecho" 0)
      (vl-cmdf "_.undo" "_group")
      (SETQ SS1 (SSGET "C" (POLAR SP (+ PI (* 0.25 PI)) 0.4)(POLAR SP (* 0.25 PI) 0.4))
   SS2 (SSGET "C" (POLAR EP (+ PI (* 0.25 PI)) 0.4)(POLAR EP (* 0.25 PI) 0.4))
   )
      (IF SS1
(COMMAND "STRETCH" (SSGET "C" (POLAR SP (+ PI (* 0.25 PI)) 0.4)(POLAR SP (* 0.25 PI) 0.4))
   ""SP N-SP))
      (IF SS3
(COMMAND "STRETCH" (SSGET "C" (POLAR EP (+ PI (* 0.25 PI)) 0.4)(POLAR EP (* 0.25 PI) 0.4))
   ""EP N-EP))
      (vl-cmdf "_.undo" "_end")
      (setvar "osmode" (logand (getvar "osmode") 49151))
      (PRINC"\n编写:BDYCAD\n尺寸驱动程序运行完毕, 欢迎使用.谢谢!")))
      )
    )
(princ)
)

yourspace 发表于 2008-11-5 16:50

我试了,可以驱动,很不错,但就是100的长度改成120时,结果尺寸值并非120,不知为什么,请楼主明示
页: [1]
查看完整版本: 尺寸驱动tt