Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE Module1
- VAR bool pirmaskartas:=TRUE;
- 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]];
- 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]];
- 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]];
- 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]];
- VAR robtarget point:=nulinis;
- VAR robtarget midpoint:=nulinis;
- VAR robtarget endpoint:=nulinis;
- VAR robtarget pointk:=nulinis;
- VAR robtarget midpointk:=nulinis;
- VAR robtarget endpointk:=nulinis;
- var num start_x;
- var num start_y;
- var num mid_x;
- var num mid_y;
- var num end_x;
- var num end_y;
- VAR num dir;
- PROC main()
- IF pirmaskartas THEN
- SetDO DO_baigtas200,0;
- SetDO DO_pasukti200Home,0;
- SetDO DO_pasukti200L,0;
- pirmaskartas:=FALSE;
- SetDO DO_pasukti200L,1;
- WaitTime 1;
- SetDO DO_pasukti200L,0;
- WaitTime 2;
- SetDO DO_pasukti200Home,1;
- WaitTime 1;
- SetDO DO_pasukti200Home,0;
- WaitTime 2;
- ENDIF
- MoveL Home,v1000,z100,pen\WObj:=wobj0;
- WaitDI DI_piesti200,1;
- SetDO DO_baigtas200,0;
- Path_10;
- SetDO DO_pasukti200L,1;
- WaitTime 0.5;
- SetDO DO_pasukti200L,0;
- WaitTime 3;
- Path_10kampu;
- SetDO DO_pasukti200Home,1;
- WaitTime 0.5;
- SetDO DO_pasukti200Home,0;
- WaitTime 3;
- SetDO DO_baigtas200,1;
- ENDPROC
- PROC Path_10()
- MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
- MoveL nulinis,v1000,z100,pen\WObj:=Box200;
- DL 300,136.515,0,266.0275;
- DL 0,266.0275,300,233.973;
- DL 300,233.973,0,363.4848;
- DL 0,363.4848,300,450;
- DC 75,125,250,-17.5 \clockwise \end_angle:=80;
- DC 225,375,250,163 \clockwise \end_angle:=90;
- DC 150,250,250,90 \end_angle:=180;
- DC 150,250,250,90 \clockwise \end_angle:=180;
- MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
- ENDPROC
- PROC Path_10kampu()
- MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
- MoveL nulinisKampu,v1000,z100,pen\WObj:=Box200kampu;
- DLkampu 300,136.515,0,266.0275;
- DLkampu 0,266.0275,300,233.973;
- DLkampu 300,233.973,0,363.4848;
- DLkampu 0,363.4848,300,450;
- MoveL tarpinis,v1000,z100,pen\WObj:=wobj0;
- MoveL Home,v1000,z100,pen\WObj:=wobj0;
- ENDPROC
- PROC D(num x, num y)
- point.trans:=[x,y,0];
- SingArea\Wrist;
- movel point,v1000,fine,pen\WObj:=Box200;
- setDO DO_draw200,1;
- ENDPROC
- PROC Dkampu(num x, num y)
- pointk.trans:=[x,y,0];
- SingArea\Wrist;
- movel pointk,v1000,fine,pen\WObj:=Box200kampu;
- setDO DO_draw200,1;
- ENDPROC
- PROC U(num x, num y)
- point.trans:=[x,y,-10];
- SingArea\Wrist;
- setDO DO_draw200,0;
- movel point,v1000,fine,pen\WObj:=Box200;
- ENDPROC
- PROC Ukampu(num x, num y)
- pointk.trans:=[x,y,-10];
- SingArea\Wrist;
- setDO DO_draw200,0;
- movel pointk,v1000,fine,pen\WObj:=Box200kampu;
- ENDPROC
- PROC DL(num x0, num y0, num x1, num y1)
- ! Draws a 2D line from (x0,y0) to (x1,y1)
- U x0,y0;
- D x0, y0;
- D x1,y1;
- U x1,y1;
- ENDPROC
- PROC DLkampu(num x0, num y0, num x1, num y1)
- ! Draws a 2D line from (x0,y0) to (x1,y1)
- Ukampu x0,y0;
- Dkampu x0, y0;
- Dkampu x1,y1;
- Ukampu x1,y1;
- ENDPROC
- PROC DC(num center_x, num center_y, num radius, num start_angle,
- \switch clockwise, \num end_angle)
- ! Draws a half-circle counter-clockwise from start_angle.
- ! Center_x || Define the circle center x coordinate on the workobject (0..210) on paper
- ! || Must be within the workobject!
- ! Center_y || Define the circle center y coordinate on the workobject (0..-290) on paper
- ! || Must be within the workobject!
- ! Radius || Define the circle radius, recommended range for default half-circle (0..145)
- ! || Must be within the workobject!
- ! Start angle || The starting angle for the circle arc relative to the x axis (0..360)
- ! TO DO: (OPTIONAL) || Enter "Clockwise" to draw the circle clockwise.
- ! TO DO: (OPTIONAL) || end_angle (0..360)
- ! TO DO: || Can draw more or less then half circle if end_angle is specified
- IF Present (clockwise)
- THEN dir := 1;
- ELSE dir := -1;
- ENDIF
- start_x := center_x + radius*sin(start_angle);
- start_y := center_y + radius*cos(start_angle);
- mid_x := center_x + radius*sin(start_angle + dir * end_angle/2);
- mid_y := center_y + radius*cos(start_angle + dir * end_angle/2);
- end_x := center_x + radius*sin(start_angle + dir * end_angle);
- end_y := center_y + radius*cos(start_angle + dir * end_angle);
- 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
- 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
- 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
- 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
- midpoint.trans:=[mid_x,mid_y,0];
- endpoint.trans:=[end_x,end_y,0];
- U start_x, start_y;
- D start_x, start_y;
- MoveC midpoint,endpoint,v100,fine,pen,\WObj:=Box200;
- U end_x, end_y;
- ENDPROC
- PROC DCkampu(num center_x, num center_y, num radius, num start_angle,
- \switch clockwise, \num end_angle)
- ! Draws a half-circle counter-clockwise from start_angle.
- ! Center_x || Define the circle center x coordinate on the workobject (0..210) on paper
- ! || Must be within the workobject!
- ! Center_y || Define the circle center y coordinate on the workobject (0..-290) on paper
- ! || Must be within the workobject!
- ! Radius || Define the circle radius, recommended range for default half-circle (0..145)
- ! || Must be within the workobject!
- ! Start angle || The starting angle for the circle arc relative to the x axis (0..360)
- ! TO DO: (OPTIONAL) || Enter "Clockwise" to draw the circle clockwise.
- ! TO DO: (OPTIONAL) || end_angle (0..360)
- ! TO DO: || Can draw more or less then half circle if end_angle is specified
- IF Present (clockwise)
- THEN dir := 1;
- ELSE dir := -1;
- ENDIF
- start_x := center_x + radius*sin(start_angle);
- start_y := center_y + radius*cos(start_angle);
- mid_x := center_x + radius*sin(start_angle + dir * 90);
- mid_y := center_y + radius*cos(start_angle + dir * 90);
- end_x := center_x + radius*sin(start_angle + dir * 180);
- end_y := center_y + radius*cos(start_angle + dir * 180);
- 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
- 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
- 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
- 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
- midpointk.trans:=[mid_x,mid_y,0];
- endpointk.trans:=[end_x,end_y,0];
- Ukampu start_x, start_y;
- Dkampu start_x, start_y;
- MoveC midpointk,endpointk,v100,fine,pen,\WObj:=Box200kampu;
- Ukampu end_x, end_y;
- ENDPROC
- ENDMODULE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement