本帖最后由 weiqi 于 2012-11-22 17:55 编辑
测量长度 并 CTRL+V输出~~~~适和 CAD 加EXCEL 手算 工程量用法命令CD
- (print "测量长度 运行命令cd,输出ctrl+v ") ;;;功能:向系统剪贴板写入文字
- (vl-load-com)
- (defun ZML-CLIP-SETSTRING (STR / HTML RESULT)
- (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)
- )
- )
- ;****************************************************CD测量长度
- (defun c:cd()
- (setq os (getvar "osmode"))
- (setvar "osmode" 0)
- (setq sum 0 i 0)
- (setq ss (ssget))
- (repeat (sslength ss)
- (setq en (ssname ss i))
- (command "lengthen" en "")
- (setq l (getvar "perimeter"))
- (setq sum (+ sum l)
- i (+ i 1))
- )
- (setvar "osmode" os)
- (print "结果等于")
- (print sum)
- (setq a (/ sum 1000))
- (setq b (rtos a 2 2))
- (setq c b)
- (print (strcat c "米"))
- (setq txtcon b)
- (ZML-CLIP-SETSTRING txtcon)
- (princ)
- )
新手学习 LISP 望高手指教。。。
以yjr111为榜样~~向Y神学习。
|