News:

Interested in some really terrific mobile apps? Visit www.turboapps.com for details.

Main Menu

How do you select a point with Ruby?

Started by nikkipollard, January 26, 2021, 07:03:05 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

nikkipollard

It doesn't seem to understand the Xclick Yclick from the example code in the SDK

Dim xClick#, yClick#

Set ActDr = ActiveDrawing
Set Vi = ActDr.Views(0)
Vi.GetMouseClick xClick, yClick
Set PRes = Vi.PickPoint(xClick, yClick)
PiCount = PRes.Count


Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Henry Hubich

Nikki, have you found a solution?

Henry H

nikkipollard

Quote from: Henry Hubich on May 27, 2021, 07:01:45 PM
Nikki, have you found a solution?

Henry H
I gave up on Ruby but
Marek's version of the time stamp uses this syntax

xv=tcView.GetMouseClick
    xp=tcView.ViewToWorld(xv[0],xv[1],0)

tx=xp[0]
ty=xp[1]

Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Henry Hubich

Thanks, Nikki. I did see that but I can't quite understand it. And it seems to be written specifically for that TCad application, while I was hoping for something more general--if that's a reasonable hope.

Henry H

nikkipollard

#4
my understanding - I dont know if it will help.
getMouseClick is a method in the view class.
step 1 define the view- generally the active view
tcview = tcdraw.ActiveView
step  2 get a mouse click - returns an array x & y coordinates - relative to the view
point = tcview.GetMouseClick
step 3
convert the coordinates to world coordinates using another method in the view class/
- this returns an array with x y and z coordinates -z will be 0 because it's relative to the 2D view.
worldPoint = tcview.ViewToWorld(point(0),Point(1),0)

step 4
x y and z coordinates
xc = worldPoint(0)
yc = worldpoint(1)





Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Henry Hubich

That does indeed help, Nikki. Thanks again.

Henry H