Exemplo n.º 1
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Converts the excellon line into a GCode line and returns it
        /// </summary>
        /// <param name="stateMachine">the state machine with the configuration</param>
        /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
        /// empty if there is no direct conversion</param>
        /// <returns>z success, nz fail</returns>
        public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList)
        {
            gcLineList = new List <GCodeCmd>();

            // we can only handle some of these
            switch (currentMCode)
            {
            case 30:
                // this is the return to predefined position. The standard footer output
                // into every GCode always returns us to the origin
                return(0);

            case 47:
                // this is Operator Message, no need for action here
                return(0);

            case 48:
                // this is the start of the header, no need for action here
                return(0);

            case 71:
                // this is the metric mode, no need for action here
                return(0);

            case 72:
                // this is the inches mode, no need for action here
                return(0);

            default:
                // if we do not explictly support the MCode, error until we do. It might
                // be something important
                return(-99);
            }
        }
Exemplo n.º 2
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Revisits the excellon lines and figures out the pad center points
        /// </summary>
        public void SetPadCenterPointList()
        {
            // create a dummy statemachine We can only get a lot of the information from the DCodes
            // by simulating a run. They use the results of the previous DCode a lot
            ExcellonFileStateMachine workingStateMachine = new ExcellonFileStateMachine();

            workingStateMachine.ToolCollection = stateMachine.ToolCollection;

            // run through all of the DCode lines
            foreach (ExcellonLine gLineObj in SourceLines)
            {
                if ((gLineObj is ExcellonLine_ToolChange) == true)
                {
                    ExcellonLine_ToolTable toolTabObj = null;
                    // see if we can find the tool table object for this change
                    toolTabObj = workingStateMachine.GetToolTableObjectByToolNumber((gLineObj as ExcellonLine_ToolChange).ToolNumber);
                    if (toolTabObj != null)
                    {
                        workingStateMachine.LastDrillWidth = toolTabObj.DrillDiameter;
                    }
                    continue;
                }
                else if ((gLineObj is ExcellonLine_XYCode) == true)
                {
                    // set this now for convenience
                    ExcellonLine_XYCode elObj = (ExcellonLine_XYCode)gLineObj;
                    // record these centerpoints to our list, note that we save to the current statemachine but use the aperture from the working one
                    stateMachine.PadCenterPointList.Add(new GerberPad(elObj.XCoord, elObj.YCoord, workingStateMachine.LastDrillWidth));
                }
            }
        }
Exemplo n.º 3
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Converts the excellon line into a GCode line and returns it
 /// </summary>
 /// <param name="stateMachine">the state machine with the configuration</param>
 /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
 /// empty if there is no direct conversion</param>
 /// <returns>z success, nz fail</returns>
 public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList)
 {
     // we do not generate a GCode and we do not error. It is assumed that whatever built this
     // object knew this and intended this action to be taken on the output
     gcLineList = new List <GCodeCmd>();
     return(0);
 }
Exemplo n.º 4
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Converts the excellon line into a GCode line and returns it
        /// </summary>
        /// <param name="stateMachine">the state machine with the configuration</param>
        /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
        /// empty if there is no direct conversion</param>
        /// <returns>z success, nz fail</returns>
        public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList)
        {
            gcLineList = new List <GCodeCmd>();

            // we can only handle some of these
            switch (currentGCode)
            {
            case 0:
                // this is not ok, it is Rout Mode
                return(2091);

            case 5:
                // this is ok, it is just Drill Mode
                return(0);

            case 90:
                // this is the return to predefined position. The standard footer output
                // into every GCode always returns us to the origin
                return(0);

            case 91:
                // incremental mode is unsupported
                return(2095);

            default:
                // if we do not explictly support the GCode, error until we do. It might
                // be something important
                return(-99);
            }
        }
Exemplo n.º 5
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Converts the excellon line into a GCode line and returns it
        /// </summary>
        /// <param name="stateMachine">the state machine with the configuration</param>
        /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
        /// empty if there is no direct conversion</param>
        /// <returns>z success, nz fail</returns>
        public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList)
        {
            GCodeCmd_Comment coLine = null;

            gcLineList = new List <GCodeCmd>();

            coLine = new GCodeCmd_Comment("ToolTable: Tool " + toolNumber.ToString() + ", Dia= " + drillDiameter.ToString());
            gcLineList.Add(coLine);

            return(0);
        }
Exemplo n.º 6
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Converts the excellon line into a GCode line and returns it
        /// </summary>
        /// <param name="stateMachine">the state machine with the configuration</param>
        /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
        /// empty if there is no direct conversion</param>
        /// <returns>z success, nz fail</returns>
        public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList)
        {
            gcLineList = null;
            GCodeCmd_ZMove     zLine  = null;
            GCodeCmd_RapidMove rmLine = null;

            gcLineList = new List <GCodeCmd>();
            int workingXCoord;
            int workingYCoord;
            int workingXOffset;
            int workingYOffset;

            if (RepeatCount < 0)
            {
                LogMessage("GetGCodeCmd (R) invalid repeat count of " + RepeatCount.ToString() + " on line " + LineNumber.ToString());
                return(101);
            }

            // setup our offsets now
            workingXOffset = GetOffsetInPlotCoords_X(stateMachine);
            workingYOffset = GetOffsetInPlotCoords_Y(stateMachine);

            // now put out our loop
            for (int i = 0; i < RepeatCount; i++)
            {
                workingXCoord = stateMachine.LastPlotXCoord;
                workingYCoord = stateMachine.LastPlotYCoord;

                // calculate the new coordinate now
                workingXCoord += workingXOffset;
                workingYCoord += workingYOffset;

                // G00 rapid move tool head to the xOffset, yCoord
                rmLine = new GCodeCmd_RapidMove(workingXCoord, workingYCoord);
                gcLineList.Add(rmLine);
                stateMachine.LastXCoord = workingXCoord;
                stateMachine.LastYCoord = workingYCoord;

                // set the drill width
                float workingDrillWidth = stateMachine.LastDrillWidth * stateMachine.IsoPlotPointsPerAppUnit;

                // G00 - put the bit into the work piece
                zLine = new GCodeCmd_ZMove(GCodeCmd_ZMove.GCodeZMoveHeightEnum.GCodeZMoveHeight_ZCoordForCut);
                zLine.SetGCodePlotDrillValues(workingXCoord, workingYCoord, workingDrillWidth);
                gcLineList.Add(zLine);

                // G00 - pull the bit out of the work piece
                zLine = new GCodeCmd_ZMove(GCodeCmd_ZMove.GCodeZMoveHeightEnum.GCodeZMoveHeight_ZCoordForClear);
                zLine.SetGCodePlotDrillValues(workingXCoord, workingYCoord, workingDrillWidth);
                gcLineList.Add(zLine);
            }
            return(0);
        }
Exemplo n.º 7
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Parses out the line and gets the required information from it
        /// </summary>
        /// <param name="processedLineStr">a line string without block terminator or format parameters</param>
        /// <param name="stateMachine">The state machine containing the implied modal values</param>
        /// <returns>z success, nz fail</returns>
        public override int ParseLine(string processedLineStr, ExcellonFileStateMachine stateMachine)
        {
            int  outInt       = -1;
            int  nextStartPos = 0;
            bool retBool;

            //DebugMessage("Excellon ParseLine(TChange) started");

            if (processedLineStr == null)
            {
                return(100);
            }
            if (processedLineStr.StartsWith("T") == false)
            {
                return(200);
            }

            // now the TCode line will have an T tag

            // LOOK FOR THE T TAG
            nextStartPos = 0;
            nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'T', nextStartPos);
            if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length))
            {
                // this is not an error - just means we did not find one
            }
            else
            {
                // this will have a integer number
                retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetInteger(processedLineStr, nextStartPos, ref outInt, ref nextStartPos);
                if (retBool != true)
                {
                    LogMessage("Excellon ParseLine(T) failed on call to ParseNumberFromString_TillNonDigit_RetInteger");
                    return(333);
                }
                else
                {
                    // set the value now
                    toolNumber = outInt;
                }
            }

            return(0);
        }
Exemplo n.º 8
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Converts the excellon line into a GCode line and returns it
        /// </summary>
        /// <param name="stateMachine">the state machine with the configuration</param>
        /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
        /// empty if there is no direct conversion</param>
        /// <returns>z success, nz fail</returns>
        public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList)
        {
            gcLineList = null;

            GCodeCmd_ZMove     zLine  = null;
            GCodeCmd_RapidMove rmLine = null;

            gcLineList = new List <GCodeCmd>();

            int x0 = GetIsoPlotCoordOriginCompensated_X(stateMachine);
            int y0 = GetIsoPlotCoordOriginCompensated_Y(stateMachine);

            // G00 rapid move tool head to the xCoord, yCoord
            rmLine = new GCodeCmd_RapidMove(x0, y0);
            gcLineList.Add(rmLine);
            stateMachine.LastXCoord     = XCoord;
            stateMachine.LastYCoord     = YCoord;
            stateMachine.LastPlotXCoord = x0;
            stateMachine.LastPlotYCoord = y0;
            // record locally
            lastPlotXCoordEnd = x0;
            lastPlotYCoordEnd = y0;

            // set the drill width
            float workingDrillWidth = stateMachine.LastDrillWidth * stateMachine.IsoPlotPointsPerAppUnit;

            // remember this
            LastDrillWidth = stateMachine.LastDrillWidth;

            // G00 - put the bit into the work piece
            zLine = new GCodeCmd_ZMove(GCodeCmd_ZMove.GCodeZMoveHeightEnum.GCodeZMoveHeight_ZCoordForCut);
            zLine.SetGCodePlotDrillValues(x0, y0, workingDrillWidth);
            zLine.WantLinearMove = true;
            gcLineList.Add(zLine);

            // G00 - pull the bit out of the work piece
            zLine = new GCodeCmd_ZMove(GCodeCmd_ZMove.GCodeZMoveHeightEnum.GCodeZMoveHeight_ZCoordForClear);
            zLine.SetGCodePlotDrillValues(x0, y0, workingDrillWidth);
            gcLineList.Add(zLine);

            return(0);
        }
Exemplo n.º 9
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Converts the excellon line into a GCode line and returns it
        /// </summary>
        /// <param name="stateMachine">the state machine with the configuration</param>
        /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
        /// empty if there is no direct conversion</param>
        /// <returns>z success, nz fail</returns>
        public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList)
        {
            GCodeCmd_ToolChange    tcLine;
            ExcellonLine_ToolTable toolTabObj = null;
            string commentStr = null;

            // see if we can find the tool table object for this change
            toolTabObj = stateMachine.GetToolTableObjectByToolNumber(toolNumber);
            if (toolTabObj != null)
            {
                commentStr = "ToolChange, ToolNum: " + toolNumber.ToString() + ", Drill Dia:" + toolTabObj.DrillDiameter.ToString();
                // also remember this
                stateMachine.LastDrillWidth = toolTabObj.DrillDiameter;
            }
            gcLineList = new List <GCodeCmd>();
            tcLine     = new GCodeCmd_ToolChange(toolNumber);
            if (commentStr != null)
            {
                tcLine.CommentText = commentStr;
            }
            gcLineList.Add(tcLine);
            return(0);
        }
Exemplo n.º 10
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Gets the current Y offset in plot coordinates
 /// </summary>
 public int GetOffsetInPlotCoords_Y(ExcellonFileStateMachine stateMachine)
 {
     // Just return this
     return((int)Math.Round((YOffset * stateMachine.IsoPlotPointsPerAppUnit)));
 }
Exemplo n.º 11
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Gets the current Y Coordinate value with origin compensation
 /// and flipping applied (if necessary)
 /// </summary>
 public int GetIsoPlotCoordOriginCompensated_Y(ExcellonFileStateMachine stateMachine)
 {
     // Just return this
     return((int)Math.Round((CoordOriginCompensated_Y * stateMachine.IsoPlotPointsPerAppUnit)));
 }
Exemplo n.º 12
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Performs the action the plot requires based on the current context
        /// </summary>
        /// <param name="graphicsObj">a graphics object on which to plot</param>
        /// <param name="stateMachine">the excellon plot state machine</param>
        /// <param name="errorString">the error string we return on fail</param>
        /// <param name="errorValue">the error value we return on fail, z success, nz fail </param>
        /// <returns>an enum value indicating what next action to take</returns>
        public override PlotActionEnum PerformPlotExcellonAction(Graphics graphicsObj, ExcellonFileStateMachine stateMachine, ref int errorValue, ref string errorString)
        {
            ExcellonLine_ToolTable toolTabObj = null;

            // see if we can find the tool table object for this change
            toolTabObj = stateMachine.GetToolTableObjectByToolNumber(toolNumber);
            if (toolTabObj != null)
            {
                stateMachine.LastDrillWidth = toolTabObj.DrillDiameter;
            }
            errorValue  = 0;
            errorString = "Successful End";
            return(PlotActionEnum.PlotAction_Continue);
        }
Exemplo n.º 13
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Performs the action the plot requires based on the current context
        /// </summary>
        /// <param name="graphicsObj">a graphics object on which to plot</param>
        /// <param name="stateMachine">the excellon plot state machine</param>
        /// <param name="errorString">the error string we return on fail</param>
        /// <param name="errorValue">the error value we return on fail, z success, nz fail </param>
        /// <returns>an enum value indicating what next action to take</returns>
        public override PlotActionEnum PerformPlotExcellonAction(Graphics graphicsObj, ExcellonFileStateMachine stateMachine, ref int errorValue, ref string errorString)
        {
            int workingXCoord;
            int workingYCoord;
            int workingXOffset;
            int workingYOffset;

            if (RepeatCount < 0)
            {
                LogMessage("PerformPlotExcellonAction (R) invalid repeat count of " + RepeatCount.ToString() + " on line " + LineNumber.ToString());
                errorValue  = 101;
                errorString = "PerformPlotExcellonAction(R) invalid repeat count of " + RepeatCount.ToString() + " on line " + LineNumber.ToString();
                return(PlotActionEnum.PlotAction_FailWithError);
            }

            // setup our offsets now
            workingXOffset = GetOffsetInPlotCoords_X(stateMachine);
            workingYOffset = GetOffsetInPlotCoords_Y(stateMachine);

            // set the drill width
            float workingDrillWidth = stateMachine.LastDrillWidth * stateMachine.IsoPlotPointsPerAppUnit;

            // remember this
            LastDrillWidth = stateMachine.LastDrillWidth;

            // now put out our loop
            for (int i = 0; i < RepeatCount; i++)
            {
                workingXCoord = stateMachine.LastPlotXCoord;
                workingYCoord = stateMachine.LastPlotYCoord;

                // calculate the new coordinate now
                workingXCoord += workingXOffset;
                workingYCoord += workingYOffset;
                stateMachine.LastPlotXCoord = workingXCoord;
                stateMachine.LastPlotYCoord = workingYCoord;
                stateMachine.LastXCoord     = (float)(workingXCoord / stateMachine.IsoPlotPointsPerAppUnit);
                stateMachine.LastYCoord     = (float)(workingYCoord / stateMachine.IsoPlotPointsPerAppUnit);

                MiscGraphicsUtils.FillEllipseCenteredOnPoint(graphicsObj, stateMachine.ExcellonHoleBrush, workingXCoord, workingYCoord, workingDrillWidth, workingDrillWidth);
            }

            errorValue  = 0;
            errorString = "Successful End";
            return(PlotActionEnum.PlotAction_Continue);
        }
Exemplo n.º 14
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Parses out the line and gets the required information from it
 /// </summary>
 /// <param name="processedLineStr">a line string without block terminator or format parameters</param>
 /// <param name="stateMachine">The state machine containing the implied modal values</param>
 /// <returns>z success, nz fail</returns>
 public override int ParseLine(string processedLineStr, ExcellonFileStateMachine stateMachine)
 {
     return(0);
 }
Exemplo n.º 15
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Performs the action the plot requires based on the current context
 /// </summary>
 /// <param name="graphicsObj">a graphics object on which to plot</param>
 /// <param name="stateMachine">the excellon plot state machine</param>
 /// <param name="errorString">the error string we return on fail</param>
 /// <param name="errorValue">the error value we return on fail, z success, nz fail </param>
 /// <returns>an enum value indicating what next action to take</returns>
 public override PlotActionEnum PerformPlotExcellonAction(Graphics graphicsObj, ExcellonFileStateMachine stateMachine, ref int errorValue, ref string errorString)
 {
     errorValue  = 0;
     errorString = "Successful End";
     return(PlotActionEnum.PlotAction_Continue);
 }
Exemplo n.º 16
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Converts the excellon line into a GCode line and returns it
 /// </summary>
 /// <param name="stateMachine">the state machine with the configuration</param>
 /// <param name="gcLineList">a list of the equivalent gcode line object. This can be
 /// empty if there is no direct conversion</param>
 /// <returns>z success, nz fail</returns>
 public abstract int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList);
Exemplo n.º 17
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Parses out the line and gets the required information from it
 /// </summary>
 /// <param name="processedLineStr">a line string without block terminator or format parameters</param>
 /// <param name="stateMachine">The state machine containing the implied modal values</param>
 /// <returns>z success, nz fail</returns>
 public abstract int ParseLine(string processedLineStr, ExcellonFileStateMachine stateMachine);
Exemplo n.º 18
0
 /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 /// <summary>
 /// Performs the action the plot excellon code action required based on the current context
 /// </summary>
 /// <param name="graphicsObj">a graphics object on which to plot</param>
 /// <param name="stateMachine">the excellon plot state machine</param>
 /// <param name="errorString">the error string we return on fail</param>
 /// <param name="errorValue">the error value we return on fail, z success, nz fail </param>
 /// <returns>z success, nz fail</returns>
 public virtual PlotActionEnum PerformPlotExcellonAction(Graphics graphicsObj, ExcellonFileStateMachine stateMachine, ref int errorValue, ref string errorString)
 {
     // ignore this
     errorValue  = 0;
     errorString = "";
     return(PlotActionEnum.PlotAction_Continue);
 }
Exemplo n.º 19
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Performs the action the plot requires based on the current context
        /// </summary>
        /// <param name="graphicsObj">a graphics object on which to plot</param>
        /// <param name="stateMachine">the excellon plot state machine</param>
        /// <param name="errorString">the error string we return on fail</param>
        /// <param name="errorValue">the error value we return on fail, z success, nz fail </param>
        /// <returns>an enum value indicating what next action to take</returns>
        public override PlotActionEnum PerformPlotExcellonAction(Graphics graphicsObj, ExcellonFileStateMachine stateMachine, ref int errorValue, ref string errorString)
        {
            int x0 = GetIsoPlotCoordOriginCompensated_X(stateMachine);
            int y0 = GetIsoPlotCoordOriginCompensated_Y(stateMachine);

            // G00 rapid move tool head to the xCoord, yCoord
            stateMachine.LastXCoord     = XCoord;
            stateMachine.LastYCoord     = YCoord;
            stateMachine.LastPlotXCoord = x0;
            stateMachine.LastPlotYCoord = y0;
            // record locally
            lastPlotXCoordEnd = x0;
            lastPlotYCoordEnd = y0;

            // set the drill width
            float workingDrillWidth = stateMachine.LastDrillWidth * stateMachine.IsoPlotPointsPerAppUnit;

            // remember this
            LastDrillWidth = stateMachine.LastDrillWidth;

            MiscGraphicsUtils.FillEllipseCenteredOnPoint(graphicsObj, stateMachine.ExcellonHoleBrush, x0, y0, workingDrillWidth, workingDrillWidth);

            errorValue  = 0;
            errorString = "Successful End";
            return(PlotActionEnum.PlotAction_Continue);
        }
Exemplo n.º 20
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Parses out the line and gets the required information from it
        /// </summary>
        /// <param name="processedLineStr">a line string without block terminator or format parameters</param>
        /// <param name="stateMachine">The state machine containing the implied modal values</param>
        /// <returns>z success, nz fail</returns>
        public override int ParseLine(string processedLineStr, ExcellonFileStateMachine stateMachine)
        {
            int  outInt       = -1;
            int  nextStartPos = 0;
            bool retBool;

            //DebugMessage("Excellon ParseLine(M) started");

            if (processedLineStr == null)
            {
                return(100);
            }
            if (processedLineStr.StartsWith("G") == false)
            {
                return(200);
            }

            // now the GCode line will have an G tag

            // LOOK FOR THE G TAG
            nextStartPos = 0;
            nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'G', nextStartPos);
            if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length))
            {
                // this is not an error - just means we did not find one
                LogMessage("Excellon ParseLine(G) failed on call to FindCharacterReturnNextPos  no next char found.");
                return(101);
            }
            else
            {
                // this will have a integer number
                retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetInteger(processedLineStr, nextStartPos, ref outInt, ref nextStartPos);
                if (retBool != true)
                {
                    LogMessage("Excellon ParseLine(G) failed on call to ParseNumberFromString_TillNonDigit_RetInteger");
                    return(333);
                }
                else
                {
                    // set the value now
                    currentGCode = outInt;
                }

                // validate the GCode
                switch (currentGCode)
                {
                case 0:
                    // this is not ok, it is Rout Mode
                    LogMessage("Excellon ParseLine(G) code G00, routing mode is not supported");
                    return(1091);

                case 5:
                    // this is ok, it is just Drill Mode
                    return(0);

                case 90:
                    // this is ok, it is just absolute mode
                    return(0);

                case 91:
                    // this is not ok, it is incrememtal mode
                    LogMessage("Excellon ParseLine(G) code G91, incremental mode is not supported");
                    return(1095);

                default:
                    LogMessage("Excellon ParseLine(G) unknown code G" + CurrentGCode.ToString());
                    return(102);
                }
            }
        }
Exemplo n.º 21
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Parses out the line and gets the required information from it
        /// </summary>
        /// <param name="processedLineStr">a line string without block terminator or format parameters</param>
        /// <param name="stateMachine">The state machine containing the implied modal values</param>
        /// <returns>z success, nz fail</returns>
        public override int ParseLine(string processedLineStr, ExcellonFileStateMachine stateMachine)
        {
            float outFloat     = 0;
            int   outInt       = 0;
            int   nextStartPos = 0;
            bool  retBool;

            //LogMessage("ParseLine(XY) started");

            if (processedLineStr == null)
            {
                return(100);
            }
            if (processedLineStr.StartsWith("R") == false)
            {
                return(200);
            }

            // now the line will have some combination of R, X and Y tags in some order
            // LOOK FOR THE X TAG
            nextStartPos = 0;
            nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'R', nextStartPos);
            if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length))
            {
                // we have to have this
                LogMessage("ParseLine(R) lineNumber=" + LineNumber.ToString() + " failed. No R repeat quantity found.");
                return(3331);
            }
            else
            {
                // this will have a integer number
                retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetInteger(processedLineStr, nextStartPos, ref outInt, ref nextStartPos);
                if (retBool != true)
                {
                    LogMessage("ParseLine(R) failed on call to ParseNumberFromString_TillNonDigit_RetInteger");
                    return(3332);
                }
                else
                {
                    // set the value now
                    repeatCount = outInt;
                }
            }


            // LOOK FOR THE X TAG
            nextStartPos = 0;
            nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'X', nextStartPos);
            if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length))
            {
                // we have to have this
                LogMessage("ParseLine(R) lineNumber=" + LineNumber.ToString() + " failed. No X coordinate found.");
                return(1331);
            }
            else
            {
                // this will have a float number
                retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetFloat(processedLineStr, nextStartPos, ref outFloat, ref nextStartPos);
                if (retBool != true)
                {
                    // just means not found
                }
                else
                {
                    // set the value now
                    xOffset = DecimalScaleNumber(outFloat, stateMachine.ExcellonFileManager.DrillingNumberOfDecimalPlaces, stateMachine.ExcellonFileManager.DrillingCoordinateZerosMode);
                }
            }

            // LOOK FOR THE Y TAG
            nextStartPos = 0;
            nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'Y', nextStartPos);
            if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length))
            {
                // just means not found
            }
            else
            {
                // this will have a float number
                retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetFloat(processedLineStr, nextStartPos, ref outFloat, ref nextStartPos);
                if (retBool != true)
                {
                    LogMessage("ParseLine(R) failed on call to ParseNumberFromString_TillNonDigit_RetFloat");
                    return(2332);
                }
                else
                {
                    // set the value now
                    yOffset = DecimalScaleNumber(outFloat, stateMachine.ExcellonFileManager.DrillingNumberOfDecimalPlaces, stateMachine.ExcellonFileManager.DrillingCoordinateZerosMode);
                }
            }
            return(0);
        }