Full Version: Measure Distance Macro

From: Carl (CSEWELL) [#1]
 7 Sep 2006
To: ALL

All;

The attached macro (MeasureDistance) simply reports the distance between two user clicked points. Maybe there's an easier way, but to find distances, I've always resorted to the dimension tools. I ran across the basic code for reporting mouse positions and took a few minutes to adapt the code to suite my needs.

To use this macro, copy the GMS file to the GMS folder in the installation folder for CorelDraw (see earlier posts in this folder for more detailed directions). Start CorelDraw, run the macro, and click on the drawing space. The first click will be the reference point (Pt1). After a second click, a message box will show the point positions (X, Y, of point 1 and point 2), the delta X and Y values, and the distance between those two points. If you click on Okay in the message box you can click another point which will reference the previous point (point #2). If you're done, click on Cancel. Oh, the macro will timeout after 10 seconds. Why? Because.......

I've rounded the numbers to 4 decimal places which is fixed in the code. The macro is also hardcoded to accept the current snap settings, ie it will snap to grid, guidelines, or whatever is set when the macro starts. If you don't want to use snap settings, you'll have to turn them off.

The code is rough, un-debugged, only tried in CorelDraw version 12, and open for viewing and improvements. I'd like to see this expanded to report distances between objects, maybe the closest points, centers, or whatever else, if anyone would like to take those tasks on.

Let me know if you find this one useful. If it's not useful, I'll remove it.

Fortunately, I've been much too busy to create or post any others!

EDITED: 7 Sep 2006 by CSEWELL


Back to thread list | Login

© 2024 Project Beehive Forum