Jump to content

Recommended Posts

Posted

Hello,

I need for a current project to list the coordinates of “extended” area of a drawing (that it, the entire drawed area in Model Space) from VBA (accessing AutoCAD via ActiveX automation from a stand-alone application). Due to the fact that the drawing is a very loaded one, parsing entities to gather coordinates and sorting it wasn’t a solution since it last too much.

So, my solution was to do a zoom / extend, create a view and list after the coordinates of his center and size; from this can calculate the coordinates of the bottom-left and top-right corners of view and therefore drawed area (of course, not necessarily accurate on one direction). Unfortunately the values listed as view features seem to don’t match the ones manually listed on screen.

 

 
Dim theAcadApp, CrDrawing As Object
Set theAcadApp = CreateObject("AutoCAD.Application")
Set CrDrawing = theAcadApp.Documents.Open("...ARandomFile...")
theAcadApp.ZoomExtents

Dim theExtendView As Object
Dim theCenter As Variant
Dim theCornerBL(1) As Double
Dim ViewWidth, ViewHeight As Double

Set theExtendView = CrDrawing.Views.Add("NewView01")
theCenter = theExtendView.Center
ViewWidth = theExtendView.Width
ViewHeight = theExtendView.Height

theCornerBL(0) = theCenter(0) - 0.5 * ViewWidth
theCornerBL(1) = theCenter(1) - 0.5 * ViewHeight

 

Does someone know what I’m doing wrong? Or there is another, better, solution to solve my issue?

Thank you!

 

Regards,

Mircea

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...