Ejemplo n.º 1
0
        public void openAndAddObject(string file)
        {
            PrintModel model = new PrintModel();
            FileInfo   f     = new FileInfo(file);

            InfoProgressPanel ipp = InfoProgressPanel.Create(Trans.T1("IMPORTING_1", f.Name), true);

            ipp.Action = Trans.T("L_LOADING...");
            ipp.Dock   = DockStyle.Top;
            panelControls.Controls.Add(ipp);
            panelControls.Update();
            model.Load(file, ipp);
            model.Center(Main.printerSettings.PrintAreaWidth / 2, Main.printerSettings.PrintAreaDepth / 2);
            model.Land();
            if (model.ActiveModel.triangles.Count > 0)
            {
                AddObject(model);
                cont.models.AddLast(model);

                Autoposition();
                model.addAnimation(new DropAnimation("drop"));
                updateSTLState(model);
            }
            else
            {
                if (!ipp.IsKilled)
                {
                    MessageBox.Show(Trans.T1("L_LOADING_3D_FAILED", file), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            ipp.Finished();
        }
Ejemplo n.º 2
0
        public void AddModels(ModelFromFile fromFile, bool isNew)//(string fileName,byte[] data)
        {
            if (!availableModel)
            {
                availableGCode = false;
                gCode          = "";
                GCodeChange(gCode);
                InitSlicerView();
            }
            availableModel = true;
            IsChanged      = true;
            PrintModel model = new PrintModel(control, fromFile);

            model.Load(fromFile.Name, fromFile.Data);
            model.update();
            if (isNew)
            {
                model.Center(SettingsProvider.Instance.Printer_Settings.PrintAreaWidth / 2, SettingsProvider.Instance.Printer_Settings.PrintAreaDepth / 2);
                model.Land();
            }
            ModelList.Add(model);
            if (model.ActiveModel.triangles.Count > 0)
            {
                PreView.models.AddLast(model);

                if (isNew)
                {
                    Allocate(model);
                    model.addAnimation(new DropAnimation("drop"));
                }

                updateSTLState(model);
            }
        }