示例#1
0
        public static toolProp setDefault()
        {
            toolProp tmp = new toolProp();

            tmp.X     = 0; tmp.Y = 0; tmp.Z = 0; tmp.diameter = 3; tmp.feedXY = 100; tmp.feedZ = 100;
            tmp.stepZ = -1; tmp.spindleSpeed = 1000; tmp.overlap = 100;
            return(tmp);
        }
示例#2
0
        public static void Tool(StringBuilder gcodeString, int toolnr, string cmt = "")
        {
            string toolCmd = "";

            if (gcodeToolChange)                // otherweise no command needed
            {
                if (gcodeZApply)
                {
                    gcode.SpindleOff(gcodeString, "Stop spindle - Option Z-Axis");
                }
                if (cmt.Length > 0)
                {
                    cmt = string.Format("({0})", cmt);
                }
                toolCmd = string.Format("T{0:D2} M{1} {2}", toolnr, frmtCode(6), cmt);
                if (gcodeToolChangeM0)
                {
                    gcodeString.AppendFormat("M0 ({0})\r\n", toolCmd);
                }
                else
                {
                    gcodeString.AppendFormat("{0}\r\n", toolCmd);
                }
                gcodeToolCounter++;
                gcodeLines++;
                gcodeToolText += string.Format("( {0}) ToolNr: {1:D2}, Name: {2})\r\n", gcodeToolCounter, toolnr, cmt);

                remainingC = (float)Properties.Settings.Default.importGCLineSegmentLength;

                toolProp toolInfo = toolTable.getToolProperties(toolnr);
                if (Properties.Settings.Default.importGCTTSSpeed)
                {
                    gcodeSpindleSpeed = toolInfo.spindleSpeed;
                }
                if (Properties.Settings.Default.importGCTTXYFeed)
                {
                    gcodeXYFeed = toolInfo.feedXY;
                }
                if (Properties.Settings.Default.importGCTTZFeed)
                {
                    gcodeZFeed = toolInfo.feedZ;
                }
                if (Properties.Settings.Default.importGCTTZDeepth)
                {
                    gcodeZDown = toolInfo.stepZ;
                }

                if (Properties.Settings.Default.importGCDragKnifePercentEnable)
                {
                    gcodeDragRadius = Math.Abs(gcodeZDown * (float)Properties.Settings.Default.importGCDragKnifePercent / 100);
                }

                if (gcodeZApply)
                {
                    gcode.SpindleOn(gcodeString, "Start spindle - Option Z-Axis");
                }
            }
        }
示例#3
0
        private static string convertDXF(string txt)
        {
            drawingList      = new ArrayList();
            objectIdentifier = new ArrayList();
            gcodeStringIndex = 0;
            gcodeString[gcodeStringIndex] = new StringBuilder();
            gcodeString[gcodeStringIndex].Clear();
            importUnitmm = Properties.Settings.Default.importUnitmm;

            dxfBezierAccuracy = (int)Properties.Settings.Default.importSVGBezier;
            gcodeReduce       = Properties.Settings.Default.importSVGReduce;
            gcodeReduceVal    = (double)Properties.Settings.Default.importSVGReduceLimit;

            gcodeZIncEnable = Properties.Settings.Default.importGCZIncEnable;
            gcodeZIncrement = (double)Properties.Settings.Default.importGCZIncrement;

            dxfPauseElement = Properties.Settings.Default.importSVGPauseElement;
            dxfPausePenDown = Properties.Settings.Default.importSVGPausePenDown;
            dxfComments     = Properties.Settings.Default.importSVGAddComments;

            gcodeToolChange = Properties.Settings.Default.importGCTool;
            dxfColor        = -1;
            int dxfToolIndex = toolTable.init();

            gcode.setup();  // initialize GCode creation (get stored settings for export)
            if (Properties.Settings.Default.importGCTool && !Properties.Settings.Default.importDXFToolIndex)
            {
                toolProp tmpTool = toolTable.getToolProperties((int)Properties.Settings.Default.importGCToolDefNr);
                gcode.Tool(gcodeString[gcodeStringIndex], tmpTool.toolnr, tmpTool.name);
            }

            GetVectorDXF();

            string header = gcode.GetHeader("DXF import", txt);
            string footer = gcode.GetFooter();

            gcodeUseSpindle = Properties.Settings.Default.importGCZEnable;

            finalString.Clear();

            if (gcodeUseSpindle)
            {
                gcode.SpindleOn(finalString, "Start spindle - Option Z-Axis");
            }
            finalString.Append(gcodeString[0]);     //.Replace(',', '.')
            if (gcodeUseSpindle)
            {
                gcode.SpindleOff(finalString, "Stop spindle - Option Z-Axis");
            }

            string output = "";

            if (Properties.Settings.Default.importSVGRepeatEnable)
            {
                for (int i = 0; i < Properties.Settings.Default.importSVGRepeat; i++)
                {
                    output += finalString.ToString().Replace(',', '.');
                }

                return(header + output + footer);
            }
            else
            {
                return(header + finalString.ToString().Replace(',', '.') + footer);
            }
        }