Advertisement
Guest User

Untitled

a guest
May 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 KB | None | 0 0
  1. MODULE Module1
  2. VAR bool pirmaskartas:=TRUE;
  3. CONST robtarget Home:=[[602.866870058,121.731420714,631.312234329],[0.478217065,-0.028406463,0.871562313,0.104310336],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
  4. CONST robtarget tarpinis:=[[780.102359626,168.089441062,963.914097961],[0.30656064,-0.055447382,0.944999245,0.099612191],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
  5. CONST robtarget nulinis:=[[0,0,0],[0,0,0,1],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
  6. CONST robtarget nulinisKampu:=[[0,0,0],[0.847244194,0,0,-0.531168514],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
  7. VAR robtarget point:=nulinis;
  8. VAR robtarget midpoint:=nulinis;
  9. VAR robtarget endpoint:=nulinis;
  10. VAR robtarget pointk:=nulinis;
  11. VAR robtarget midpointk:=nulinis;
  12. VAR robtarget endpointk:=nulinis;
  13.  
  14. var num start_x;
  15. var num start_y;
  16. var num mid_x;
  17. var num mid_y;
  18. var num end_x;
  19. var num end_y;
  20. VAR num dir;
  21. PROC main()
  22. IF pirmaskartas THEN
  23. SetDO DO_baigtas200,0;
  24. SetDO DO_pasukti200Home,0;
  25. SetDO DO_pasukti200L,0;
  26. pirmaskartas:=FALSE;
  27. SetDO DO_pasukti200L,1;
  28. WaitTime 1;
  29. SetDO DO_pasukti200L,0;
  30. WaitTime 2;
  31. SetDO DO_pasukti200Home,1;
  32. WaitTime 1;
  33. SetDO DO_pasukti200Home,0;
  34. WaitTime 2;
  35. ENDIF
  36. MoveL Home,v1000,z100,pen\WObj:=wobj0;
  37. WaitDI DI_piesti200,1;
  38. SetDO DO_baigtas200,0;
  39. Path_10;
  40. SetDO DO_pasukti200L,1;
  41. WaitTime 0.5;
  42. SetDO DO_pasukti200L,0;
  43. WaitTime 3;
  44. Path_10kampu;
  45. SetDO DO_pasukti200Home,1;
  46. WaitTime 0.5;
  47. SetDO DO_pasukti200Home,0;
  48. WaitTime 3;
  49. SetDO DO_baigtas200,1;
  50. ENDPROC
  51. PROC Path_10()
  52. MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
  53. MoveL nulinis,v1000,z100,pen\WObj:=Box200;
  54.  
  55.  
  56. DL 300,136.515,0,266.0275;
  57. DL 0,266.0275,300,233.973;
  58. DL 300,233.973,0,363.4848;
  59. DL 0,363.4848,300,450;
  60.  
  61. DC 75,125,250,-17.5 \clockwise \end_angle:=80;
  62. DC 225,375,250,163 \clockwise \end_angle:=90;
  63. DC 150,250,250,90 \end_angle:=180;
  64. DC 150,250,250,90 \clockwise \end_angle:=180;
  65.  
  66.  
  67.  
  68. MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
  69. ENDPROC
  70.  
  71. PROC Path_10kampu()
  72. MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
  73. MoveL nulinisKampu,v1000,z100,pen\WObj:=Box200kampu;
  74.  
  75. DLkampu 300,136.515,0,266.0275;
  76. DLkampu 0,266.0275,300,233.973;
  77. DLkampu 300,233.973,0,363.4848;
  78. DLkampu 0,363.4848,300,450;
  79.  
  80.  
  81. MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
  82. MoveL Home,v1000,z100,pen\WObj:=wobj0;
  83. ENDPROC
  84.  
  85. PROC D(num x, num y)
  86. point.trans:=[x,y,0];
  87. SingArea\Wrist;
  88. movel point,v1000,fine,pen\WObj:=Box200;
  89. setDO DO_draw200,1;
  90.  
  91. ENDPROC
  92.  
  93. PROC Dkampu(num x, num y)
  94. pointk.trans:=[x,y,0];
  95. SingArea\Wrist;
  96. movel pointk,v1000,fine,pen\WObj:=Box200kampu;
  97. setDO DO_draw200,1;
  98. ENDPROC
  99.  
  100. PROC U(num x, num y)
  101. point.trans:=[x,y,-10];
  102. SingArea\Wrist;
  103. setDO DO_draw200,0;
  104. movel point,v1000,fine,pen\WObj:=Box200;
  105. ENDPROC
  106.  
  107. PROC Ukampu(num x, num y)
  108. pointk.trans:=[x,y,-10];
  109. SingArea\Wrist;
  110. setDO DO_draw200,0;
  111. movel pointk,v1000,fine,pen\WObj:=Box200kampu;
  112. ENDPROC
  113.  
  114. PROC DL(num x0, num y0, num x1, num y1)
  115. ! Draws a 2D line from (x0,y0) to (x1,y1)
  116. U x0,y0;
  117. D x0, y0;
  118. D x1,y1;
  119. U x1,y1;
  120. ENDPROC
  121.  
  122. PROC DLkampu(num x0, num y0, num x1, num y1)
  123. ! Draws a 2D line from (x0,y0) to (x1,y1)
  124. Ukampu x0,y0;
  125. Dkampu x0, y0;
  126. Dkampu x1,y1;
  127. Ukampu x1,y1;
  128. ENDPROC
  129.  
  130. PROC DC(num center_x, num center_y, num radius, num start_angle,
  131. \switch clockwise, \num end_angle)
  132.  
  133. ! Draws a half-circle counter-clockwise from start_angle.
  134. ! Center_x || Define the circle center x coordinate on the workobject (0..210) on paper
  135. ! || Must be within the workobject!
  136. ! Center_y || Define the circle center y coordinate on the workobject (0..-290) on paper
  137. ! || Must be within the workobject!
  138. ! Radius || Define the circle radius, recommended range for default half-circle (0..145)
  139. ! || Must be within the workobject!
  140. ! Start angle || The starting angle for the circle arc relative to the x axis (0..360)
  141. ! TO DO: (OPTIONAL) || Enter "Clockwise" to draw the circle clockwise.
  142. ! TO DO: (OPTIONAL) || end_angle (0..360)
  143. ! TO DO: || Can draw more or less then half circle if end_angle is specified
  144.  
  145. IF Present (clockwise)
  146. THEN dir := 1;
  147. ELSE dir := -1;
  148. ENDIF
  149.  
  150. start_x := center_x + radius*sin(start_angle);
  151. start_y := center_y + radius*cos(start_angle);
  152.  
  153. mid_x := center_x + radius*sin(start_angle + dir * end_angle/2);
  154. mid_y := center_y + radius*cos(start_angle + dir * end_angle/2);
  155. end_x := center_x + radius*sin(start_angle + dir * end_angle);
  156. end_y := center_y + radius*cos(start_angle + dir * end_angle);
  157.  
  158. IF start_x > 300 AND dir=1 THEN start_y:=start_y-Sqrt(Pow(radius,2)-pow((300-center_x),2)); start_x:=300; ENDIF
  159. IF start_x > 300 AND dir=-1 THEN start_y:=start_y+Sqrt(Pow(radius,2)-pow((300-center_x),2)); start_x:=300; ENDIF
  160.  
  161. IF end_x < 0 AND dir=1 then end_y:=end_y-Sqrt(Pow(radius,2)-pow((0-center_x),2)); end_x:=0; ENDIF
  162. IF end_x < 0 AND dir=-1 then end_y:=end_y+Sqrt(Pow(radius,2)-pow((0-center_x),2)); end_x:=0; ENDIF
  163.  
  164. midpoint.trans:=[mid_x,mid_y,0];
  165. endpoint.trans:=[end_x,end_y,0];
  166.  
  167. U start_x, start_y;
  168. D start_x, start_y;
  169.  
  170. MoveC midpoint,endpoint,v100,fine,pen,\WObj:=Box200;
  171.  
  172. U end_x, end_y;
  173.  
  174. ENDPROC
  175. PROC DCkampu(num center_x, num center_y, num radius, num start_angle,
  176. \switch clockwise, \num end_angle)
  177.  
  178. ! Draws a half-circle counter-clockwise from start_angle.
  179. ! Center_x || Define the circle center x coordinate on the workobject (0..210) on paper
  180. ! || Must be within the workobject!
  181. ! Center_y || Define the circle center y coordinate on the workobject (0..-290) on paper
  182. ! || Must be within the workobject!
  183. ! Radius || Define the circle radius, recommended range for default half-circle (0..145)
  184. ! || Must be within the workobject!
  185. ! Start angle || The starting angle for the circle arc relative to the x axis (0..360)
  186. ! TO DO: (OPTIONAL) || Enter "Clockwise" to draw the circle clockwise.
  187. ! TO DO: (OPTIONAL) || end_angle (0..360)
  188. ! TO DO: || Can draw more or less then half circle if end_angle is specified
  189.  
  190. IF Present (clockwise)
  191. THEN dir := 1;
  192. ELSE dir := -1;
  193. ENDIF
  194.  
  195. start_x := center_x + radius*sin(start_angle);
  196. start_y := center_y + radius*cos(start_angle);
  197. mid_x := center_x + radius*sin(start_angle + dir * 90);
  198. mid_y := center_y + radius*cos(start_angle + dir * 90);
  199. end_x := center_x + radius*sin(start_angle + dir * 180);
  200. end_y := center_y + radius*cos(start_angle + dir * 180);
  201.  
  202. IF start_x > 300 AND dir=1 THEN start_y:=start_y-Sqrt(Pow(radius,2)-pow((300-center_x),2)); start_x:=300; ENDIF
  203. IF start_x > 300 AND dir=-1 THEN start_y:=start_y+Sqrt(Pow(radius,2)-pow((300-center_x),2)); start_x:=300; ENDIF
  204.  
  205. IF end_x < 0 AND dir=1 then end_y:=end_y-Sqrt(Pow(radius,2)-pow((0-center_x),2)); end_x:=0; ENDIF
  206. IF end_x < 0 AND dir=-1 then end_y:=end_y+Sqrt(Pow(radius,2)-pow((0-center_x),2)); end_x:=0; ENDIF
  207.  
  208. midpointk.trans:=[mid_x,mid_y,0];
  209. endpointk.trans:=[end_x,end_y,0];
  210.  
  211. Ukampu start_x, start_y;
  212. Dkampu start_x, start_y;
  213.  
  214. MoveC midpointk,endpointk,v100,fine,pen,\WObj:=Box200kampu;
  215.  
  216. Ukampu end_x, end_y;
  217. ENDPROC
  218. ENDMODULE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement