Welcome, Guest. Please login or register.
May 16, 2012, 04:18:22 pm
Home Help Search Login Register
News: The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software’s can be used with TurboCAD.


+  TurboCAD Forums
|-+  SDK Corner
| |-+  SDK Tips and Tricks
| | |-+  Getting the X,Y World Coordinates of the Upper Right hand Corner of a Drawing
« previous next »
Pages: [1] Go Down Print
Author Topic: Getting the X,Y World Coordinates of the Upper Right hand Corner of a Drawing  (Read 2469 times)
cwcookman
Newbie
*
Posts: 47


« on: July 31, 2009, 05:36:13 pm »

Does anyone know how to get the upper right hand coordinates of a TurboCad drawing using either VB or VBA?

I know how to Set up Turcocad objects and reference their properties.  What I can't figure out is what properties of what objects I need to access to obtain the coordinates of the upper right hand corner of the drawing.

Any help would be appreciated.
Logged
cwcookman
Newbie
*
Posts: 47


« Reply #1 on: August 01, 2009, 12:56:24 pm »

I was able to figure it out and thought I would post the solution.

Run this in an Excel VBA module with a reference set to TurboCad v4.1 programmable objects.

Sub Drawing_Extents() 'Gets the full drawing extents in world coordinates
'Declare variables
   Dim TurboCad_Application As IMSIGX.Application
   Dim Bounding_Box As IMSIGX.BoundingBox
   Dim Drawing_Graphics As IMSIGX.Graphics
'Create a reference to the current instance of TurboCad
      Set TurboCad_Application = GetObject(, "TurboCAD.Application")
'Create a reference to the Graphics Collection of the Active Drawing
      Set Drawing_Graphics = TC_app.ActiveDrawing.Graphics
'Create a reference to the Bounding Box that encompasses theGraphics Collection of the 'Active Drawing
      Set Bounding_Box = Drawing_Graphics.CalcBoundingBox
'Print the bounding box limits to the debug window
      Debug.Print "min: " & Bounding_Box.Min.X & ", " & Bounding_Box.Min.Y & ", " &_                        Bounding_Box.Min.Z
      Debug.Print "max: " & Bounding_Box.Max.X & ", " & Bounding_Box.Max.Y & ", " &_                       Bounding_Box.Max.Z
'Set all references to nothing
      Set Bounding_Box = Nothing
      Set Drawing_Graphics = Nothing
      Set TurboCad_Application = Nothing
End Sub
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.052 seconds with 17 queries.