private void CreateSampleBentPlateByFaces_Click(object sender, EventArgs e) { try { IList <Point> face1 = new List <Point> { new Point(0, 3000.0, -10.0), new Point(0, 3000.0, 10.0), new Point(3000.0, 3000.0, 10.0), new Point(30000.0, 3000.0, -10) }; IList <Point> face2 = new List <Point> { new Point(0, 6010.0, 1500.0), new Point(0, 5990.0, 1500.0), new Point(3000.0, 5990.0, 1500.0), new Point(3000.0, 6010.0, 1500.0) }; if (samplePlate1 != null && samplePlate2 != null) { bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByFaces(samplePlate1, face1, samplePlate2, face2); model.CommitChanges(); } else { CreateMaxRadiusBendPlate.Enabled = false; } } catch (Exception Ex) { Console.WriteLine("Exception : ", Ex.ToString()); } }
private void CreateBentPlateWithGivenRadius_Click(object sender, EventArgs e) { try { if (samplePlate1 != null && samplePlate2 != null) { double radius = (double)this.radiusValue.Value; if (radius < 100.0 && radius > 1500.0) { bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByParts(samplePlate1, samplePlate2, 600.0); } else { bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByParts(samplePlate1, samplePlate2, radius); } model.CommitChanges(); } else { CreateMaxRadiusBendPlate.Enabled = false; } } catch (Exception Ex) { Console.WriteLine("Exception : " + Ex.ToString()); } }
public Form1() { #region Initialize InitializeComponent(); bentPlate = null; samplePlate1 = null; samplePlate2 = null; model = new Model(); #endregion #region Event : Click CreateSamplePlatesButton.Click += CreateSamplePlatesButton_Click; CreateMaxRadiusBendPlate.Click += CreateMaxRadiusBendPlate_Click; CreateSamplePlatesButton2.Click += CreateSamplePlatesButton2_Click; CreateBentPlateWithGivenRadius.Click += CreateBentPlateWithGivenRadius_Click; CreateByFacesSamplePlates.Click += CreateByFacesSamplePlates_Click; CreateSampleBentPlateByFaces.Click += CreateSampleBentPlateByFaces_Click; SimpleCreateByAddLeg.Click += SimpleCreateByAddLeg_Click; CreateByAddLegWithRadius.Click += CreateByAddLegWithRadius_Click; CreateByAddLegUsingSegments.Click += CreateByAddLegUsingSegments_Click; #endregion }
public static dynamic GetTSObject(BentPlate dynObject) { if (dynObject is null) { return(null); } return(dynObject.teklaObject); }
private void CreateBendWithRadius(ContourPlate plate1, Tekla.Structures.Solid.Face face1, ContourPlate plate2, Tekla.Structures.Solid.Face face2, double radius) { if (bentPlate == null) { bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByFaces(plate1, face1, plate2, face2, radius); } else { bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByFaces(bentPlate, face1, plate2, face2, radius); } }
private void CreateContourPlates_Click(object sender, EventArgs e) { if (bentPlate != null) { bentPlate.Delete(); bentPlate = null; } CreatePlatesForBox(); CreateBends.Enabled = true; CreateBoxWithCustomRadius.Enabled = true; }
private void CheckAndCreateSamplePlates() { if (!CreateMaxRadiusBendPlate.Enabled) { CreateMaxRadiusBendPlate.Enabled = true; } if (bentPlate != null) { bentPlate.Delete(); bentPlate = null; } CreateSamplePlates(); }
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()); } }
public Form1() { InitializeComponent(); this.bentPlate = null; this.bottomPlate = null; this.sidePlate1 = null; this.sidePlate2 = null; this.sidePlate3 = null; this.sidePlate4 = null; this.model = new Model(); CreateContourPlates.Click += CreateContourPlates_Click; CreateBends.Click += CreateBends_Click; CreateBoxUsingGeometry.Click += CreateBoxUsingGeometry_Click; CreateBoxUsingGeometryAndRadius.Click += CreateBoxUsingGeometryAndRadius_Click; }
private void CreateMaxRadiusBendPlate_Click(object sender, EventArgs e) { try { if (samplePlate1 != null && samplePlate2 != null) { bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByParts(samplePlate1, samplePlate2); model.CommitChanges(); } else { CreateMaxRadiusBendPlate.Enabled = false; } } 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()); } }
public Form1() { #region Initialize InitializeComponent(); bentPlate = null; model = new Model(); #endregion #region Event : Click CreateSimpleBentPlate1.Click += CreateSimpleBentPlate1_Click; ModifyPlateSide.Click += ModifyPlateSide_Click; CreateSimpleBentPlate2.Click += CreateSimpleBentPlate2_Click; ModifyRadius.Click += ModifyRadius_Click; CreateSimpleBentPlate3.Click += CreateSimpleBentPlate3_Click; ModifyCylindricalSide.Click += ModifyCylindricalSide_Click; #endregion }
private void CreateBends_Click(object sender, EventArgs e) { CreateBends.Enabled = false; CreateBoxWithCustomRadius.Enabled = false; if (bentPlate != null) { bentPlate.Delete(); bentPlate = null; } if (bottomPlate != null && sidePlate1 != null && sidePlate2 != null && sidePlate3 != null && sidePlate4 != null) { var bottomFacesEnum = bottomPlate.GetSolid().GetFaceEnumerator(); while (bottomFacesEnum.MoveNext()) { if (bottomFacesEnum.Current.Normal.Y > 0) { var plateBottomFace = GetPlateBottomFace(sidePlate2.GetSolid().GetFaceEnumerator()); CreateBend(bottomPlate, bottomFacesEnum.Current, sidePlate2, plateBottomFace); } else if (bottomFacesEnum.Current.Normal.Y < 0) { var plateBottomFace = GetPlateBottomFace(sidePlate4.GetSolid().GetFaceEnumerator()); CreateBend(bottomPlate, bottomFacesEnum.Current, sidePlate4, plateBottomFace); } if (bottomFacesEnum.Current.Normal.X > 0) { var plateBottomFace = GetPlateBottomFace(sidePlate3.GetSolid().GetFaceEnumerator()); CreateBend(bottomPlate, bottomFacesEnum.Current, sidePlate3, plateBottomFace); } else if (bottomFacesEnum.Current.Normal.X < 0) { var plateBottomFace = GetPlateBottomFace(sidePlate1.GetSolid().GetFaceEnumerator()); CreateBend(bottomPlate, bottomFacesEnum.Current, sidePlate1, plateBottomFace); } } model.CommitChanges(); } }
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(); }