Search the Community
Showing results for tags 'massprop'.
-
Add Sphere to Centroid of 3D Solids via LISP
parkerdepriest posted a topic in AutoLISP, Visual LISP & DCL
Hi everyone, here's what I'm trying to do: I have a lot of curved bridge girders, and I am using MASSPROP to find the centroid location, and then manually typing in the centroid coordinates as the center point of a sphere. Awhile back, I found this code that is supposed to do precisely that, but these days it is adding a sphere at a corner point, not the centroid. Any help would be greatly appreciated! (defun c:masscent(/ sset1 slng1 cnt1 cnt2 clist sent1 xlist ylist zlist xpt ypt zpt cpt rad vol1 vlist ucp) (vl-cmdf "._undo" "_end") (vl-cmdf "._undo" "_group") (vl-cmdf "._ucs" "_w") (prompt "\nSelect solids for centroid location. ") (setq sset1 (ssget) slng1 (sslength sset1) cnt1 0 cnt2 0 clist nil ) (repeat slng1 (setq sent1 (vlax-ename->vla-object (ssname sset1 cnt2))) (if (vlax-property-available-p sent1 "Centroid") (progn (setq clist (append clist (list (vlax-get sent1 "Centroid")))) (setq vlist (append vlist (list (vlax-get sent1 "Volume")))) (setq cnt1 (1+ cnt1)) ) ) (Setq cnt2 (1+ cnt2)) ) (setq xlist (mapcar 'car clist)) (setq xpt (car xlist)) (setq ylist (mapcar 'cadr clist)) (setq ypt (car ylist)) (setq zlist (mapcar 'caddr clist)) (Setq zpt (car zlist)) (setq vol1 (car vlist)) (repeat (fix (- (vl-list-length clist) 1)) (setq xlist (cdr xlist)) (setq xpt (+ xpt (car xlist))) (setq ylist (cdr ylist)) (setq ypt (+ ypt (car ylist))) (setq zlist (cdr zlist)) (setq zpt (+ zpt (car zlist))) (setq vlist (cdr vlist)) (Setq vol1 (+ vol1 (car vlist))) ) (setq cpt (list xpt ypt zpt)) (setq cpt (mapcar '(lambda (x) (/ x cnt1)) cpt)) (setq vol1 (strcat (rtos vol1 2 5) " cu. in.")) (setq rad (getreal "\nEnter radius: ")) (vl-cmdf "._sphere" cpt rad) (vl-cmdf "._ucs" "_p") (vl-cmdf "._undo" "_end") (princ "\n") (princ "Centroid point: ") (princ cpt) (princ (strcat " - Volume: " vol1)) (princ) ) -
I have a simple 3D cuboid that I used rectangle array on, 2 rows of 5 elements each. Anyways I then tried to use massprop on the 10 objects to get the combined volume. But I get: "No solids or regions selected." whenever I select the arrayed objects. To create the initial object I offset an existing objects square face using "Offset Edge". Then I arrayed the resulting offsetted square shape. I then "Extruded" the shapes by editing the source. Anyone have any idea what the problem is, or how to reach a solution?
-
With command massprop I can get many interesting data about 3d object, but where can I set material that my object is made of. Lets say I need to calculate volume and mass of my object which is made of aluminium, what are my options?