public static dynamic GetTSObject(ConnectiveGeometry dynObject) { if (dynObject is null) { return(null); } return(dynObject.teklaObject); }
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()); } }
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()); } }
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(); }