Author Topic: Properties of a Solid  (Read 3075 times)

0 Members and 1 Guest are viewing this topic.

SPDCad

  • Bull Frog
  • Posts: 453
Properties of a Solid
« on: January 28, 2005, 09:01:18 AM »
I am looking for a quick way to extract the properties of a solid.
More particular the length, width and height.

I have done this once before in VLisp, but my code is at home. :(
Propbably buried within one of my many lisp backup CD's.

Any help would be appreciated. I got to do some major solid editing and
I have a tight deadline.
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs

dannb

  • Guest
Properties of a Solid
« Reply #1 on: January 31, 2005, 08:28:52 AM »
Not tested but, Is this what you are looking for?

Code: [Select]

(vlax-invoke-method (objsel "\nSelect Solid: ") 'getboundingbox 'pt1 'pt2)
(setq tem(mapcar '- (vlax-safearray->list pt1) (vlax-safearray->list pt2)))
(princ (strcat "\nLength " (rtos (abs(car tem)))))
(princ (strcat "\nWidth " (rtos (abs(cadr tem)))))
(princ (strcat "\nHeight " (rtos (abs(caddr tem)))))


;The following gets and returns a selected object in activex format
  ;******************************************************************

(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select Object: "))
  (setq ent (car (entsel $prompt)))
  (if (/= ent nil)
    (setq obj (vlax-ename->vla-object ent))
    (princ "No Object Selected")
  )
  obj ;returns result for use in calling program
)

hendie

  • Guest
Properties of a Solid
« Reply #2 on: January 31, 2005, 09:39:38 AM »
I think you'll find that a 3d solids properties are encoded and not available through either Lisp or VBA

that's not taking into account "properties" like Centroid, radii of gyration etc which can be accessed.
The other stuff like whether it's a cylinder or box or cone aren't available, neither are props like height, length, width. You have to use bounding boxes, and ucs's and a lot of match to calculate the size of a solid

SPDCad

  • Bull Frog
  • Posts: 453
Properties of a Solid
« Reply #3 on: January 31, 2005, 04:49:05 PM »
Thank you Dannd for the code.
It was what I was looking for.
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs