Exemplo n.º 1
0
 public PrinterSizeProfile(PrinterSizeProfile other)
 {
     case_type                = other.case_type;
     shell_size               = other.shell_size;
     printBedSize             = other.printBedSize;
     fluff_height             = other.fluff_height;
     PrintableRegion          = new StackedBoundingBox(other.PrintableRegion);
     WarningRegion            = new StackedBoundingBox(other.WarningRegion);
     UnhomedSafeZRange        = other.UnhomedSafeZRange;
     HomeLocation             = other.HomeLocation;
     ABSWarningDim            = other.ABSWarningDim;
     ZAfterProbing            = other.ZAfterProbing;
     ZAfterG33                = other.ZAfterG33;
     BackCornerPosition       = other.BackCornerPosition;
     BackCornerPositionBoxTop = other.BackCornerPositionBoxTop;
     BoxTopLimitZ             = other.BoxTopLimitZ;
     G32ProbePoints           = new SerializableDictionary <int, RectCoordinates>(other.G32ProbePoints);
 }
Exemplo n.º 2
0
 public PrinterSizeProfile(PrinterSizeProfile.CaseType case_type, Vector3D shell_size, Vector2D printBedSize, float fluff_height, StackedBoundingBox WarningRegion, StackedBoundingBox PrintableRegion, Range UnhomedSafeZRange, Vector3D HomeLocation, Vector2D BackCornerPosition, Vector2D BackCornerPositionBoxTop, float BoxTopLimitZ, float ABSWarningDim, float ZAfterProbing, float ZAfterG33, SerializableDictionary <int, RectCoordinates> G32ProbePoints)
 {
     this.case_type                = case_type;
     this.shell_size               = shell_size;
     this.printBedSize             = printBedSize;
     this.fluff_height             = fluff_height;
     this.WarningRegion            = WarningRegion;
     this.PrintableRegion          = PrintableRegion;
     this.UnhomedSafeZRange        = UnhomedSafeZRange;
     this.HomeLocation             = HomeLocation;
     this.ABSWarningDim            = ABSWarningDim;
     this.ZAfterProbing            = ZAfterProbing;
     this.ZAfterG33                = ZAfterG33;
     this.BackCornerPosition       = BackCornerPosition;
     this.BackCornerPositionBoxTop = BackCornerPositionBoxTop;
     this.BoxTopLimitZ             = BoxTopLimitZ;
     this.G32ProbePoints           = G32ProbePoints;
 }
Exemplo n.º 3
0
        private void ObjectWithinBounds(int selected_model_index)
        {
            ResetExceedBounds();
            lock (exceedsBoundsSync)
            {
                if (ModelList.Count <= 0 || selected_model_index < 0)
                {
                    return;
                }

                ModelTransformPair             model = ModelList[selected_model_index];
                List <M3D.Model.Utils.Vector3> usingTransformMatric = model.modelNode.CalculateBoundingUsingTransformMatric(model.transformNode.GetTransformationMatrix());
                StackedBoundingBox             printableRegion      = PrinterBoundsConst.PrintableRegion;
                foreach (M3D.Model.Utils.Vector3 vector3 in usingTransformMatric)
                {
                    var count = printableRegion.bounds_list.Count;
                    for (var index = 0; index < count; ++index)
                    {
                        if (vector3.Z >= (double)printableRegion.bounds_list[index].min.z && (index >= count - 1 || vector3.Z <= (double)printableRegion.bounds_list[index].max.z))
                        {
                            var num = printableRegion.bounds_list[index].OutOfBoundsCheck(vector3.X, vector3.Y, vector3.Z);
                            if ((num & 1) != 0)
                            {
                                ExceedsBoundsGeometry[index, 1].Visible = true;
                            }

                            if ((num & 2) != 0)
                            {
                                ExceedsBoundsGeometry[index, 0].Visible = true;
                            }

                            if ((num & 4) != 0)
                            {
                                ExceedsBoundsGeometry[index, 2].Visible = true;
                            }

                            if ((num & 8) != 0)
                            {
                                ExceedsBoundsGeometry[index, 3].Visible = true;
                            }

                            if ((num & 32) != 0 && index + 1 == printableRegion.bounds_list.Count)
                            {
                                ExceedsBoundsGeometry[index, 4].Visible = true;
                            }
                        }
                    }
                }
                ObjectExceedsBounds = false;
                for (var index1 = 0; index1 < ExceedsBoundsGeometry.GetLength(0) && !ObjectExceedsBounds; ++index1)
                {
                    for (var index2 = 0; index2 < ExceedsBoundsGeometry.GetLength(1) && !ObjectExceedsBounds; ++index2)
                    {
                        if (ExceedsBoundsGeometry[index1, index2] != null)
                        {
                            ObjectExceedsBounds = ExceedsBoundsGeometry[index1, index2].Visible;
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void CreateBoundsGeometry(Element3D parent)
        {
            lock (exceedsBoundsSync)
            {
                if (PrinterBoundsConst.PrintableRegion == null || PrinterBoundsConst.PrintableRegion.bounds_list.Count < 1)
                {
                    return;
                }

                StackedBoundingBox printableRegion = PrinterBoundsConst.PrintableRegion;
                if (ExceedsBoundsGeometry != null)
                {
                    for (var index1 = 0; index1 < ExceedsBoundsGeometry.GetLength(0); ++index1)
                    {
                        for (var index2 = 0; index2 < ExceedsBoundsGeometry.GetLength(1); ++index2)
                        {
                            parent.RemoveChildElement(ExceedsBoundsGeometry[index1, index2]);
                        }
                    }
                }
                List <BoundingBox> boundsList = printableRegion.bounds_list;
                ExceedsBoundsGeometry = new CustomShape[boundsList.Count, 6];
                var vertex_list = new List <VertexTNV>();
                for (var index = 0; index < boundsList.Count; ++index)
                {
                    var vector3_1 = new Model.Utils.Vector3(boundsList[index].min.x, boundsList[index].min.y, boundsList[index].min.z);
                    var vector3_2 = new M3D.Model.Utils.Vector3(boundsList[index].max.x, boundsList[index].max.y, boundsList[index].max.z);
                    ExceedsBoundsGeometry[index, 0] = new CustomShape(3006);
                    vertex_list.Clear();
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_2.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_2.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_2.Y, vector3_1.Z)));
                    ExceedsBoundsGeometry[index, 0].Create(vertex_list, 0);
                    BoundingBoxColoringHelper(ref ExceedsBoundsGeometry[index, 0]);
                    parent.AddChildElement(ExceedsBoundsGeometry[index, 0]);
                    ExceedsBoundsGeometry[index, 1] = new CustomShape(3007);
                    vertex_list.Clear();
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, -1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_1.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, -1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, -1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, -1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_1.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, -1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, -1f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_1.Y, vector3_1.Z)));
                    ExceedsBoundsGeometry[index, 1].Create(vertex_list, 0);
                    BoundingBoxColoringHelper(ref ExceedsBoundsGeometry[index, 1]);
                    parent.AddChildElement(ExceedsBoundsGeometry[index, 1]);
                    ExceedsBoundsGeometry[index, 2] = new CustomShape(3008);
                    vertex_list.Clear();
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_2.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_2.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_2.Y, vector3_1.Z)));
                    ExceedsBoundsGeometry[index, 2].Create(vertex_list, 0);
                    BoundingBoxColoringHelper(ref ExceedsBoundsGeometry[index, 2]);
                    parent.AddChildElement(ExceedsBoundsGeometry[index, 2]);
                    ExceedsBoundsGeometry[index, 3] = new CustomShape(3009);
                    vertex_list.Clear();
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(-1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_1.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(-1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(-1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(-1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_1.Y, vector3_2.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(-1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_1.Z)));
                    vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(-1f, 0.0f, 0.0f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_1.Y, vector3_1.Z)));
                    ExceedsBoundsGeometry[index, 3].Create(vertex_list, 0);
                    BoundingBoxColoringHelper(ref ExceedsBoundsGeometry[index, 3]);
                    parent.AddChildElement(ExceedsBoundsGeometry[index, 3]);
                    if (index + 1 == boundsList.Count)
                    {
                        ExceedsBoundsGeometry[index, 4] = new CustomShape(3010);
                        vertex_list.Clear();
                        vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 0.0f, 1f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_2.Z)));
                        vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 0.0f, 1f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_1.Y, vector3_2.Z)));
                        vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 0.0f, 1f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_2.Z)));
                        vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 0.0f, 1f), new M3D.Model.Utils.Vector3(vector3_2.X, vector3_2.Y, vector3_2.Z)));
                        vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 0.0f, 1f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_2.Y, vector3_2.Z)));
                        vertex_list.Add(new VertexTNV(new M3D.Model.Utils.Vector3(0.0f, 0.0f, 1f), new M3D.Model.Utils.Vector3(vector3_1.X, vector3_1.Y, vector3_2.Z)));
                        ExceedsBoundsGeometry[index, 4].Create(vertex_list, 0);
                        BoundingBoxColoringHelper(ref ExceedsBoundsGeometry[index, 4]);
                        parent.AddChildElement(ExceedsBoundsGeometry[index, 4]);
                    }
                }
            }
        }
Exemplo n.º 5
0
 public PrinterSizeProfile()
 {
     PrintableRegion = new StackedBoundingBox();
     WarningRegion   = new StackedBoundingBox();
     G32ProbePoints  = new SerializableDictionary <int, RectCoordinates>();
 }