示例#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();
        }