路过,随手写的lsp,保存为*.lsp文件加载到CAD试试看
- (defun c:tt(/ bjing en mj mzhong zc zjing zl)(vl-load-com)
- (setq zjing(getint "-->输入铝棒直径:")bjing(* zjing 0.5) mzhong(rtos(* pi bjing bjing 0.0027)2 3))
- (setq en(Vlax-Ename->Vla-Object(car(entsel "-->点选封闭图形:"))))
- (setq mj(vlax-get en 'area) zc(rtos(vlax-get en 'length)2 3))
- (setq zl(rtos(* mj 0.0027)2 3))
- (princ"\n所选型材参数信息如下:")
- (princ(strcat "\n型材周长:" zc "mm"))
- (princ(strcat "\n截面积:" (rtos mj 2 3) "mm2"))
- (princ(strcat "\n型材米重:" zl "kg/m"))
- (princ(strcat "\n铝棒米重"(rtos bjing 2 2)"*"(rtos bjing 2 2)"*"(rtos pi 2 2)"*0.0027=" mzhong "kg/m"))
- (princ(strcat "\n挤压比为=" mzhong "/" zl "="(rtos(/(atof mzhong)(atof zl))2 2)))
- (princ)
- )
|