Hello Guest it is March 28, 2024, 10:32:08 AM

Author Topic: script Coordinate system rotation  (Read 3019 times)

0 Members and 1 Guest are viewing this topic.

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) & "°")

Offline Olavi

*
  •  13 13
    • View Profile
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
Re: script Coordinate system rotation
« Reply #2 on: June 21, 2018, 09:36:07 AM »
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