(vl-load-com)
(defun c:cal (/ A E I L S K)
(if
(and (setq
s (ssget '((0 . "ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE")
(-4 . "<AND")
(0 . "LWPOLYLINE")
(70 . 1)
(-4 . "AND>")
)
)
)
(progn
(initget "A B")
(setq
k
(cond
((getkword
"\n For calculation select < A > :"
)
)
("A")
)
)
)
)
(progn
(setq l 0.0
a 0.0
i 0
)
(while (< i (sslength s))
(progn
(setq e (ssname s i)
l (+ l
(vlax-curve-getdistatparam e (vlax-curve-getendparam e))
)
a (+ a (vlax-curve-getarea e))
)
)
(setq i (1+ i))
)
(textscr)
(setq t1 (/ (* (- (expt (+ (sqrt a) 1) 2) a) l 0.25) (sqrt a))
(setq t2 (/ (* (- (expt (+ (sqrt a) 4) 2) a) l 0.25) (sqrt a))
(setq t3 (* a 0.1)
(sqrt a)
)
(if (eq k "A")
(if (> t1 t3)
(princ (strcat "\n Type 3: " (rtos t3 2 2) " sq.m"))
(princ (strcat "\n Type 1: " (rtos t1 2 2) " sq.m"))
)
(if (eq k "B")
(if (> t2 t3)
(princ (strcat "\n Type 3: " (rtos t3 2 2) " sq.m"))
(princ (strcat "\n Type 1: " (rtos t1 2 2) " sq.m"))
)
(princ)
)
)
)
)
)
)
)
现在我有了;错误:语法错误 错误在哪里?我不明白。我对所有括号都感到困惑:? (vl-load-com)
(defun c:cal (/ A E I L S K t1 t2 t3)
(if
(and (setq
s (ssget '((0 . "ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE")
(-4 . "<AND")
(0 . "LWPOLYLINE")
(70 . 1)
(-4 . "AND>")
)
)
)
(progn
(initget "A B")
(setq
k
(cond
((getkword
"\n For calculation select < A > :"
)
)
("A")
)
)
)
)
(progn
(setq l 0.0
a 0.0
i 0
)
(while (< i (sslength s))
(progn
(setq e (ssname s i)
l (+ l
(vlax-curve-getdistatparam e (vlax-curve-getendparam e))
)
a (+ a (vlax-curve-getarea e))
)
)
(setq i (1+ i))
)
(textscr)
(setq t1 (/ (* (- (expt (+ (sqrt a) 1) 2) a) l 0.25) (sqrt a))
)
(setq
t2 (/ (* (- (expt (+ (sqrt a) 4) 2) a) l 0.25) (sqrt a))
)
(setq t3 (* a 0.1))
(if (eq k "A")
(if (> t1 t3)
(princ (strcat "\n Type 3: " (rtos t3 2 2) " sq.m"))
(princ (strcat "\n Type 1: " (rtos t1 2 2) " sq.m"))
)
)
(if (eq k "B")
(if (> t2 t3)
(princ (strcat "\n Type 3: " (rtos t3 2 2) " sq.m")
)
(princ (strcat "\n Type 2: " (rtos t2 2 2) " sq.m")
)
)
)
(princ)
)
)
)
我想我已经修好了。。。。。。我很高兴:庆祝::庆祝: 所以,你解决了。祝贺 谢谢你的帮助
页:
1
[2]