News:

Be sure your post is relevant to the current discussion.  Create a new topic within the appropriate board if you are unsure.

Main Menu

Finding Angle and Length of a Line

Started by relliott, December 18, 2010, 05:08:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

relliott

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?


cdsgraphics

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.

HTH
Take Care
Craig
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

relliott

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.