I have an application which requires functionality similar to the CNC Dynamic Path example provided with the SM tutorials. I have modfied the example to work with a gantry cutter and can now cut a shape using straight lines. However I now need to cut a smooth shape between all the points. I was thinking about using the SMC_Smoothpath FB to achieve this, however this only works on points between G code G51 - G50, but I am not using G code but data written into the interpolator. Is there any way around this, or can somebody suggest a better method,
My current code is below:
Zitat:
CASE iState OF
0:
//initialize Queue
QUEUE_RAW.pbyBuffer := ADR(BUF[0]);
SM3_CNC.SMC_SetQueueCapacity(ADR(QUEUE_RAW), SIZEOF(BUF));
iState := iState + 1;
1: //fill queue
WHILE NOT QUEUE_RAW.bFull DO // when the Queue is full, wait until it has been processed by the following FBs
n := n + 1;
GEO.iSourceLine_No := n;
GEO.piStartPos := GEO.piDestPos; // copy last destination
GEO.iMoveType := LIN; // generate linear movement
GEO.iObjNo := GEO.iObjNo + 1; // calculate number
GEO.piDestPos.dX := xp[n]; // generate position
GEO.piDestPos.dY := yp[n];
SMC_CalcLengthGeo(pg := ADR(GEO)); // calculate length of object with the help of the standard function
SMC_AppendObj(poq:=ADR(QUEUE_RAW), pgi:=ADR(GEO)); //append object to queue
IF n = SIZEOF(xp)/SIZEOF(xp[1]) THEN // all target positions processed
QUEUE_RAW.bEndOfList := TRUE;
n := 0;
iState := 2;
EXIT;
END_IF
END_WHILE
Hi,
I have an application which requires functionality similar to the CNC Dynamic Path example provided with the SM tutorials. I have modfied the example to work with a gantry cutter and can now cut a shape using straight lines. However I now need to cut a smooth shape between all the points. I was thinking about using the SMC_Smoothpath FB to achieve this, however this only works on points between G code G51 - G50, but I am not using G code but data written into the interpolator. Is there any way around this, or can somebody suggest a better method,
My current code is below:
1: //fill queue
WHILE NOT QUEUE_RAW.bFull DO // when the Queue is full, wait until it has been processed by the following FBs
n := n + 1;
GEO.iSourceLine_No := n;
GEO.piStartPos := GEO.piDestPos; // copy last destination
GEO.iMoveType := LIN; // generate linear movement
GEO.iObjNo := GEO.iObjNo + 1; // calculate number
GEO.piDestPos.dX := xp[n]; // generate position
GEO.piDestPos.dY := yp[n];
SMC_CalcLengthGeo(pg := ADR(GEO)); // calculate length of object with the help of the standard function
SMC_AppendObj(poq:=ADR(QUEUE_RAW), pgi:=ADR(GEO)); //append object to queue
IF n = SIZEOF(xp)/SIZEOF(xp[1]) THEN // all target positions processed
QUEUE_RAW.bEndOfList := TRUE;
n := 0;
iState := 2;
EXIT;
END_IF
END_WHILE
2: //generate 3d path for visulaisation
I assume my path preprocessing would occur between steps 1-2.
Any help would be greatly appreciated.
Related
Talk.ru: 1