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