- 积分
- 30207
- 明经币
- 个
- 注册时间
- 2019-11-19
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2023-7-26 19:43:24
|
显示全部楼层
你这样试试
(defun C:NM (/ CURVE N SS SUMLEN TLEN zml-clip-setstring)
(vl-load-com)
(defun ZML-CLIP-SETSTRING (STR / HTML RESULT);;向系統剪貼板寫入文字
(setvar "DIMZIN" 8) ;消除十進制標註中的後續零
(if(listp STR)
(setq str(vl-prin1-to-string STR))
)
(and (= (type STR) 'STR)
(setq HTML (vlax-create-object "htmlfile"))
(setq RESULT (vlax-invoke
(vlax-get (vlax-get HTML 'PARENTWINDOW)
'CLIPBOARDDATA
)
'SETDATA
"Text"
STR
)
)
(vlax-release-object HTML)
)
)
(ZML-CLIP-SETSTRING "防止出错,占位一下!")
(setq SUMLEN 0)
(setq SS (ssget '((0 . "CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE,ARC"))))
(setq N 0)
(repeat (sslength SS)
(setq CURVE (vlax-ename->vla-object (ssname SS N)))
(setq TLEN (vlax-curve-getdistatparam CURVE (vlax-curve-getendparam CURVE)))
(setq SUMLEN (+ SUMLEN TLEN))
(setq N (1+ N)))
(setq sumlen(/ sumlen 1000))
(ZML-CLIP-SETSTRING (rtos SUMLEN 2 2))
(princ (strcat "\n共选择 " (itoa (sslength SS)) " 条线段. 线段总长: " (rtos SUMLEN 2 2)" m"))
(princ)
)
|
|