在CAD中使用分段标注多段线线长它标注出来带小数50.00我不要带小数要整数50这样
在CAD中使用分段标注多段线线长它标注出来带小数50.00我不要带小数要整数50这样一下是代码麻烦哪位大神能帮我修改一下谢谢。;;;分段标注线长
(defun c:PPP (/ zg ss obj lst n l lst lst1 lst2 lst3 obj1 obj2)
(prompt "\n请选择需要标注的线:")
(setq zg 6);;; 字高可自定义
(if (setq ss (ssget ":S:E" '((0 . "LWPOLYLINE"))))
(progn
(setq obj (vlax-ename->vla-object (ssname ss 0))
lst nil
n -1
)
(while (setq l (vlax-curve-getDistAtParam obj (setq n (1+ n))))
(setq lst (cons l lst))
)
(setq lst (reverse lst)
lst1 (mapcar '(lambda (a b) (- b a)) lst (cdr lst))
)
(setq
lst2 (mapcar '(lambda (x) (vlax-curve-getPointAtDist obj x))
(mapcar '(lambda (a b) (+ a (* 0.5 b))) lst lst1)
)
)
(setq lst3
(mapcar '(lambda (x)
(setq
ang (angle
x
(mapcar '+
x
(vlax-curve-getFirstDeriv
obj
(vlax-curve-getParamAtPoint obj x)
)
)
)
)
(if (< (* 0.5 pi) ang (* 1.5 pi))
(- ang pi)
ang
)
)
lst2
)
)
(setq obj1 (car (vlax-safearray->list
(vlax-variant-value (vla-offset obj zg))
)
)
obj2 (car (vlax-safearray->list
(vlax-variant-value (vla-offset obj (- zg)))
)
)
)
(or (> (vla-get-Length obj1) (vla-get-Length obj2))
(vla-Delete obj1)
(setq obj1 obj2
obj2 nil
)
)
(and obj2 (vla-Delete obj2))
(setq lst2
(mapcar '(lambda (x) (vlax-curve-getClosestPointTo obj1 x))
lst2
)
)
(vla-Delete obj1)
(mapcar '(lambda (a b c)
(entmake (list '(0 . "TEXT")
(cons 1 (rtos a 2 2))
(cons 10 b)
(cons 40 zg)
(cons 11 b)
'(72 . 1)
'(73 . 2)
(cons 50 c)
)
)
)
lst1
lst2
lst3
)
)
)
(princ)
)
(cons 1 (rtos a 2 2))
改成 (cons 1 (rtos a 2 0))试下 本帖最后由 万事如意 于 2024-8-1 14:11 编辑
土土木木人 发表于 2024-8-1 11:25
(cons 1 (rtos a 2 2))
改成 (cons 1 (rtos a 2 0))试下
谢谢你大神改好了,你好还的麻烦你一下在怎么改标注文字数字总在多段线上方,现在标注的数字在多段线下方数字还是反,标注的数字跟画多段线的方向转动。 不保留小数位 万事如意 发表于 2024-8-1 14:04
谢谢你大神改好了,你好还的麻烦你一下在怎么改标注文字数字总在多段线上方,现在标注的数字在多段线下方 ...
改标注文字数字总在多段线上方
页:
[1]