ayman_48 Posted April 19, 2012 Posted April 19, 2012 hi guys is there lisp routines can calculate total area of 3d solid box Quote
MSasu Posted April 19, 2012 Posted April 19, 2012 The built-in AREA command with Object option will give you the area of 3D solids. Quote
Tharwat Posted April 19, 2012 Posted April 19, 2012 maybe .... (defun c:Test (/ val ss i sn) (if (setq val 0 ss (ssget '((0 . "3DSOLID"))) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (command "_.area" "" (entlast)) (setq val (+ (getvar 'area) val)) ) ) (if (not (zerop val)) (print val) ) (princ) ) Quote
ayman_48 Posted April 19, 2012 Author Posted April 19, 2012 the built-in area command with object option will give you the area of 3d solids. than's for quick reply but i need to choose multiple object Quote
ayman_48 Posted April 19, 2012 Author Posted April 19, 2012 maybe .... (defun c:test (/ val ss i sn) (if (setq val 0 ss (ssget '((0 . "3dsolid"))) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (command "_.area" "" (entlast)) (setq val (+ (getvar 'area) val)) ) ) (if (not (zerop val)) (print val) ) (princ) ) thank's very much this working good Quote
marko_ribar Posted April 19, 2012 Posted April 19, 2012 I think it's not working at all so good... : (defun c:Test (/ val ss i sn) (if (setq val 0 ss (ssget '((0 . "3DSOLID"))) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) [color=red](command "_.area" "o" sn)[/color] (setq val (+ (getvar 'area) val)) ) ) (if (not (zerop val)) (print val) ) (princ) ) M.R. Quote
Tharwat Posted April 19, 2012 Posted April 19, 2012 thank's very much this working good You're welcome . But the modification by marko is correct , so please use the one he modified This one Thank you marko for your modifications Thanks 1 Quote
ayman_48 Posted April 19, 2012 Author Posted April 19, 2012 thanks makro for modification also thanks to tharwat Quote
pBe Posted April 19, 2012 Posted April 19, 2012 A single call to "Area" command would be enough (defun c:Test2 (/ ss i) (if (setq ss (ssget '((0 . "3DSOLID")))) (progn (command "_.area" "_Add" "_O") (repeat (setq i (sslength ss)) (command (ssname ss (setq i (1- i)))) ) (command "" "") (print (getvar 'Area)) ) ) (princ) ) Quote
cadcondesign1 Posted February 13, 2019 Posted February 13, 2019 On 4/19/2012 at 4:10 AM, Tharwat said: You're welcome . But the modification by marko is correct , so please use the one he modified This one Thank you marko for your modifications Thanks any way to export this to excel? 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.