Skip to main content
Solved

How to fit DWG block to bounding box of exported data?


lazarlubomir
Contributor
Forum|alt.badge.img+7

Hello everybody!

I try to solve one big problem... I work with workspace which export some spatial data and all I need to do is to create envelope around exported data. BUT, I need the envelope which is composed by predefined AUTOCAD BLOCK in separate DWG drawing (e.g. frame or drawing stamp; block is everytime centered into 0,0 coordinates)... To better imagination I attached picture, where I decribed my aim.

I would appreciate every help.

Thank You so much!

Lubo

Best answer by daveatsafe

Hi @lazarlubomir,

You can use the BoundingBoxAccumulator on a copy of your data to get the bounding rectangle, then use its location and size to determine the scale and placement point of the block.

For example, to get the placement point:

placement x = (xmin + xmax) / 2
placement y = (ymin + ymax) / 2

As an alternative to placing the frame block in the Model space, you could put in a Paper Space instead, and automatically create a viewport from your data. Please see the following article for more details:

Working with AutoCAD Layouts

View original
Did this help you find an answer to your question?

2 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • Best Answer
  • December 4, 2017

Hi @lazarlubomir,

You can use the BoundingBoxAccumulator on a copy of your data to get the bounding rectangle, then use its location and size to determine the scale and placement point of the block.

For example, to get the placement point:

placement x = (xmin + xmax) / 2
placement y = (ymin + ymax) / 2

As an alternative to placing the frame block in the Model space, you could put in a Paper Space instead, and automatically create a viewport from your data. Please see the following article for more details:

Working with AutoCAD Layouts


lazarlubomir
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • December 8, 2017

Thank You so much @DaveAtSafe, it works!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings