/// <summary>
        /// Checks the state of the object.
        /// If it is outside print are it starts pulsing
        /// </summary>
        public void updateSTLState(STL stl)
        {
            FormPrinterSettings ps = Main.printerSettings;

            stl.UpdateBoundingBox();
            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;
                if (Main.threeDSettings.pulseOutside.Checked && !stl.hasAnimationWithName("pulse"))
                {
                    stl.addAnimation(new PulseAnimation("pulse", 0.03, 0.03, 0.03, 0.3));
                }
            }
            else
            {
                stl.outside = false;
                stl.removeAnimationWithName("pulse");
            }
        }
Ejemplo n.º 2
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();
            }
        }