At 09:03 PM 6/8/2007, you wrote:
>Scaling g-code is easy.  Rotating g-code is easy.
>But I'm not certain that it's the job of the interpreter to do such things.
True but the interpreter does need the commands to control the a rotation.
There are two very different types of rotation, first is programmed 
rotation G68,G69 the second is parameter based rotation both have their uses.

Programmed rotation is the type of thing you use to make bolt hole circles, 
or within a sub that is run to cut some feature at many places on a part 
and some or all of those places need to have that feature orientated 
differently.  It is all done under control of the G code program, and is 
not in my experience active under manual control.

Parameter based rotation is what you do when you can't align a fixture to 
the physical machine axis, say there is some fixture on the machine that 
you do not want to remove and the only way the new job will fit is if it is 
turned just a bit this way.  You go into the machine parameters and setup 
the rotation and the G code program has nothing to say about it.  In effect 
you create a virtual machine coordinate system just like in Hex 
machines.  How to handle homing g28 g53 type commands is then the question.


>Sometimes times you may only want to scale in X,Y but not touch Z.
>In addition, scaling on the machine could run into problems with
>interference with
>existing workpiece jigging.

Not only that but there are time when you want to set different scales to 
X, and Y.  Program a 1" diameter circle then set the right X and Y scale 
factors origined on the center of the circle and you can make nice 
elliptical shapes of any needed size.

Interference with existing fixturing is always a problem with new setups 
but having more options available like scaling and rotation only makes it 
easier to make any new fixturing work with existing stuff.



Over the weekend I worked up a little work around for programmed rotation, 
its not a replacement for g69 g68 but it seems to work well enough to be 
useful.  It is a sub program that you call in place of G0, G1, G2, G3 
commands, the first parameter sets which G code is run, if that code is -1 
then no G code is run but the rotation is calculated and the results placed 
in variables #502 - #506.
The main program is just a little demo that uses all the g commands.






O9000 Sub
(Make a move in a rotated coordinate system)
(Also return rotated X,Y,I,J values)
(Valid G codes 0 or 1 or 2 or 3 or -1)
(  If -1 the G code will not be executed)
(  but the rotated values will be put in)
(  parameters #501 - #506)
(Works for G17 plane only)
()
(Parameters passed in)
(#1     G code)
(#2     X Position)
(#3     Y Position)
(#4     Z Position)
(#5     I Distance)
(#6     J Distance)
(#7     F Feed rate)
(#8     Rotation angle)
(#9     X center of rotation relative to current work offset)
(#10    Y center of rotation relative to current work offset)
()
(Other local variables used)
(#30    New angle)
(#29    X side)
(#28    Y side)
(#27    H side)
(#11 --- #26 not used)
()
(Global variables return values)
(#501   X rotated)
(#502   Y rotated)
(#503   I rotated)
(#504   J rotated)
(#505   X current)
(#506   Y current)
(#507   Z current)
()
#8 = [#8 MOD 360]
()
(XY)
#29 = [#2 - #9]
#28 = [#3 - #10]
#30 = ATAN[#28] / [#29]
#27 = SQRT[[#29**2 + #28**2]]
#30 = [#30 + #8]
#501 = [[#27 * COS[#30]] + #9]
#502 = [[#27 * SIN[#30]] + #10]
(IJ)
#30 = ATAN[#6] / [#5]
#27 = SQRT[[#5**2 + #6**2]]
#30 = [#30 + #8]
#503 = [#27 * COS[#30]]
#504 = [#27 * SIN[#30]]
()
(Make move)
O1 IF [#1 EQ 1]
  G#1 X#501 Y#502 Z#4 F#7
O1 ELSE
  O2 IF [[#1 EQ 2] OR [#1 EQ 3]]
   G#1 X#501 Y#502 Z#4 I#503 J#504 F#7
  O2 ELSE
   O3 IF [#1 EQ 0]
    G#1 X#501 Y#502 Z#4 F#7
   O3 ELSE
    O4 IF [#1 EQ -1]
     (Do nothing)
    O4 ELSE
     (Invalid G code do nothing)
    O4 ENDIF
   O3 ENDIF
  O2 ENDIF
O1 ENDIF
(Update current position)
(The current position is only needed by G2 and G3 moves)
(Assumes that last move was made by this sub)
(with the same rotation angle)
#505 = #2   (Update current X)
#506 = #3   (Update current Y)
#507 = #4   (Update current Z)
O9000 EndSub




(****************************************)
(**            Main Program            **)
(****************************************)
(Test rotation)
()
G0G17G20G40G49G80G90
G92.1
G92.2
()
N1M1(FIRST TOOL)
(G0G53Z3)
G0G53Z0
T5M6
M1
G0G90G54X0.000Y0.000
S1000M3
G43Z1.000H2(M8)
()
(Rotate arrows and offset)
#1 = [360/60] (Rotate angle Step)
#2 = 0.1 (Z)
#3 = 0.000 (X Center)
#4 = 0.000 (Y Center)
#5 = [[360/#1] + 1] (Counter)
#6 = 0 (Current angle)
#7 = 0.0 (X Offset)
#8 = 0.0 (Y Offset)
#505 = 0 (Preset current)
#506 = 0 (Preset current)
o9000 CALL [0] [0.000] [0.000] [#2] [0] [0] [0.0] [#6] [#3] [#4]
G1Z#2F20.0
O1 WHILE [#5 GT 0]
  o9000 CALL [0] [0.000+#7] [0.000+#8] [#2] [0] [0] [0.0] [#6] [#3] [#4]
  o9000 CALL [1] [1.000+#7] [0.000+#8] [#2] [0] [0] [40.0] [#6] [#3] [#4]
  o9000 CALL [2] [1.000+#7] [0.000+#8] [#2] [0.005] [0.000] [10.0] [#6] 
[#3] [#4]
  o9000 CALL [1] [0.900+#7] [-0.025+#8] [#2] [0] [0] [10.0] [#6] [#3] [#4]
  o9000 CALL [3] [0.900+#7] [0.025+#8] [#2] [0] [0.025] [10.0] [#6] [#3] [#4]
  o9000 CALL [1] [1.000+#7] [0.000+#8] [#2] [0] [0] [10.0] [#6] [#3] [#4]
  o9000 CALL [0] [0.000+#7] [0.000+#8] [#2] [0] [0] [0.0] [#6] [#3] [#4]
  #5 = [#5 - 1]
  #6 = [#6 + #1]
  #2 = [#2 + 0.02]
O1 ENDWHILE
()
(Rotate arrows and offset)
#1 = [360/60] (Rotate angle Step)
#2 = 0.1 (Z)
#3 = 0.000 (X Center)
#4 = 0.000 (Y Center)
#5 = [[360/#1] + 1] (Counter)
#6 = 0 (Current angle)
#7 = 1.5 (X Offset)
#8 = 0.0 (Y Offset)
#505 = 0 (Preset current)
#506 = 0 (Preset current)
o9000 CALL [0] [0.000] [0.000] [#2] [0] [0] [0.0] [#6] [#3] [#4]
G1Z#2F20.0
O2 WHILE [#5 GT 0]
  o9000 CALL [0] [0.000+#7] [0.000+#8] [#2] [0] [0] [0.0] [#6] [#3] [#4]
  o9000 CALL [1] [1.000+#7] [0.000+#8] [#2] [0] [0] [40.0] [#6] [#3] [#4]
  o9000 CALL [2] [1.000+#7] [0.000+#8] [#2] [0.005] [0.000] [10.0] [#6] 
[#3] [#4]
  o9000 CALL [1] [0.900+#7] [-0.025+#8] [#2] [0] [0] [10.0] [#6] [#3] [#4]
  o9000 CALL [3] [0.900+#7] [0.025+#8] [#2] [0] [0.025] [10.0] [#6] [#3] [#4]
  o9000 CALL [1] [1.000+#7] [0.000+#8] [#2] [0] [0] [10.0] [#6] [#3] [#4]
  o9000 CALL [0] [0.000+#7] [0.000+#8] [#2] [0] [0] [0.0] [#6] [#3] [#4]
  #5 = [#5 - 1]
  #6 = [#6 + #1]
  #2 = [#2 + 0.02]
O2 ENDWHILE
G0 Z1.000
()
G0Z1.000M5
G49
(G0G53Z3M5)
G0G53Z0M5
G0G53Y0
M30

__________
Andre' B.  Clear Lake, Wi.



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to