OpenSCAD Sketch engine... concept

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

OpenSCAD Sketch engine... concept

I really enjoy openscad but I find its biggest limitation is how objects are drawn, how poorly it handles .dxfs and that the second you use a .dxf you lose parametric control of your dimensions.

I propose: A sketch engine.  I'll be the first to admit that I wouldn't know how to implement this into openscad, but I am attempting to produce a proof of concept.

I am currently writing a c# console app that uses a c# method to generate a dxf.  Here is an example of the c# code:

    public static class FirstSketch
        public static void SketchPad()
            Sketch s = new Sketch("OneBox");

            s.AddLine(0, 0, 0, 1, "Box");
            s.AddLine(0, 1, 1, 1, "Box");
            s.AddLine(1, 1, 1, 0, "Box");
            s.AddLine(1, 0, 0, 0, "Box");

            s.AddLine(3, 0, 3, 1, "Box2");
            s.AddLine(4, 1);
            s.AddLine(4, 0);
            s.AddLine(3, 0);

            s.AddBox(0, 3, 1, 4, "AddBox");

            s.AddPolygon(0, 0, 9, 0.5d, "Polygon");


And the resulting dxf. (It should be named OneBox, as in the string creating the new sketch, but I manually changed the name a few times to keep working dxf from non-working)


I have a long way to go, but my goal is to first get a reasonably useful c# script dxf generator, then try to figure out how to implement it.  

My long term thoughts on this would be for openscad objects to be optionally generated from C# scripting, and storing each sketch as a dxf in a project folder.  I don't see any point in reading the dxf, so it would only be as good as the last time the sketch script was run.