发布于:2012-08-06 12:28:06
来自:建筑设计/CAD下载及教程
[复制转发]
defun c:lc(/)
(setq bl (getint "\n输入比例1:"))
(setq entname1(car (entsel "\n请选择选pl:" )))
(setq a(cadr(entget entname1)))
(setq entname2(car (entsel "\n请选择选标注:" )))
(setq vlax-entname2(vlax-ename->vla-object entname2)
dxf-entname2(entget entname2)
len (vla-get-length (vlax-ename->vla-object entname1))
text (CDR (ASSOC 1 dxf-entname2))
s-5 (Strcat (substr text 1 1) (substr text 3 3))
s-1 (atof s-5)
len (/ len bl)
len (fix(+ len 0.5))
len (+ s-1 len)
len(+ len 1)
q (fix(/ len 1000));
b (- len(* q 1000)));
(if(< b 100)((setq text-j (Strcat (rtos q) "+" "0" (rtos b))))(setq text-j (Strcat (rtos q) "+" (rtos b))))
(print (Strcat (rtos q) "+" "0" (rtos b)))
(setq h (getpoint "\n 里程插入点:"))
(command "text" "M" h 0 text-j)
(entmod dxf-entname2)
(princ))
这个程序是把现有的里程和pl线求和的,但是长度为10时就会出问题,这是为什么呢?还有一个小问题我搞不懂,就是如何判断选着的为PL如果不是PL线重新选着
全部回复(1 )
只看楼主 我来说两句 抢板凳http://www.cadjy.com/wp/t/entsel/
回复 举报