Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: birillo1959 on June 17, 2018, 01:54:20 PM
-
Good morning
I found on the web this "coordinate system rotation script" works very well, the
change I would like to do is this:
I have a webcam to find the tool center and from the tool center to the web center are
X = -50.050
Y = -76.250
is it possible to insert them at the end of the script?
since VB is zero every help is welcome!
'coordinate system rotation
dx = GetoemDRO( 800 )
dy = GetoemDRO( 801 )
Pi = atn( 1 ) * 4
If Abs( dx ) > Abs( dy ) Then ' horizontal, near X axis
angle = atn( dy / dx )
Else ' vertical, near Y axis
angle = atn( - dx / dy )
End If
angle = angle / Pi * 180
ret = MachMsg("A = " & roun(angle) & "° - set?", "Axis Rotation", 4)
If ret = 6 Then ' Yes
SetOEMDRO(118, angle) 'Code("G68X0Y0R" & angle)
dooembutton (1017) 'go to zero
dooembutton (160) ' regen toolpath
End If
Message("A = " & roun(angle) & "°")
-
Do you want these coordinates are displayed as message or you want some moves at the end of script?
If you want a move to the location at x50.05 y76.25 then you can do something like this:
While IsMoving()
Wend
Code "G0 X50.05 Y76.25"
If you add this part to the end of your script then after you get Message("A = " & roun(angle) & "°") from your script and all moves are done your cnc goes to the given location. Z is not moving.
I am newbie, so dont expect truth. :S
-
OK thanks for the reply
I would like it to end up at 0 dro
I try to explain myself better
I poll with the web
I find the corner
and the machine is positioned at the tool center (from the web to the tool center X -50.050 Y -76.250)
I tried as recommended gives me problems, I repeat VB I understand little
regards