Guest User

Untitled

a guest
Jun 14th, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Global mitte_x=100
  3. Global mitte_y=100
  4. Global radius=80
  5. Global stp#=3.6
  6.  
  7. Type code
  8.     Field x#
  9.     Field y#
  10. End Type
  11.  
  12.  
  13. kreis(mitte_x,mitte_y,radius,stp,0,360)
  14.  
  15. Graphics 800,600,0,2
  16. SetBuffer FrontBuffer()
  17.  
  18. Rect 300,200,200,200,0
  19.  
  20. Local kk.code
  21. Local file=WriteFile("out"+radius+"-"+stp+".gcode")
  22.  
  23. WriteLine file,"G1 F25000"
  24. For kk.code=Each code
  25.    
  26.     Plot 300+kk\x,400-kk\y
  27.    
  28.     WriteLine file,"G1 X"+kk\x+" Y"+kk\y
  29.    
  30.    
  31.    
  32. Next
  33. WriteLine file,"G1 X0 Y0"
  34.  
  35. Rect 100,100,100,100,1
  36.  
  37. WaitKey()
  38. End
  39.  
  40.  
  41.  
  42. Function kreis(M_X#,M_Y#,r#,stp#,start#,finish#)
  43.     ;M_X    = mittelpunkt in X
  44.     ;M_Y    = mittelpunkt in Y
  45.     ;r      = radius
  46.     ;stp    = winkelschritt
  47.     ;start  = startwinkel
  48.     ;finish = endwinkel
  49.     ;F      = vorschub
  50.     ;dir    = +1=gegen uhr  -1= mit der uhr
  51.  
  52.     Local counter#=start
  53.     Local cc.code
  54.  
  55.     While counter<=360+start
  56.        
  57.         cc.code=New code
  58.        
  59.         cc\x=M_X+(Cos(counter)*r)
  60.         cc\y=M_Y+(Sin(counter)*r)
  61.        
  62.         counter=counter+stp
  63.        
  64.     Wend
  65.  
  66. End Function
Add Comment
Please, Sign In to add comment