Exemplo n.º 1
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.º 2
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.º 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)
        {
            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);
        }