Пример #1
0
        public PrintModel copyPrintModel()
        {
            PrintModel stl = new PrintModel();

            stl.filename      = filename;
            stl.name          = name;
            stl.lastModified  = lastModified;
            stl.Position.x    = Position.x;
            stl.Position.y    = Position.y + 5 + yMax - yMin;
            stl.Position.z    = Position.z;
            stl.Scale.x       = Scale.x;
            stl.Scale.y       = Scale.y;
            stl.Scale.z       = Scale.z;
            stl.Rotation.x    = Rotation.x;
            stl.Rotation.y    = Rotation.y;
            stl.Rotation.z    = Rotation.z;
            stl.Selected      = false;
            stl.activeModel   = activeModel;
            stl.originalModel = originalModel.Copy();
            if (repairedModel != null)
            {
                stl.repairedModel = repairedModel.Copy();
            }
            else
            {
                stl.repairedModel = null;
            }
            stl.UpdateBoundingBox();
            return(stl);
        }
Пример #2
0
 public void Analyse(PrintModel pm) {
     TopoModel m = new TopoModel();
     m.Merge(pm.Model, pm.trans);
     infoVolume.Text = (0.001*m.Volume()).ToString("0.0000") + " cm³";
     infoSurface.Text = (0.01 * m.Surface()).ToString("0.0000") + " cm²";
     infoShells.Text = pm.Model.shells.ToString();
     infoPoints.Text = pm.Model.vertices.Count.ToString();
     infoEdges.Text = pm.Model.edges.Count.ToString();
     infoFaces.Text = pm.Model.triangles.Count.ToString();
     infoMinX.Text = m.boundingBox.minPoint.x.ToString("0.00")+" mm";
     infoMaxX.Text = m.boundingBox.maxPoint.x.ToString("0.00") + " mm";
     infoSizeX.Text = m.boundingBox.Size.x.ToString("0.00") + " mm";
     infoMinY.Text = m.boundingBox.minPoint.y.ToString("0.00") + " mm";
     infoMaxY.Text = m.boundingBox.maxPoint.y.ToString("0.00") + " mm";
     infoSizeY.Text = m.boundingBox.Size.y.ToString("0.00") + " mm";
     infoMinZ.Text = m.boundingBox.minPoint.z.ToString("0.00") + " mm";
     infoMaxZ.Text = m.boundingBox.maxPoint.z.ToString("0.00") + " mm";
     infoSizeZ.Text = m.boundingBox.Size.z.ToString("0.00") + " mm";
     groupBox1.Text = pm.name;
 }
Пример #3
0
        public PrintModel cloneWithModel(TopoModel m, int idx)
        {
            PrintModel stl = new PrintModel();

            stl.filename      = "";
            stl.name          = name + " (" + idx + ")";
            stl.lastModified  = lastModified;
            stl.Position.x    = Position.x;
            stl.Position.y    = Position.y;
            stl.Position.z    = Position.z;
            stl.Scale.x       = Scale.x;
            stl.Scale.y       = Scale.y;
            stl.Scale.z       = Scale.z;
            stl.Rotation.x    = Rotation.x;
            stl.Rotation.y    = Rotation.y;
            stl.Rotation.z    = Rotation.z;
            stl.Selected      = false;
            stl.activeModel   = 0;
            stl.originalModel = m;
            stl.repairedModel = null;
            stl.UpdateBoundingBox();
            return(stl);
        }
Пример #4
0
 public PrintModel cloneWithModel(TopoModel m,int idx)
 {
     PrintModel stl = new PrintModel();
     stl.filename = "";
     stl.name = name+" ("+idx+")";
     stl.lastModified = lastModified;
     stl.Position.x = Position.x;
     stl.Position.y = Position.y;
     stl.Position.z = Position.z;
     stl.Scale.x = Scale.x;
     stl.Scale.y = Scale.y;
     stl.Scale.z = Scale.z;
     stl.Rotation.x = Rotation.x;
     stl.Rotation.y = Rotation.y;
     stl.Rotation.z = Rotation.z;
     stl.Selected = false;
     stl.activeModel = 0;
     stl.originalModel = m;
     stl.repairedModel = null;
     stl.UpdateBoundingBox();
     return stl;
 }
Пример #5
0
 public PrintModel copyPrintModel()
 {
     PrintModel stl = new PrintModel();
     stl.filename = filename;
     stl.name = name;
     stl.lastModified = lastModified;
     stl.Position.x = Position.x;
     stl.Position.y = Position.y + 5 + yMax - yMin;
     stl.Position.z = Position.z;
     stl.Scale.x = Scale.x;
     stl.Scale.y = Scale.y;
     stl.Scale.z = Scale.z;
     stl.Rotation.x = Rotation.x;
     stl.Rotation.y = Rotation.y;
     stl.Rotation.z = Rotation.z;
     stl.Selected = false;
     stl.activeModel = activeModel;
     stl.originalModel = originalModel.Copy();
     if (repairedModel != null)
         stl.repairedModel = repairedModel.Copy();
     else
         stl.repairedModel = null;
     stl.UpdateBoundingBox();
     return stl;
 }
Пример #6
0
 static public void Execute(PrintModel pm)
 {
     ObjectInformation info = new ObjectInformation();
     info.Analyse(pm);
     info.Show(Main.main);
 }
Пример #7
0
 public void SetObjectSelected(PrintModel model, bool select)
 {
     foreach (ListViewItem item in listObjects.Items)
     {
         if (item.Tag == model)
             item.Selected = select;
     }
 }
Пример #8
0
        /// <summary>
        /// Checks the state of the object.
        /// If it is outside print are it starts pulsing
        /// </summary>
        public void updateSTLState(PrintModel stl2)
        {
            bool dataChanged = false;
            FormPrinterSettings ps = Main.printerSettings;
            stl2.UpdateBoundingBox();
            LinkedList<PrintModel> testList = ListObjects(false);
            foreach (PrintModel pm in testList)
            {
                pm.oldOutside = pm.outside;
                pm.outside = false;
            }
            foreach (PrintModel pm in testList)
            {
                foreach (PrintModel pm2 in testList)
                {
                    if (pm == pm2) continue;
                    if (pm2.bbox.IntersectsBox(pm.bbox))
                    {
                        pm.outside = true;
                        pm2.outside = true;
                    }
                }
            }
            foreach (PrintModel stl in testList)
            {
                if (!ps.PointInside(stl.xMin, stl.yMin, stl.zMin) ||
                    !ps.PointInside(stl.xMax, stl.yMin, stl.zMin) ||
                    !ps.PointInside(stl.xMin, stl.yMax, stl.zMin) ||
                    !ps.PointInside(stl.xMax, stl.yMax, stl.zMin) ||
                    !ps.PointInside(stl.xMin, stl.yMin, stl.zMax) ||
                    !ps.PointInside(stl.xMax, stl.yMin, stl.zMax) ||
                    !ps.PointInside(stl.xMin, stl.yMax, stl.zMax) ||
                    !ps.PointInside(stl.xMax, stl.yMax, stl.zMax))
                {
                    stl.outside = true;
                }
            }
            foreach (PrintModel pm in testList)
            {
                if (pm.oldOutside != pm.outside)
                {
                    dataChanged = true;
                    pm.ForceViewRegeneration();
                    if (Main.threeDSettings.pulseOutside.Checked)
                    {
                        if (!pm.hasAnimationWithName("pulse") && pm.outside)
                            pm.addAnimation(new PulseAnimation("pulse", 0.03, 0.03, 0.03, 0.3));
                        if (pm.hasAnimationWithName("pulse") && !pm.outside)
                            pm.removeAnimationWithName("pulse");
                    }
                }
            }

            if (dataChanged)
            {
                listObjects.Refresh();
            }
        }
Пример #9
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();
        }
Пример #10
0
 public void RemoveObject(PrintModel model)
 {
     ListViewItem item = null;
     foreach (ListViewItem test in listObjects.Items)
     {
         if (test.Tag == model)
         {
             item = test;
             break;
         }
     }
     if (item == null) return;
     Button trash = delButtonList[item];
     if (trash != null)
     {
         listObjects.Controls.Remove(trash);
         delButtonList.Remove(item);
     }
     foreach (Button b in delButtonList.Values)
         b.Visible = false;
     listObjects.Items.Remove(item);
     if (objectModelRemovedEvent != null)
         objectModelRemovedEvent(model);
 }
Пример #11
0
 public void AddObject(PrintModel model)
 {
     ListViewItem item = new ListViewItem(model.name);
     item.Tag = model;
     Button button = new Button();
     button.ImageList = imageList16;
     button.ImageIndex = 4;
     button.ImageAlign = ContentAlignment.MiddleCenter;
     button.Width = 16;
     button.Height = 16;
     button.TextImageRelation = TextImageRelation.Overlay;
     button.Text = "";
     button.Tag = model;
     button.FlatStyle = FlatStyle.Flat;
     button.FlatAppearance.BorderSize = 0;
     button.Click += buttonRemoveObject_Click;
     button.Visible = false;
     delButtonList.Add(item, button);
     item.SubItems.Add("");
     item.SubItems.Add("");
     item.SubItems.Add("");            
     listObjects.Controls.Add(button);
     listObjects.Items.Add(item);
     SetObjectSelected(model, true);
 }