Skip to main content
Solved

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

  • December 4, 2017
  • 2 replies
  • 34 views

lazarlubomir
Contributor
Forum|alt.badge.img+10

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

daveatsafe
Safer
Forum|alt.badge.img+20
  • 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+10
  • Author
  • Contributor
  • December 8, 2017

Thank You so much @DaveAtSafe, it works!