Advertisement
Guest User

Untitled

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