Ejemplo n.º 1
0
        internal LensWarpCorrectionModel(string text) : base(TypeObject.Model, true)
        {
            this.Triangles = new TriangleInfoList();

            var width  = 12.8 * 10;
            var height = 8 * 10;

            var cubeIndex = 1;

            for (var rowIndex = 0; rowIndex < 7; rowIndex++)
            {
                for (var columnIndex = 0; columnIndex < 7; columnIndex++)
                {
                    CreateMeasureCube(new Vector2(-83.6f + (columnIndex * 25.6f) + 12.8f, -(52) + (rowIndex * 16) + 8f), cubeIndex.ToString(), width, height);

                    cubeIndex++;
                }
            }

            //this.Triangles[0].AddRange((new Cube(192f, 120f, 0.2f)).AsSTLModel3D(new DAL.Materials.Material()).Triangles[0]);

            this.UpdateBoundries();
            this.SupportBasement = true;
            this.BindModel();
            this.UpdateBinding();
            this.Loaded = true;
            this._color = Color.FromArgb(ObjectView.NextObjectIndex, Color.Gray);



            ObjectView.AddModel(this);
        }
Ejemplo n.º 2
0
        private void RenderJob()
        {
            this.Enabled = false;

            var t = new BackgroundWorker();

            _waitWindowManager = new WaitWindowManager();
            _waitWindowManager.Start(this, t);
            if (t != null)
            {
                t.ReportProgress(0, new WaitWindowUserState(0.01d, "Loading calibration model"));
            }
            Application.DoEvents();

            t.DoWork += new DoWorkEventHandler(RenderJobAsync);

            //load calibration model
            ObjectView.Objects3D.Clear();
            SceneView.UpdateGroundPane(); //ZIE ONDER

            //SavePrinter = PrinterManager.DefaultPrinter;
            this._selectedPrinter.Selected = true;
            PrinterManager.Append((AtumPrinter)(this._selectedPrinter));
            PrinterManager.SetDefaultPrinter((AtumPrinter)this._selectedPrinter);


            BasicCorrectionModel basicCorrection = new BasicCorrectionModel();

            basicCorrection.Open((string)null, false, printerConnectionMaterialTabPanel1.SelectedMaterial.ModelColor, ObjectView.NextObjectIndex, basicCorrection.Triangles);
            basicCorrection.UpdateBoundries();
            basicCorrection.UpdateSelectionboxText();
            if (ObjectView.BindingSupported)
            {
                basicCorrection.BindModel();
            }
            ObjectView.AddModel((object)basicCorrection);
            Application.DoEvents();
            // System.Threading.Thread.Sleep(250);

            //let op hier nog op null printer (initieel) checken

            t.RunWorkerAsync();
        }
Ejemplo n.º 3
0
        private void RenderJob(Material selectedMaterial, AtumPrinter selectedPrinter, DriveInfo selectedDrive)
        {
            //load calibration model
            for (var objectViewModelIndex = ObjectView.Objects3D.Count - 1; objectViewModelIndex > 1; objectViewModelIndex--)
            {
                ObjectView.Objects3D.RemoveAt(objectViewModelIndex);
            }

            RenderEngine.PrintJob                 = new DAL.Print.PrintJob();
            RenderEngine.PrintJob.Name            = "Calibration";
            RenderEngine.PrintJob.Material        = selectedMaterial;
            RenderEngine.PrintJob.SelectedPrinter = this.AtumPrinter;


            var basicCorrection = new BasicCorrectionModel();

            basicCorrection.Open((string)null, false, selectedMaterial.ModelColor, ObjectView.NextObjectIndex, basicCorrection.Triangles, enableProgressStatus: false);
            basicCorrection.UpdateBoundries();
            for (var modelIndex = ObjectView.Objects3D.Count - 1; modelIndex > 0; modelIndex--)
            {
                ObjectView.Objects3D.RemoveAt(modelIndex);
            }
            ObjectView.AddModel(basicCorrection, false, false, false);

            RenderEngine.RenderAsync();

            try
            {
                while (RenderEngine.TotalAmountSlices != RenderEngine.TotalProcessedSlices && !RenderEngine.PrintJob.PostRenderCompleted)
                {
                    var progress = (((decimal)RenderEngine.TotalProcessedSlices / (decimal)RenderEngine.TotalAmountSlices) * 100);
                    Thread.Sleep(250);
                }
            }
            catch (Exception exc)
            {
                Atum.DAL.Managers.LoggingManager.WriteToLog("GeneratePrintJobAsync", "Exc", exc);
                new frmMessageBox("GeneratePrintJobAsync", exc.Message, MessageBoxButtons.OK, MessageBoxDefaultButton.Button2).ShowDialog();
            }

            try
            {
                var usbPrintjobPath = string.Format(@"{0}{1}", selectedDrive.Name, RenderEngine.PrintJob.Name);

                var pathPrinterJobXml = Path.Combine(Path.GetTempPath(), "printjob.xml"); //serialize first to temp
                var serializer        = new System.Xml.Serialization.XmlSerializer(typeof(DAL.Print.PrintJob));
                using (var streamWriter = new StreamWriter(pathPrinterJobXml, false))
                {
                    serializer.Serialize(streamWriter, RenderEngine.PrintJob);
                }

                var pathPrinterJobChecksumXml = Path.Combine(System.IO.Path.GetTempPath(), "checksum.crc");
                using (var checksumWriter = new StreamWriter(pathPrinterJobChecksumXml, false))
                {
                    checksumWriter.WriteLine(DateTime.Now.Ticks.ToString());
                }
                var osPathSeparator = "\\";
                if (!Directory.Exists(usbPrintjobPath))
                {
                    Directory.CreateDirectory(usbPrintjobPath);
                }

                var zipCopied = false;
                while (!zipCopied)
                {
                    try
                    {
                        File.Copy(RenderEngine.PrintJob.SlicesPath, usbPrintjobPath + osPathSeparator + "slices.zip", true);
                        File.Copy(pathPrinterJobXml, usbPrintjobPath + osPathSeparator + "printjob.apj", true);
                        File.Copy(pathPrinterJobChecksumXml, usbPrintjobPath + osPathSeparator + "checksum.crc", true);

                        zipCopied = true;
                    }
                    catch
                    {
                        Thread.Sleep(250);
                    }
                }
            }
            catch (Exception exc)
            {
                new frmMessageBox("Failed to save printjob", "Failed to save printjob", MessageBoxButtons.OK, MessageBoxDefaultButton.Button2).ShowDialog();
            }
        }