Jump to content

Recommended Posts

Posted

Hello,

 

I'm trying to obtain the bounding box of a block, to get the extents of the block.  

 

I've fallen back to Lee Mac's code, which can be found here.  I've drawn the obtained boxes in the image.

 image.png

 

As you can see, when the block is rotated the bounding box is very inaccurate - it is including the hypothetical intersection of the sides of the block!   Is there a way to ensure the box precisely envelops the block?  

 

Thank you!

Posted (edited)

http://www.lee-mac.com/minboundingbox.html

 

--edit

 

The higher the angular precision and the more objects you select the longer it takes to calculate.

I use (LM:minboundingbox sel 0.001) usually only takes a sec to calculate the box.

Edited by mhupp
Posted
11 minutes ago, mhupp said:

http://www.lee-mac.com/minboundingbox.html

 

--edit

 

The higher the pension and the more objects you select the longer it takes to calculate.

I use (LM:minboundingbox sel 0.001) usually only takes a sec to calculate the box.

 

Thank you for the quick reply.  

 

Unfortunately, that is not exactly what I am looking for.  I still want the bounding box to be parallel to the x/y axes of the drawing.  Additionally, I do not believe it is acceptable to use Lee Macs' code for commercial use.  

 

The goal is to align the object within a drawing to both the x and y axes regardless of rotation.  I want to calculate the offset utilizing the coordinates of the bounding box.  Is there a better way to do this?

Posted

Thank you for the recommendation @mhupp, however, where the bounding box of a rotated and/or (uniformly) scaled block reference is concerned, I would suggest using a method demonstrated by the functions I have shared here - this approach will calculate an accurate rectangular bounding box for block references at any (uniform) scale, rotation, and orientation, with negligible performance costs over the standard getboundingbox method.

Posted
16 hours ago, Lee Mac said:

Thank you for the recommendation @mhupp, however, where the bounding box of a rotated and/or (uniformly) scaled block reference is concerned, I would suggest using a method demonstrated by the functions I have shared here - this approach will calculate an accurate rectangular bounding box for block references at any (uniform) scale, rotation, and orientation, with negligible performance costs over the standard getboundingbox method.

Hi Lee Mac,

 

I have tried your function, but it draws a rotated bounding box.  I would like a bounding box aligned with the x and y axes, as the goal is to get any arbitrary shape to sit nicely in a corner (i.e. constrained to two lines, one vertical, one horizontal).  I believe bounding boxes would be the optimal method to do so.  I would be curious to hear your input, as you are so experienced with autolisp.  

 

Additionally, this code is for internal commercial use.  Will it be an issue to implement your code?

 

Thank you!

Posted

its finding the bounding box. from there you need to

calculate the longest side

calculate the angle

rotate block

Posted (edited)

If you insert the block at say 0,0 with 1 1 0 then do a bounding box (entlast) it will return the size of the block aligned to X & Y so can compare to another insert and get current scale apply to the min max from the bounding box, then just erase the dummy block insert. This will ignore say rotation but it sounds like that is ok.

Edited by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...