TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
All posts discussing pricing or where to buy TurboCAD will be deleted.

Coding for relative coordinates in TCad 19.2
Read 1641 times
* July 09, 2013, 08:21:05 AM
Hey all,

Noob coder here, apologies in advance if I have my thinking or terminology bass-ackwards.  ;D

I'm drudging my way through the SDK and attempting my first custom tool for Tcad v19.  In all the examples I've studied and information discovered in the SDK, when drawing an object using code (line, arc, poly... etc) it appears there is only the option to input absolute coordinates. The samples are very informative BTW, great job Kevan and Co.

For example: If the code is drawing a multiline it is told to start at (0,0,0) for 1st vertex, move to (1,0,0) for the second vertex, (1,1,0) for the third, and so on, until the code tells it to end/finish/close.

I'm trying to build a tool that will begin drawing the multiline from a mouse click (which I found in this thread: Detect Mouse Clicks ) and use relative coordinates to draw the shape. Meaning the first vertex is at MouseClick X,Y,Z, second vertex is at 1 inch 0 degrees away, and third vertex is 1 inch 90 degrees from second vertex.

Is this possible? If so, hints or examples of what objects or functions in the SDK I need to read up on would be much appreciated.

Cheers!

Logged
Ben Stegemoller


* July 09, 2013, 11:28:39 AM
#1
Hello Ben
my solution is written in VB6. Maybe it helps.
Change the mouseclick into worldcoordinate. Then add what you want to add.

--------------------------------------------
VB6:
Set app = IMSIGX.Application
Set vi = app.ActiveDrawing.ActiveView
Set vvi = app.ActiveDrawing.ActiveView
vi.GetMouseClick xclick, yclick
vi.ViewToWorld xclick, yclick, 0, xworld, yworld, zworld
---------------------------------------------

regards
Bernd

Logged


* July 10, 2013, 05:19:23 AM
#2
Thank you very much, Bernd. I'll give the proposed solution a shot and let you know if it worked.

Logged
Ben Stegemoller