Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

maximum dimensions from 3d objects

10 REPLIES 10
Reply
Message 1 of 11
mitoborecek
520 Views, 10 Replies

maximum dimensions from 3d objects

Hi

how can I get maximum dimensions from 3D objects to table in layout and use its for division, multiplication, addition...?

10 REPLIES 10
Message 2 of 11
Kent1Cooper
in reply to: mitoborecek

I have this routine:

(defun C:BB (/ minpt maxpt); Bounding Box of selected object
  (vla-getboundingbox (vlax-ename->vla-object (car (entsel))) 'minpt 'maxpt)
  (setq
    box (list (vlax-safearray->list minpt) (vlax-safearray->list maxpt))
    delta (mapcar '- (cadr box) (car box))
  ); setq
  (prompt
    (strcat
      "\nBounding Box [in 'box' variable]: " (vl-princ-to-string box) ";"
      "\nExtents: X direction " (rtos (car delta))
      "; Y direction " (rtos (cadr delta))
      "; Z direction " (rtos (caddr delta)) "."
    ); strcat
  ); prompt
  (princ)
)

That leaves you with the maximum dimensions [the extents of the bounding box] in the delta variable.  You can extract them from that in the same way that the (prompt) function does, minus the (rtos) wrappers, for use in your calculations.  [I leave it to you to deal with putting them in a Table if needed.]

Kent Cooper, AIA
Message 3 of 11
mitoborecek
in reply to: Kent1Cooper

but some 3d objects are turned about 45°.

Will it work?

Message 4 of 11
Kent1Cooper
in reply to: mitoborecek


@mitoborecek wrote:

but some 3d objects are turned about 45°.  Will it work?


Unfortunately, it will give you only the overall extents in the directions of the XYZ axes.  If you have, for example, a rectangular prism [such as the BOX command makes] rotated in the XY plane at your 45° [or any other non-orthogonal angle], and you want to know the length of a rotated edge, I don't know of any way to get that, except with a DIST command and Osnapping to corners.  For some things, that kind of dimension can be calculated from their entity data in one way or another [the length of a Line, for example, at whatever angle including into the 3rd dimension].  But for 3D Solids, entity data is completely inscrutable -- there's no way to extract things like XYZ locations of corners [when there even are any discernible specific locations like corners] to calculate distances from, etc.  For an orthogonally oriented box you can get them, not because you have access to coordinate information about the corners as defining the 3D Solid, but only because in that case they happen to coincide with the bounding box.

Kent Cooper, AIA
Message 5 of 11
mitoborecek
in reply to: Kent1Cooper

OK, Thank You for Your time and explanation

Message 6 of 11
mitoborecek
in reply to: Kent1Cooper

I found that rectangle have information about area, if I add for every my 3d object rectangle, is there any way to export/add areas informations of all polygons at once to table?

Message 7 of 11
Kent1Cooper
in reply to: mitoborecek


@mitoborecek wrote:

. if I add for every my 3d object rectangle, is there any way to export/add surface of all polygons at once?


I am finding that in the (getpropertyvalue) world, 3D Solids have an "Area" property, which seems in quickie trial to accurately show their overall surface area [not, for example, their area in plan view, or other possibility].  Try putting this in at the Command: line:

(getpropertyvalue (car (entsel "\nSelect a 3D Solid: ")) "Area")

So that could be added up from multiple Solids by applying to their entity names pulled from a selection set.

 

But it doesn't help you with the dimensions issue.

Kent Cooper, AIA
Message 8 of 11
leeminardi
in reply to: mitoborecek

If you are trying to determine the minimum diameter sphere (i.e., the maximum dimension) of a 3D object then Ritter's bounding sphere algorithm may give good results. Note that point "z" is the furthest distance from point y other than point x.

 

lee.minardi
Message 9 of 11
mitoborecek
in reply to: mitoborecek

here is example

white are 3d objects

red are polygons/rectangels here I can get areas

 

left and right part need area like 1510x1000 - Therefore red rectagel is bigger then 3d part

 

kucera7m_0-1708967506157.png

 

Message 10 of 11
Kent1Cooper
in reply to: mitoborecek


@mitoborecek wrote:

here is example....


[In that case, with something built of multiple thin wall and roof pieces, if you want something like the area of that outside wall [the red rectangle minus the triangle cut off by the roof], I assume the (getpropertyvalue {entity} "Area") approach is not going to do it for you.  It gets the entire surface area of a 3D Solid, including front and back and all edges of parts such as what your image looks like it's made of.  But Exploding it and looking at the areas of resulting Regions should work in that case.]

Kent Cooper, AIA
Message 11 of 11
mitoborecek
in reply to: Kent1Cooper

no, no 

I need area of red rectangle because part without triangel have to made from rectange, so i need count rectangle

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report