Hello Guest it is December 08, 2019, 06:29:12 AM

### Author Topic: script Coordinate system rotation  (Read 1837 times)

0 Members and 1 Guest are viewing this topic.

#### birillo1959

• 82
##### script Coordinate system rotation
« 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) & "°")

#### Olavi

• 7
##### Re: script Coordinate system rotation
« Reply #1 on: June 20, 2018, 01:24:32 AM »
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

#### birillo1959

• 82
##### Re: script Coordinate system rotation
« Reply #2 on: June 21, 2018, 09:36:07 AM »