noyjoreb Posted May 16, 2010 Share Posted May 16, 2010 hi to all, i have a question... what lisp routine for computing the volume of closed polyline? example, i will get the area of a close polyline then by entering the thickness of depth, it will show a volume.. and put it on the table... any help is appreciated,... tnx Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 16, 2010 Share Posted May 16, 2010 In future please name your threads in a more appropriate manner so that they may found by the search utility. Quote Link to comment Share on other sites More sharing options...
Cad64 Posted May 16, 2010 Share Posted May 16, 2010 Thread renamed. You can Extrude your closed Polyline and then use the MASSPROP command to calculate volume. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 17, 2010 Share Posted May 17, 2010 Not sure if its what you want as I don't completely understand your request, but it was fun to write: (defun c:V2Cell ( / tables ent dep pt doc ) (vl-load-com) ;; Lee Mac ~ 17.05.10 (while (progn (cond ( (not (or tables (setq tables (ss->vla (ssget "_X" '((0 . "ACAD_TABLE"))) ) ) ) ) (princ "\n** No Tables in Drawing **") nil ) ( (not (or ent (setq ent (CurveifFoo (lambda ( x ) (vlax-property-available-p (vlax-ename->vla-object x) 'Area ) ) "\nSelect Object to Retrieve Volume: " ) ) ) ) nil ) ( (not (or dep (setq dep (getdist "\nSpecify Depth: ") ) ) ) nil ) ( (not (and (setq pt (getpoint "\nPick Cell for Volume: ") ) (TextinCell tables pt (strcat "%<\\AcExpr %<\\AcObjProp Object(%<\\_ObjId " (GetObjectID (vlax-ename->vla-object ent) (setq doc (cond ( doc ) ( (vla-get-ActiveDocument (vlax-get-acad-object) ) ) ) ) ) ">%).Area>% * " (vl-princ-to-string dep) " \\f \"%lu6%qf1\">%" ) ) ) ) (princ "\n** Cell Not Found **") ) ) ) ) (princ) ) (defun TextinCell ( tables pt str / data ) ;; Lee Mac ~ 17.05.10 (if (setq data (vl-some (function (lambda ( table ) (if (eq :vlax-true (vla-hittest table (vlax-3D-point (trans pt 1 0)) (vlax-3D-point (trans (getvar 'VIEWDIR) 1 0)) 'row 'col ) ) (list table row col) ) ) ) tables ) ) (not (apply (function vla-setText) (append data (list str)) ) ) ) ) (defun ss->vla ( ss ) (if ss ( (lambda ( i / e l ) (while (setq e (ssname ss (setq i (1+ i)))) (setq l (cons (vlax-ename->vla-object e) l ) ) ) l ) -1 ) ) ) (defun CurveifFoo ( foo str / sel ent ) ;; Lee Mac ~ 17.05.10 (while (progn (setq sel (entsel str)) (cond ( (vl-consp sel) (if (not (foo (setq ent (car sel)))) (princ "\n** Invalid Object Selected **") ) ) ) ) ) ent ) (defun GetObjectID ( obj doc ) ;; Lee Mac ~ 17.05.10 (if (eq "X64" (strcase (getenv "PROCESSOR_ARCHITECTURE") ) ) (vlax-invoke-method (vla-get-Utility doc) 'GetObjectIdString obj :vlax-false ) (itoa (vla-get-Objectid obj)) ) ) Quote Link to comment Share on other sites More sharing options...
oliver Posted November 13, 2010 Share Posted November 13, 2010 hi..Lee, Command: v2cell ** No Tables in Drawing ** Command: what does it mean.. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 13, 2010 Share Posted November 13, 2010 The function is designed to place the result of the calculation into a table cell - as per the OP's request. Quote Link to comment Share on other sites More sharing options...
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.