此编码只能选择直线,不能选择多段线
如何更改代码,以便用户可以选择直线和多段线来添加尺寸/引线
TQ公司
- (defun C:DCH(/ CL CHAM DL PT1 PT2 ANG ANG1 DIST PT3 PT4 DIST1 T1 H1 V1)
- (defun *error* (msg) (setq *error* nil) (princ))
- (setq old10 (getvar "ucsorg"))
- (command "_ucs" "w")
- (command "_ucsicon" "or")
- (setvar "CMDECHO" 0)
- (setq CL(getvar "CLAYER")
- CHAM(entget(car(entsel "\nSelect Chamfer to Dimension: ")))
- PT1(cdr(assoc 10 CHAM))
- PT2(cdr(assoc 11 CHAM))
- ANG(angle PT1 PT2)
- ANG1(angtos ANG 0 0)
- DIST(distance PT1 PT2))
- (cond
- ((or(= ANG1 "45")(= ANG1 "135")(= ANG1 "225")(= ANG1 "315"))
- (setq PT3(polar PT1 ANG (/ DIST 2.0))
- PT4(getpoint "\nNote Location: ")
- DIST1(rtos(* DIST(abs(cos ANG))) 2 2)
- T1(strcat "C"DIST1))
- (command "leader" pt3 pt4 "" "" "" T1 "")
- )
- ((or(and(> ANG1 "0")(< ANG1 "45"))
- (and(> ANG1 "45")(< ANG1 "135"))
- (and(> ANG1 "135")(< ANG1 "225"))
- (and(> ANG1 "225")(< ANG1 "315"))
- (and(> ANG1 "315")(< ANG1 "360")))
- (setq H1(getpoint "\nHorizontal Dimension Line Location: ")
- V1(getpoint "\nVertical Dimension Line Location: "))
- (command "layer" "s" DL "" "dim" "horizontal" PT1 PT2 H1 "" "vertical" PT1 PT2 V1 "" nil)
- )
- )
- (command "layer" "s" CL "")
- )
|