Exemplo n.º 1
0
        private static void MoveAndScaleAndWriteToFile(CsgObject o, string filename)
        {
            try
            {
                Axes   longestAxis   = Axes.X;
                double longestExtent = double.MinValue;
                if (o.XSize > longestExtent)
                {
                    longestExtent = o.XSize;
                    longestAxis   = Axes.X;
                }
                if (o.YSize > longestExtent)
                {
                    longestExtent = o.YSize;
                    longestAxis   = Axes.Y;
                }
                if (o.ZSize > longestExtent)
                {
                    longestExtent = o.ZSize;
                    longestAxis   = Axes.Z;
                }

                double ratio = 200.0 / longestExtent;
                Scale  s     = new Scale(o, new Vector3(ratio, ratio, ratio));
                OpenSCadOutput.Save(s, filename);
            }
            catch (Exception)
            {
                throw;
                //this will get ignored at the next level. If we can't scale it we probs don't want it anyway, at this point...
            }
        }
        static void Main()
        {
            CsgObject dialGauge = DialGaugeMount();

            OpenSCadOutput.Save(dialGauge, "DialGaugeMount.scad");
            OpenSCadOutput.Save(new Rotate(dialGauge, 0, MathHelper.DegreesToRadians(180)), "DialGaugeMountRotatedForPrint.scad");
        }
        static void Main()
        {
            CsgObject part = SimplePartFunction();

            OpenSCadOutput.Save(part, "temp.scad");

            System.Console.WriteLine("Output the file to 'temp.scad'.");
        }
        static void Main()
        {
            Matrix4X4 rotateAboutZ = Matrix4X4.CreateRotationZ(MathHelper.DegreesToRadians(2));

            CsgObject tPBinoculars = TPBinoculars();

            OpenSCadOutput.Save(tPBinoculars, "TPBinoculars.scad");
        }
Exemplo n.º 5
0
        static void Main()
        {
            OpenSCadOutput.Save(MakeOne(), "PowerSupplyMountingFoot.scad");

            double    spacing = 5;
            CsgObject foot    = MakeOne();
            CsgObject total   = foot;

            total += new Translate(foot, foot.XSize + spacing);
            total += new Translate(foot, 0, foot.YSize + spacing);
            total += new Translate(foot, foot.XSize + spacing, foot.YSize + spacing);
            OpenSCadOutput.Save(total, "PowerSupplyMountingFoot 4.scad");
        }
 private void outputScad_Click(object sender, EventArgs e)
 {
     if (previousRender != null)
     {
         SaveFileDialogParams saveParams = new SaveFileDialogParams("Text files (*.scad)|*.scad");
         FileDialog.SaveFileDialog(saveParams, (streamToSaveTo) =>
         {
             if (streamToSaveTo != null)
             {
                 OpenSCadOutput.Save(previousRender, streamToSaveTo.FileName);
             }
         });
     }
 }
 private void OutputScad_Click(object sender, EventArgs e)
 {
     if (rootUnion != null)
     {
         SaveFileDialogParams saveParams = new SaveFileDialogParams("Text files (*.scad)|*.scad");
         FileDialog.SaveFileDialog(saveParams, (streamToSaveTo) =>
         {
             if (streamToSaveTo != null)
             {
                 OpenSCadOutput.Save(rootUnion, streamToSaveTo.FileName);//"c:/output.scad")
             }
         });
     }
 }
Exemplo n.º 8
0
        void outputScad_Click(object sender, MouseEventArgs mouseEvent)
        {
            if (matterScriptEditor.Text == "")
            {
                loadFile_Click(sender, mouseEvent);
            }

            CsgObject testObject = ParseScript();

            if (testObject != null)
            {
                GuiHalWidget.SaveFileDialogParams saveParams = new GuiHalWidget.SaveFileDialogParams("Scad part file (*.scad)", "*.scad");
                Stream streamToSaveTo = GuiHalFactory.PrimaryHalWidget.SaveFileDialog(saveParams);

                if (streamToSaveTo != null)
                {
                    OpenSCadOutput.Save(Utilities.PutOnPlatformAndCenter(testObject), streamToSaveTo);
                }
            }
        }
        static void Main()
        {
            CsgObject bedLevelMount = Render();

            OpenSCadOutput.Save(bedLevelMount, "z-probe-mount.scad");

            CsgObject onOffArm = OnOffArm();

            OpenSCadOutput.Save(onOffArm, "up-down-bar.scad");

            bedLevelMount += new Translate(new Rotate(onOffArm, MathHelper.DegreesToRadians(90)), 14, -5, 13);
            CsgObject mount          = new Rotate(bedLevelMount, MathHelper.DegreesToRadians(90));
            CsgObject mountRotations = new Rotate(mount, y: MathHelper.DegreesToRadians(-90));

            mountRotations += new Rotate(mount, y: MathHelper.DegreesToRadians(-170));
            mountRotations  = new Translate(mountRotations, 6, -3.5, -30);

            CsgObject bedLevelMountMount = MountMount();

            bedLevelMountMount += new Translate(mountRotations, -6, 3.5, 45, "%up part");

            OpenSCadOutput.Save(bedLevelMountMount, "x-carriage-addition.scad");
        }
 static void Main()
 {
     OpenSCadOutput.Save(StepArm(), "hobbit step arm.scad");
 }
Exemplo n.º 11
0
        static void Main()
        {
            CsgObject bedLevelMount = Render();

            OpenSCadOutput.Save(bedLevelMount, "test.scad");
        }
 static void Main()
 {
     // an internal function to save as an .scad file
     OpenSCadOutput.Save(TrackConnecor(), "TrackConnector.scad");
 }
        static void Main()
        {
            CsgObject spoolBarHolderM90 = SpoolBarHolderM90();

            OpenSCadOutput.Save(spoolBarHolderM90, "SpoolBarHolderM90.scad");
        }
Exemplo n.º 14
0
 static void Main()
 {
     OpenSCadOutput.Save(SpoolBearingHolder(new EsunSmallSpool()), "SpoolBearingHolder.scad");
     OpenSCadOutput.Save(SpoolBearingHolder(new PackingBagSpool()), "PackingBagsBearingHolder.scad");
 }