Giter Club home page Giter Club logo

grbl-drills-cambam's People

Contributors

garciasa avatar

Stargazers

 avatar

Watchers

 avatar  avatar

grbl-drills-cambam's Issues

How is the script implemented.

There are a number of different methods in which a user could use the script, it has not been made clear where the script is to be used. Are you creating a macro with the script, are you importing the scrip into Cambam via the root script folder or are you replacing the Drill GCode operation within the post processor - OR does it run as a stand alone script somehow. Some more information would be most valuable.

Didn't parse correctly

It didn't parse it correctly so I corrected it and then I added some updates to it. I coded it in c# since that's easier for me:

    static void Main(string[] args)
    {
        String noCutSpeed = "300";
        String noCutDepth = "2.0";

        String cutSpeed = "80";
        String cutDepth = "-2.0";

        String markDepth = "-0.01";

        String inputfile = "";
        String outputfile = "";

        bool justMark = false;
        for(int i = 0; i < args.Length; i++)
        {
            String arg = args[i];
            switch(arg)
            {
            case "-h":
                // exit
                break;
            case "-i":
            case "--ifile":
                inputfile = args[i+1];
                break;
            case "-o":
            case "--ofile":
                outputfile = args[i+1];
                break;
            case "-m":
            case "--justMark":
                justMark = true;
                break;
            default:
                Console.WriteLine("unhandled option");
                break;
            }
        }

        if(File.Exists(inputfile))
        {
            StreamReader fin = new StreamReader(inputfile);
            StreamWriter fout = new StreamWriter(outputfile);

            do
            {
                String line = fin.ReadLine();
                bool modified = false;
                String temp = "";
                String[] commands = line.Split(' ');
                if (commands[0] == "G81")
                {
                    // Start conversion
                    if (justMark)
                        temp = "G1 Z" + markDepth + " F" + noCutSpeed + "\n";
                    else
                    {
                        temp = "G1 ";
                        for (int i = 1; i < commands.Length; i++)
                            if (commands[i].Contains('X') ||
                                commands[i].Contains('Y'))
                                temp += commands[i] + " ";
                            else if (commands[i].Contains('Z'))
                                temp += "Z" + noCutDepth + " ";
                        temp += "F" + noCutSpeed + "\n";
                    }
                    modified = true;
                }

                if(commands[0] == "G98")
                    modified = true;

                if(commands[0] == "G80")
                {
                    temp = "G1 Z" + noCutDepth + "\n";
                    modified = true;
                }

                if(modified)
                    fout.WriteLine(temp);
                else
                    fout.WriteLine(line);
                if (commands[0] == "G81")
                {
                    fout.WriteLine("G1 Z" + cutDepth + " F" + cutSpeed);
                    fout.WriteLine("G1 Z" + noCutDepth + " F" + noCutSpeed);
                }
            }
            while (fin.Peek() != -1);
            fin.Close();
            fout.Close();
        }
        else
        {
            printUsage();
        }
    }

    public static void printUsage()
    {
        Console.WriteLine("convertCamBamDrills.exe -i <inputfile> -o <outputfile> [-m]");
        Console.WriteLine("\t-i or --ifile\t<inputfile> File with cambam gcodes");
        Console.WriteLine("\t-o or --ofile\t<outputfile> Outfile with drills converted");
        Console.WriteLine("\t-m or --justMark\tJust mark the hole");
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.