- 积分
- 1594
- 明经币
- 个
- 注册时间
- 2005-3-21
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
我这里有个小程序,是用来标注倒角的,在标注时,PT4点常常不稳定,原意是要取直线的中点,但实际使用中经常出现PT4点取到了与倒角相距很远的一点,麻烦各位高手帮我看看什么地方出了问题:
(defun C:DC() (SETVAR "CMDECHO" 0) ;(SETQ OLDOS (GETVAR "OSMODE")) (SETQ OLDZIN (GETVAR "DIMZIN")) (SETVAR "DIMZIN" 1) ;(SETVAR "OSMODE" 0) (command "osmode" "0") (SETVAR "ORTHOMODE" 0) (COMMAND "-LAYER" "m" "DIM" "" "") (PRINC "\nPlease Select a Line :") (iF (SETQ SS (ENTSEL)) ;(IF (SETQ SS (ssget))
(SETQ DL (car SS) ;dp (cdr ss) ;p4 (cadr (assoc 10 (entget dp))) Pt1 (CDR (ASSOC 10 (entget DL))) Pt2 (CDR (ASSOC 11 (entget DL))) X (ABS (- (CAR Pt1) (CAR Pt2))) Y (ABS (- (CADR Pt1) (CADR Pt2))) )
)
(princ "\nthe quality of chamfers<1>:") (setq cq (getstring)) (if (/= cq "") (setq cq (strcat cq "-C")) ) (if (= cq "") (setq cq "C") )
(IF (EQUAL X Y 1E-4) (PROGN (PRINC "\nthe chamfer size<") (PRINC (RTOS X 2 1)) (SETQ TT (GETSTRING "> :")) (SETQ TT (IF (= TT "") (RTOS X 2 1) )) (SETQ TT (STRCAT cq TT)) (SETQ Pt4 (POLAR Pt1 (ANGLE Pt1 Pt2) (* (DISTANCE Pt1 Pt2) 0.5)) ) (IF (SETQ Pt3 (GETPOINT Pt4 "\nText Point ? ")) (PROGN (COMMAND "LEADER" Pt4 Pt3 "" "" "" TT "") ) ) ) ) (SETVAR "DIMZIN" OLDZIN) ;(SETVAR "OSMODE" OLDOS) (SETVAR "CMDECHO" 1) (SETVAR "ORTHOMODE" 1) (PRINC) ) |
|