 - (load "xyp_lib.vlx") ;版本 V.20060422
- ;|下载和加载通用函数(可在签名栏直接下载后放到搜索路径下)
- 利用以下任何一种方式(首选第一种)即可加载和运行通用函数内的所有子程序:
- ★1·在acad.lsp中增加(load"xyp_lib.vlx")
- ■2·在每个程序内增加(load"xyp_lib.vlx")
- ■3·在command下,输入(load"xyp_lib.vlx")
- ■4·在菜单.mnl中增加(load"xyp_lib.vlx")
- ■5·将xyp_lib.vlx文件直接拽到cad屏幕
- [COLOR=red] ★通用函数下载地址:[/COLOR]
- [url]http://www.xdcad.net/forum/attachment.php?s=&postid=1606661[/url]
- [url]http://bbs.mjtd.com/forum.php?mod=viewthread&tid=37554[/url]
- [url]http://free.ys168.com/?xyp1964[/url]
- |;
- ;;;封闭域的形心、惯性矩、惯性积、旋转半径
- (defun c:test285 ()
- (defun write-tmp ()
- (setq f (open "c:/tmp.mpr" "r"))
- (read-line f)
- (read-line f)
- (read-line f)
- (while (setq txt (read-line f))
- (setq pt (list (car pt) (- (cadr pt) (* sc 800))))
- (xyp-Text 1 pt txt)
- )
- (close f)
- )
- (cmdlasc0)
- (setvar "osmode" 0)
- (xyp-mkLaCo "中心线" 1)
- (while (setq pt (getpoint "\n选择区域内一点<退出> : "))
- (command "-boundary" "a" "o" "r" "" pt "")
- (setq s1 (entlast)
- pt (vlax-safearray->list
- (vlax-variant-value
- (vla-get-centroid (xyp-Ve2Vo s1))
- )
- )
- )
- (xyp-Cross pt (* sc 200) 1)
- (command "MASSPROP" s1 "" "y" "c:/tmp.mpr")
- (xyp-mkLaCo "面域标注" 4)
- (write-tmp)
- (redraw)
- )
- (cmdla1)
- )
- ;|
- 相关vl函数:
- AutoLISP 对象名 : (setq s1 (car(entsel)))
- VL实体 : (setq Object (xyp-Ve2Vo s1))
- 面积 : (vla-get-Area (xyp-Ve2Vo s1))
- 周长 : (vla-get-Perimeter (xyp-Ve2Vo s1))
- 边界框 : (xyp-get-MinMaxPoint s1 1)
- (xyp-get-MinMaxPoint s1 9)
- 质心 : (vlax-safearray->list
- (vlax-variant-value
- (vla-get-Centroid (xyp-Ve2Vo s1))
- )
- )
- 惯性矩 : (vlax-safearray->list
- (vlax-variant-value
- (vla-get-MomentOfInertia (xyp-Ve2Vo s1))
- )
- )
- 惯性积 : (vla-get-ProductOfInertia (xyp-Ve2Vo s1))
- 旋转半径 : (vlax-safearray->list
- (vlax-variant-value
- (vla-get-RadiiOfGyration (xyp-Ve2Vo s1))
- )
- )
- 主力矩与质心的 X-Y 方向 : (vlax-safearray->list
- (vlax-variant-value
- (vla-get-PrincipalMoments (xyp-Ve2Vo s1))
- )
- )
- |;
|