Пример #1
0
        private void ModifyRadius_Click(object sender, EventArgs e)
        {
            ModifyRadius.Enabled = false;

            double radiusValue = (double)RadiusValue.Value;

            var geometryEnumerator = bentPlate.Geometry.GetGeometryEnumerator();

            while (geometryEnumerator.MoveNext())
            {
                if (geometryEnumerator.Current.GeometryNode is CylindricalSurfaceNode)
                {
                    break;
                }
            }

            if (geometryEnumerator.Current != null)
            {
                try
                {
                    BentPlateGeometrySolver solver = new BentPlateGeometrySolver();

                    var changedGeometry = solver.ModifyRadius(bentPlate.Geometry, geometryEnumerator.Current, radiusValue);

                    bentPlate.Geometry = changedGeometry;
                    bentPlate.Modify();
                    model.CommitChanges();
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Exception : ", Ex.ToString());
                }
            }
        }
 public static dynamic GetTSObject(BentPlateGeometrySolver dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Пример #3
0
        private void CreateByAddLegUsingSegments_Click(object sender, EventArgs e)
        {
            try
            {
                if (bentPlate != null)
                {
                    bentPlate.Delete();
                }

                var contour1 = new Contour();
                contour1.AddContourPoint(new ContourPoint(new Point(0, 0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 3000.0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(0, 3000.0, 0), null));

                ConnectiveGeometry geometry = new ConnectiveGeometry(contour1);

                var contour2 = new Contour();
                contour2.AddContourPoint(new ContourPoint(new Point(0, 6000.0, 1500.0), null));
                contour2.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 1500.0), null));
                contour2.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 4500.0), null));
                contour2.AddContourPoint(new ContourPoint(new Point(0, 6000.0, 4500.0), null));

                double radius = (double)RadiusForAddLegWithSegments.Value;

                LineSegment faceSegment1 = new LineSegment(new Point(500.0, 3000.0, 0), new Point(2500.0, 3000.0, 0));
                LineSegment faceSegment2 = new LineSegment(new Point(500.0, 6000.0, 1500.0), new Point(2500.0, 6000.0, 1500.0));

                BentPlateGeometrySolver solver = new BentPlateGeometrySolver();
                geometry = solver.AddLeg(geometry, faceSegment1, contour2, faceSegment2, radius);

                bentPlate = new BentPlate
                {
                    Name     = "Plate",
                    Material = { MaterialString = "S235JR" },
                    Profile  = { ProfileString = "PL20" }
                };

                bentPlate.Geometry = geometry;
                bentPlate.Insert();
                model.CommitChanges();
            }
            catch (Exception Ex)
            {
                Console.WriteLine("Exception : ", Ex.ToString());
            }
        }
Пример #4
0
        private void CreateSimpleBentPlate()
        {
            try
            {
                if (bentPlate != null)
                {
                    bentPlate.Delete();
                }

                var contour1 = new Contour();
                contour1.AddContourPoint(new ContourPoint(new Point(0, 0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 3000.0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(0, 3000.0, 0), null));

                ConnectiveGeometry geometry = new ConnectiveGeometry(contour1);

                var contour2 = new Contour();
                contour2.AddContourPoint(new ContourPoint(new Point(0, 6000.0, 1500.0), null));
                contour2.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 1500.0), null));
                contour2.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 4500.0), null));
                contour2.AddContourPoint(new ContourPoint(new Point(0, 6000.0, 4500.0), null));

                BentPlateGeometrySolver solver = new BentPlateGeometrySolver();
                geometry = solver.AddLeg(geometry, contour2);

                bentPlate = new BentPlate
                {
                    Name       = "Plate"
                    , Material = { MaterialString = "S235JR" }
                    , Profile  = { ProfileString = "PL20" }
                };

                bentPlate.Geometry = geometry;
                bentPlate.Insert();
                model.CommitChanges();
            }
            catch (Exception EX)
            {
                Console.WriteLine("Exception : ", EX.ToString());
            }
        }
Пример #5
0
        private void ModifyCylindricalSide_Click(object sender, EventArgs e)
        {
            ModifyCylindricalSide.Enabled = false;

            var geometryEnumerator = bentPlate.Geometry.GetGeometryEnumerator();

            CylindricalSurfaceNode cylindricalSection = null;

            while (geometryEnumerator.MoveNext())
            {
                if (geometryEnumerator.Current.GeometryNode is CylindricalSurfaceNode)
                {
                    cylindricalSection = geometryEnumerator.Current.GeometryNode as CylindricalSurfaceNode;
                    break;
                }
            }

            if (cylindricalSection != null)
            {
                try
                {
                    Vector      endFaceNormal1 = cylindricalSection.Surface.EndFaceNormal1;
                    Vector      endFaceNormal2 = cylindricalSection.Surface.EndFaceNormal2;
                    LineSegment sideBoundary1  = new LineSegment(new Point(500.0, 4500.0, 0), new Point(2500.0, 4500.0, 0));
                    LineSegment sideBoundary2  = new LineSegment(new Point(500.0, 6000.0, 1500.0), new Point(2500.0, 6000.0, 1500.0));

                    CylindricalSurface newCylindricalSurface = new CylindricalSurface(endFaceNormal1, endFaceNormal2, sideBoundary1, sideBoundary2);

                    BentPlateGeometrySolver solver = new BentPlateGeometrySolver();

                    var changedGeometry = solver.ModifyCylindricalSurface(bentPlate.Geometry, geometryEnumerator.Current, newCylindricalSurface);

                    bentPlate.Geometry = changedGeometry;
                    bentPlate.Modify();
                    model.CommitChanges();
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Exception : ", Ex.ToString());
                }
            }
        }
Пример #6
0
        private void ModifyPlateSide_Click(object sender, EventArgs e)
        {
            ModifyPlateSide.Enabled = false;

            var geometryEnumerator = bentPlate.Geometry.GetGeometryEnumerator();

            while (geometryEnumerator.MoveNext())
            {
                if (geometryEnumerator.Current.GeometryNode is PolygonNode)
                {
                    break;
                }
            }

            if (geometryEnumerator.Current != null)
            {
                var contour1 = new Contour();
                contour1.AddContourPoint(new ContourPoint(new Point(500.0, 0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(2000.0, 0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(2000.0, 3000.0, 0), null));
                contour1.AddContourPoint(new ContourPoint(new Point(500.0, 3000.0, 0), null));

                try
                {
                    BentPlateGeometrySolver solver = new BentPlateGeometrySolver();

                    var changedGeoMetry = solver.ModifyPolygon(bentPlate.Geometry, geometryEnumerator.Current, contour1);

                    bentPlate.Geometry = changedGeoMetry;
                    bentPlate.Modify();
                    model.CommitChanges();
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Exception : ", Ex.ToString());
                }
            }
        }
Пример #7
0
        private void CreateBoxUsingGeometry_Click(object sender, EventArgs e)
        {
            if (bentPlate != null)
            {
                bentPlate.Delete();
                bentPlate = null;
            }

            var bottomContour = new Contour();

            bottomContour.AddContourPoint(new ContourPoint(new Point(6000.0, 6000.0, 0), null));
            bottomContour.AddContourPoint(new ContourPoint(new Point(6000.0, 12000.0, 0), null));
            bottomContour.AddContourPoint(new ContourPoint(new Point(12000.0, 12000.0, 0), null));
            bottomContour.AddContourPoint(new ContourPoint(new Point(12000.0, 6000.0, 0), null));

            var contour1 = new Contour();

            contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 1500.0), null));
            contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 12000.0, 1500.0), null));
            contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 12000.0, 4500.0), null));
            contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 4500.0), null));

            var contour2 = new Contour();

            contour2.AddContourPoint(new ContourPoint(new Point(6000.0, 15000.0, 1500.0), null));
            contour2.AddContourPoint(new ContourPoint(new Point(12000.0, 15000.0, 1500.0), null));
            contour2.AddContourPoint(new ContourPoint(new Point(12000.0, 15000.0, 4500.0), null));
            contour2.AddContourPoint(new ContourPoint(new Point(6000.0, 15000.0, 4500.0), null));

            var contour3 = new Contour();

            contour3.AddContourPoint(new ContourPoint(new Point(15000.0, 6000.0, 1500.0), null));
            contour3.AddContourPoint(new ContourPoint(new Point(15000.0, 12000.0, 1500.0), null));
            contour3.AddContourPoint(new ContourPoint(new Point(15000.0, 12000.0, 4500.0), null));
            contour3.AddContourPoint(new ContourPoint(new Point(15000.0, 6000.0, 4500.0), null));

            var contour4 = new Contour();

            contour4.AddContourPoint(new ContourPoint(new Point(6000.0, 3000.0, 1500.0), null));
            contour4.AddContourPoint(new ContourPoint(new Point(12000.0, 3000.0, 1500.0), null));
            contour4.AddContourPoint(new ContourPoint(new Point(12000.0, 3000.0, 4500.0), null));
            contour4.AddContourPoint(new ContourPoint(new Point(6000.0, 3000.0, 4500.0), null));

            ConnectiveGeometry geometry = new ConnectiveGeometry(bottomContour);

            BentPlateGeometrySolver solver = new BentPlateGeometrySolver();

            LineSegment segment1 = new LineSegment(new Point(6000.0, 6000.0, 0), new Point(6000.0, 12000.0, 0));
            LineSegment segment2 = new LineSegment(new Point(3000.0, 6000.0, 1500.0), new Point(3000.0, 12000.0, 1500.0));

            geometry = solver.AddLeg(geometry, segment1, contour1, segment2);

            segment1 = new LineSegment(new Point(6000.0, 12000.0, 0), new Point(12000.0, 12000.0, 0));
            segment2 = new LineSegment(new Point(6000.0, 15000.0, 1500.0), new Point(12000.0, 15000.0, 1500.0));

            geometry = solver.AddLeg(geometry, segment1, contour2, segment2);

            segment1 = new LineSegment(new Point(12000.0, 6000.0, 0), new Point(12000.0, 12000.0, 0));
            segment2 = new LineSegment(new Point(15000.0, 6000.0, 1500.0), new Point(15000.0, 12000.0, 1500.0));

            geometry = solver.AddLeg(geometry, segment1, contour3, segment2);

            segment1 = new LineSegment(new Point(6000.0, 6000.0, 0), new Point(12000.0, 6000.0, 0));
            segment2 = new LineSegment(new Point(6000.0, 3000.0, 1500.0), new Point(12000.0, 3000.0, 1500.0));

            geometry = solver.AddLeg(geometry, segment1, contour4, segment2);

            bentPlate = new BentPlate
            {
                Name     = "Plate",
                Material = { MaterialString = "S235JR" },
                Profile  = { ProfileString = "PL100" }
            };

            bentPlate.Geometry = geometry;
            bentPlate.Insert();
            model.CommitChanges();
        }