TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

When replying to a specific statement be sure to quote the previous post.

Finding Angle and Length of a Line
Read 6416 times
* December 18, 2010, 05:08:48 AM
If I draw a line using TurboCAD and then select the line, the Metrics section of the Selection Info palette shows me the Length and Angle of the selected line.  Is there a way to capture this information from TurboCAD from within a VBA macro running in Excel or do I have to calculate the information myself from the line's vertices?


December 18, 2010, 05:55:23 PM
It depends on the version
If you are using one w/ the macro recorder,
record a macro with mouse click not checked nor the other one.
-draw a line of any length and angle on the visible screen
do not zoom in(as this can add copious amounts of extraneous code related to the view object.
-switch to the selection info palette
under the Metrics node where you see the length and angle property -
-change each field slightly and press enter
-switch back to the Macro recorder to view the code

gxChild.Properties("%M_Angle") = radians
gxChild.Properties("%M_Length") = current units

All available object extended properties that show up under Metrics node that do not have the +sign beside them can be accessed this way
and they also make good autoFields in the database, though some of the extra prefix characters need to be removed and the underscores may vanish after closing.

Sure wish that I had more time to code, I get goose bumps just talking about it.


Take Care
Using TurboCAD v18.2; Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz;<BR>Win 7 ProSp1; 6GB DDR3 1333MHz RAM; EVGA GeForce GTX 460 1GB
DeviantArt Gallery @ http://crag-dolomite.deviantart.com/gallery
TurboCAD Animators @ http://www.vimeo.com/channelTCAnim

* December 20, 2010, 08:51:14 PM
Excellent!  I am using TurboCAD Professional v 17.2 and tried to use the macro recorder when I first started my program to show me how to draw a line but the resulting code didn't seem very clear and didn't correlate very well with the SDK documentation.   I was able to use your macro trick to see the M_Angle and M_Length properties.  I had already created a subroutine to show the properties of an object but when I reviewed the results for a line I somehow missed the M_ properties.  I see them now.  Thank you for your help.