Skip to main content
1-Visitor
February 1, 2010
Question

How do you find the extents of a drawing?

  • February 1, 2010
  • 1 reply
  • 5881 views
When our drawings are converted to CGM's and brought into Word, the text at the top is often cut off slightly. We get round it by drawing a no line box round the drawing, slightly bigger than the geometry. I want to do a little macro to do this automatically, but I do not know how to find the points required. I need bottom left and top right of the geometry of the drawing. How do I retrieve these points?

    1 reply

    12-Amethyst
    February 2, 2010
    I've attached two macros. The first is called Find_Extent. At the start of the macro you need to have an object selected. If you need to determine the extent of multiple objects, group them at the start and then ungroup them at the end. The second creates a no line box within the frame. It could be adjusted to work with an object. Note that in either case, you may want to add an adjustment to the text measurement as IsoDraw adds some whitespace at the bottom to allow for text types. So, basically take the Compare_Bottom variable and ADD .5 to it.
    TimSharp1-VisitorAuthor
    1-Visitor
    February 3, 2010
    Thanks Trevor These will be very useful - I actually started trying to use something similar that I think you posted in another thread, but hoped there was an easier way to find the extents of a drawing. The problem is that if the macro groups the items on the drawing, all the layer detail will be lost. I'm wondering if there is a way of checking every element on the drawing regardless of grouping and getting the extents? I was using select all and trying to do select next element, looping through, but I find the macro language difficult to follow and can't yet get it to work. I think if necessary, we could run this macro just at the time of creating the CGM file and make sure the drawing is never saved down again afterwards, thus preserving the layer structure - there are bound to be mistakes though!
    12-Amethyst
    February 3, 2010
    Here are a couple different approaches to your problem. 1) You could do a simple workaround that I've had to implement on our side for various issues with 7.0.
    60f289931a
    This basically saves the file, groups everything, finds the extent, closes the file without saving, and then reopens the version prior to the original macro. It's a dirty way of doing it, but it works. 2) You can loop through each object and basically have a set of variables that represent top/bottom/left/right. Each time you check the extent of an object you could compare the extent against these variables. Note that this could take quite a while depending on complexity of the file. Question: Why are you attempting to bring the CGM into Word?