public void CK07_Polybeam()
        {
            ArrayList PickedPoints = null;
            Picker    Picker       = new Picker();

            try
            {
                PickedPoints = Picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON);
            }
            catch { PickedPoints = null; }
            if (PickedPoints != null)
            {
                PolyBeam ThisPolyBeam = new PolyBeam();
                ThisPolyBeam.Profile.ProfileString = mw.prfStr;
                ThisPolyBeam.Name   = "CURVED PLATE";
                ThisPolyBeam.Finish = "GALVANIZED";
                ThisPolyBeam.Class  = "6";
                ThisPolyBeam.AssemblyNumber.Prefix      = "P";
                ThisPolyBeam.AssemblyNumber.StartNumber = 1;
                ThisPolyBeam.PartNumber.Prefix          = "m";
                ThisPolyBeam.Material.MaterialString    = "C245";
                ThisPolyBeam.Position.Depth             = Position.DepthEnum.FRONT;
                ThisPolyBeam.Position.Plane             = Position.PlaneEnum.MIDDLE;
                ThisPolyBeam.Position.Rotation          = Position.RotationEnum.TOP;
                if (PickedPoints.Count == 3)
                {
                    ThisPolyBeam.AddContourPoint(new ContourPoint(PickedPoints[0] as T3D.Point, null));
                    ThisPolyBeam.AddContourPoint(new ContourPoint(PickedPoints[1] as T3D.Point, new Chamfer(0, 0, Chamfer.ChamferTypeEnum.CHAMFER_ARC_POINT)));
                    ThisPolyBeam.AddContourPoint(new ContourPoint(PickedPoints[2] as T3D.Point, null));
                    mw.Msg("Выбрано 3 точки; по ним строится дуговая балка.   [OK]");
                }
                else
                {
                    foreach (T3D.Point ThisPoint in PickedPoints)
                    {
                        ThisPolyBeam.AddContourPoint(new ContourPoint(ThisPoint, null));
                    }
                    mw.Msg($"Выбрано {PickedPoints.Count} точек. Фаски составной балки отсутствуют.  [OK]");
                }
                ThisPolyBeam.Insert();
            }
            Model.GetWorkPlaneHandler()
            .SetCurrentTransformationPlane(new TransformationPlane());
            ViewHandler.SetRepresentation("standard"); //PKh> should be add for Tekla-2018
            Model.CommitChanges();

//            mw.Msg("  [OK]");
            MessageBox.Show("Построена составная балка.");
            mw.Msg();
        }
Esempio n. 2
0
 public void createconnection(Point center_point, ArrayList Gratting_assembly_arraylist)
 {
     foreach (Identifier ID in Gratting_assembly_arraylist)
     {
         Part part1 = (Part)this.myModel.SelectModelObject(ID);
         this.myModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
         this.myModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
         this.Get_Lower_face_edge(part1);
         string Partprofile1;
         string Partprofile2;
         if (this.data.holeType == 0)
         {
             Partprofile1 = "ROD" + (this.data.holeDiam - this.data.Plate_h).ToString();
             Partprofile2 = "ROD" + this.data.holeDiam.ToString();
         }
         else
         {
             Partprofile1 = this.data.hole_L.ToString() + "*" + this.data.hole_w.ToString();
             Partprofile2 = Partprofile1;
         }
         Assembly assembly = part1.GetAssembly();
         assembly.SetMainPart(part1);
         ArrayList secondaries = assembly.GetSecondaries();
         for (int index = 0; index < secondaries.Count; ++index)
         {
             if (secondaries[index].GetType().Name == "PolyBeam")
             {
                 secondaries.RemoveAt(secondaries.IndexOf(secondaries[index]));
                 if (index > 0)
                 {
                     --index;
                 }
                 else
                 {
                     index = 0;
                 }
                 if (secondaries.Count == 0)
                 {
                     break;
                 }
             }
             if (((Part)secondaries[index]).Class != "211")
             {
                 this.CreateCut(center_point, (Part)secondaries[index], Partprofile2).Delete();
             }
         }
         Beam cut1 = this.CreateCut(center_point, part1, Partprofile1);
         OBB  obb1 = this.CreateObb((Part)cut1);
         List <LineSegment> lowerFaceEdge   = this.Get_Lower_face_edge(part1);
         List <Beam>        beamList        = new List <Beam>();
         List <LineSegment> lineSegmentList = new List <LineSegment>();
         if (this.data.holeType == 0)
         {
             Point point1 = new Point();
             Point point2 = new Point();
             foreach (LineSegment lineSegment in lowerFaceEdge)
             {
                 if (obb1.Intersects(lineSegment))
                 {
                     LineSegment obb2 = Intersection.LineSegmentToObb(lineSegment, obb1);
                     lineSegmentList.Add(obb2);
                 }
             }
             Point point1_1 = lineSegmentList[lineSegmentList.Count / 2].Point1;
             List <LineSegment>           lowerEdge = this.new_get_lower_edge(part1);
             ArrayList                    arrayList = new ArrayList();
             List <Point>                 pointList = new List <Point>();
             Tekla.Structures.Model.Solid solid     = cut1.GetSolid();
             foreach (LineSegment line in lowerEdge)
             {
                 if ((uint)solid.Intersect(line).Count > 0U)
                 {
                     foreach (object obj in solid.Intersect(line))
                     {
                         pointList.Add(obj as Point);
                     }
                 }
             }
             Point P1 = pointList[0];
             Point P2 = pointList[pointList.Count - 1];
             if (point1_1 == P1 || point1_1 == P2)
             {
                 point1_1 = lineSegmentList[lineSegmentList.Count / 2 - 1].Point1;
             }
             Chamfer C = new Chamfer();
             C.Type = Chamfer.ChamferTypeEnum.CHAMFER_ARC_POINT;
             PolyBeam polyBeam = new PolyBeam();
             polyBeam.Profile.ProfileString   = "PL" + this.data.Plate_b.ToString() + "*" + this.data.Plate_h.ToString();
             polyBeam.Position.Depth          = Position.DepthEnum.FRONT;
             polyBeam.Position.Plane          = Position.PlaneEnum.MIDDLE;
             polyBeam.Position.Rotation       = Position.RotationEnum.TOP;
             polyBeam.Position.DepthOffset    = this.data.offset;
             polyBeam.Material.MaterialString = this.data.Plate_matrial;
             polyBeam.PartNumber.Prefix       = this.data.Pos_1;
             polyBeam.PartNumber.StartNumber  = this.data.Plate_pos2;
             polyBeam.Name = this.data.Plate_name;
             polyBeam.AddContourPoint(new ContourPoint(P1, (Chamfer)null));
             polyBeam.AddContourPoint(new ContourPoint(point1_1, C));
             polyBeam.AddContourPoint(new ContourPoint(P2, (Chamfer)null));
             polyBeam.Insert();
             Beam cut2 = this.CreateCut(center_point, part1, Partprofile2);
             this.insert_weld(part1, (Part)polyBeam);
             cut1.Delete();
             cut2.Delete();
             ModelObjectEnumerator booleans = polyBeam.GetBooleans();
             while (booleans.MoveNext())
             {
                 (booleans.Current as BooleanPart).Delete();
             }
         }
         else
         {
             foreach (LineSegment lineSegment in lowerFaceEdge)
             {
                 if (obb1.Intersects(lineSegment))
                 {
                     try
                     {
                         LineSegment obb2 = Intersection.LineSegmentToObb(lineSegment, obb1);
                         Beam        beam = this.insert_toeplate(obb2.Point1, obb2.Point2);
                         this.insert_weld(part1, (Part)beam);
                         beamList.Add(beam);
                     }
                     catch (Exception)
                     {
                     }
                 }
             }
             cut1.Delete();
             foreach (Part part2 in beamList)
             {
                 ModelObjectEnumerator booleans = part2.GetBooleans();
                 while (booleans.MoveNext())
                 {
                     (booleans.Current as BooleanPart).Delete();
                 }
             }
             for (int index = 0; index < beamList.Count; ++index)
             {
                 try
                 {
                     this.part_cut((Part)beamList[index], (Part)beamList[index + 1]);
                 }
                 catch (Exception)
                 {
                 }
             }
             try
             {
                 this.part_cut((Part)beamList[beamList.Count - 1], (Part)beamList[0]);
             }
             catch (Exception)
             {
             }
             for (int index = 0; index < secondaries.Count; ++index)
             {
                 Beam beam = secondaries[index] as Beam;
                 if (beam.Class == "211")
                 {
                     secondaries.Remove((object)beam);
                     index = -1;
                 }
             }
             foreach (Part GPart in secondaries)
             {
                 foreach (LineSegment lineSegment in this.Get_Lower_face_edge(GPart))
                 {
                     if (obb1.Intersects(lineSegment))
                     {
                         try
                         {
                             LineSegment obb2 = Intersection.LineSegmentToObb(lineSegment, obb1);
                             Beam        beam = this.insert_toeplate(obb2.Point1, obb2.Point2);
                             beamList.Add(beam);
                         }
                         catch (Exception)
                         {
                         }
                     }
                 }
             }
             for (int index1 = 0; index1 <= beamList.Count - 1; ++index1)
             {
                 Beam beam1 = beamList[index1];
                 for (int index2 = index1 + 1; index2 <= beamList.Count - 1; ++index2)
                 {
                     Beam beam2 = beamList[index2];
                     this.combine_beams_have_same_vector((Part)beam1, (Part)beam2);
                 }
             }
         }
     }
 }