densan Posted December 19, 2019 Posted December 19, 2019 (edited) Hello CAD Tutor Forum, in a moment of overconfidence. I attempted to create some code to list the volumes with the corresponding top max elevation for each 3D solid and export it to a text file. I am struggling putting the program together and would like some guidance into achieving my goal. Also, I included a sample file for testing. Any help would be much appreciated. Thank you, Export sample: Top Elevation Volume ------------------------------------------------------------------- 6487.00 105787.97 6501.80 498281.83 6516.60 894156.89 ;; ;; List volume and top elevation of 3D Solids and ;; export results to an external text file ;; ;; (vl-load-com) (defun c:3dvol ( / ) ;; Afralisp.net, Properties & Methods - Part 3 by Kenny Ramage (setq ent (entsel)) (setq obj (vlax-Ename->Vla-Object (car ent))) ;; Programming 3D Solids, Meshes & Surfaces by Reinaldo Togores (defun ax-props (obj / props value pmin pmax bbox) (setq props (vl-remove-if 'null (mapcar '(lambda (prop) (if (vlax-property-available-p obj prop) (progn (setq value (vl-catch-all-apply 'vlax-get-property (list obj prop) ) ) (if (not (vl-catch-all-error-p value)) (if (= (type value) 'variant) (cond ((>= (vlax-variant-type value) 8192) = (cons prop (vlax-safearray->list (vlax-variant-value value) ) ) ) ((t (cons prop (vlax-variant-value value)))) ) (cons prop value) ) ) ) ) ) '("Centroid" "MomentOfInertia" "PrincipalDirections" "PrincipalMoments" "ProductOfInertia" "RadiiOfGyration" "Volume" "Area" "Circumference" "Radius" "Center" "Normal" "Perimeter" "Coordinates" "FaceCount" "VertexCount" "Smoothness" "Elevation" "ArcLength" "EndAngle" "EndPoint" "StartAngle" "StartPoint" "TotalAngle" "Angle" "Delta" "Thickness" "BasePoint" "DirectionVector" "SecondPoint" "BaseRadius" "Height" "Position" "TopRadius" "TotalLength" "TurnHeight" "Turns" "TurnSlope" "Twist" "Direction" "TaperAngle" "EndDraftAngle" "EndDraftMagnitude" "NumCrossSections" "NumGuidePaths" "StartDraftAngle" "StartDraftMagnitude" "SurfaceNormals" "SurfaceType" "RevolutionAngle" "AxisPosition" "AxisDirection" "ProfileRotation" "Bank" "Length" "ProfileRotation" "scale" ) ) ) ) ;; List bounding box limits (setq bbox (vl-catch-all-apply 'vla-GetBoundingBox (list obj 'pmin 'pmax)) ) (if (vl-catch-all-error-p bbox) props (setq props (cons (list "BoundingBox" (vlax-safearray->list pmin) (vlax-safearray->list pmax) ) props ) ) ) ) ;; Export volumes to text file ;(setq idk (getfiled "I stink at LISP" "" "txt" 1)) (princ) ) 3D_Stockpile_Sample.dwg Edited December 19, 2019 by densan Missing code and sample file Quote
BIGAL Posted December 20, 2019 Posted December 20, 2019 The quick and 30 second answer is CIV3D or say Briscad+ Civil Site Design. Fill vol is Cut Vol is. It really is a civil software day to day problem. Continous stock piles ie build/ remove /build again, really need the base surface to kept for ever, if you want to improve the volume accuracy. A hole getting bigger is easier. It would for me using a civil approach would be to build surfaces from original point & string data. I am sure others that play with solids may be able to help. Maybe project surface yellow to a known flat level get volume, add all the solids get volume, diff is volume. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.