Stephan MBR-我正在使用另一个名为stl的lisp例程。lsp。这是伟大的钢细节,虽然我在这个项目的主要原因是与铝工作。我最终会在代码中放置一个提示,询问用户形状是钢还是铝,并根据输入计算重量/英尺和其他。Stl。lsp相当准确地绘制了配置文件,至少是我能够检查到的。我必须将形状转化为一个区域,但然后我运行MASSPROP并获得许多信息,我正在对照AISC手册进行交叉检查。我确信像SolidWorks这样的软件可以自动并且更准确地完成这项工作,但我没有SolidWorks的许可证,而且在可预见的将来也不会。
As sloppy as this may be I almost have it where it will be. The text is not an easy thing to do. I have about 50 LISP programs in my collection and it wasn't until I started looking for some text examples that I realized I don't have any. I guess it makes sense that LISP is not really the correct tool for entering text. But this routine is an exception to that rule. Here is what I have so far. You will need a shape like an extrusion of some kind to run this on. I don't think I have the weight thing right just yet and I'm still seeing about a 2% discrpency between the Ix figures I get and the published ones for steel shapes in the AISC manual.
[code](defun c:test ( / e o f d l ) (if (and (setq e (car (entsel))) (setq o (vlax-ename->vla-object e)) (eq "AcDbRegion" (vla-get-objectname o)) ;(setq f (vl-filename-mktemp nil (getvar 'dwgprefix) ".txt")) ;(setq d (open f "w")) ) (progn (princ (strcat "Area: " (rtos (vlax-get o 'area)) " Wt/Ft = " (rtos (* (vlax-get o 'area) 1.18) 2 2) "\nPerimeter: " (rtos (vlax-get o 'perimeter)) "\nCentroid: " (progn (setq l (mapcar 'rtos (vlax-get o 'centroid))) (strcat (car l) "," (cadr l)) (setq ip (strcat (car l) "," (cadr l))) ) "\nRadii of Gyration: " (progn (setq l (mapcar 'rtos (vlax-get o 'radiiofgyration))) (strcat (car l) "," (cadr l)) ) "\nPrincipal Moments: " (progn (setq l (mapcar 'rtos (vlax-get o 'principalmoments))) (strcat (car l) "," (cadr l)) ) ) ; d ) ;(close d)(setq l1 (strcat "Area: " (rtos (vlax-get o 'area) 2 4) " Sq In"))(setq l2 (strcat "Wt/Ft: " (rtos (* (vlax-get o 'area) 1.18) 2 2) " lbs"))(setq l3 (strcat "Perimeter: " (rtos (vlax-get o 'perimeter) 2 2) " In"))(setq l4 (strcat "Ix: " (cadr l)))(setq l5 (strcat "Iy: " (car l)))(princ l) ; Draw the Center of Gravity Point (command "_.circle" "_non" ip "0.125" "") (command "_.line" "_non" ip "@0.25
About 2% differences, is the shape double symmetric? If it's not (and you can see that next to Principal Moments, if directions are different than [1.00 0.00]) then you need another method to get the correct values. I know two methods:
1) First, run _massprop and collect the centroid coordinates; then set UCS to centroid. Run _massprop once again and compare Moments Of Inertia (and not Principal moments) with AISC manual.
2) Second method required to run _massprop once and no UCS settings:
- read area A
- read centroid from _massprop - (xg, yg)
- read Moments of Inertia - (Ix, Iy)
The moments around centroid an parallel to x and y axis:
Many thanks for these insightful replies. Fixo, I will certainly incoporate that method for mtext using \\ P. I knew there had to be a better way but many searches on the net proved that LISP and text are not that common of a thread.
Stephan MBR - I am using another lisp routine called stl.lsp. It's great for steel detailing, although the main reason I'm working on this project is for working with aluminum. I will eventually place a prompt in the code which asks the user whether the shape is steel or aluminum and it will calculate weight/foot and others based on that input. Stl.lsp draws up the profiles quite accurately, at least what I've been able to check. I have to turn the shape into a REGION but then I run MASSPROP and get lots of information which I'm cross-checking against the AISC manual. I'm sure something like SolidWorks does this automatically and with greater accuracy, but I don't have a license for SolidWorks and will not in the forseeable future.