public TSM.ContourPlate PlateFirst(double width, double height, double offset) { TSM.ContourPlate plate = new TSM.ContourPlate(); //inicialize input points TSG.Point p1 = new TSG.Point(width / 2, height / 2, 0); TSG.Point p2 = new TSG.Point(width / 2, -height / 2, 0); TSG.Point p3 = new TSG.Point(-width / 2, -height / 2, 0); TSG.Point p4 = new TSG.Point(-width / 2, height / 2, 0); //set contour points plate.AddContourPoint(new TSM.ContourPoint(p1, null)); plate.AddContourPoint(new TSM.ContourPoint(p2, null)); plate.AddContourPoint(new TSM.ContourPoint(p3, null)); plate.AddContourPoint(new TSM.ContourPoint(p4, null)); plate.Profile.ProfileString = "PL" + offset; if (tb_materialPlates.Text != string.Empty) { plate.Material.MaterialString = tb_materialPlates.Text; } else { plate.Material.MaterialString = "S235"; } if (tb_namePlates.Text != string.Empty) { plate.Name = tb_namePlates.Text; } else { plate.Name = "Plate"; } return(plate); }
private static void swapContour(TSM.ContourPlate part) { ArrayList points = part.Contour.ContourPoints; points.Reverse(); part.Contour.ContourPoints = points; }
private void WeldBeamToPlate(TSM.Beam beam, TSM.ContourPlate plate) { TSM.Weld weld = new TSM.Weld(); weld.MainObject = beam; weld.SecondaryObject = plate; weld.ConnectAssemblies = true; weld.SizeAbove = 5; weld.Insert(); }
public override List <InputDefinition> DefineInput() { // create new instance of TSMUI.Picker and input definition list TSMUI.Picker anglePicker = new TSMUI.Picker(); List <InputDefinition> InputList = new List <InputDefinition>(); // create array list to hold plates for input ArrayList PlateList = new ArrayList(); try { // Prompt user to pick 4 plates _plate1 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate; _plate2 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate; _plate3 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate; _plate4 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate; // Get coordinate system for first plate _classModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TSM.TransformationPlane(_plate1.GetCoordinateSystem())); // Prompt user to pick points _point1 = anglePicker.PickPoint() as T3D.Point; _point2 = anglePicker.PickPoint() as T3D.Point; _point3 = anglePicker.PickPoint() as T3D.Point; _point4 = anglePicker.PickPoint() as T3D.Point; // Add plates to array list PlateList.Add(_plate1.Identifier); PlateList.Add(_plate2.Identifier); PlateList.Add(_plate3.Identifier); PlateList.Add(_plate4.Identifier); // Create inputs to InputDefinition list. InputDefinition Input1 = new InputDefinition(_point1); InputDefinition Input2 = new InputDefinition(_point2); InputDefinition Input3 = new InputDefinition(_point3); InputDefinition Input4 = new InputDefinition(_point4); InputDefinition Input5 = new InputDefinition(PlateList); // Add inputs to InputDefinition list. InputList.Add(Input1); InputList.Add(Input2); InputList.Add(Input3); InputList.Add(Input4); InputList.Add(Input5); } catch (Exception ex) { throw; } return(InputList); }
public override bool checkModelObjects(_Mark other) { TSM.ContourPlate part1 = _part as TSM.ContourPlate; TSM.ContourPlate part2 = other._part as TSM.ContourPlate; ArrayList points1 = part1.Contour.ContourPoints; ArrayList points2 = part2.Contour.ContourPoints; ArrayList transformed1 = __GeometryOperations.factorPointArray(points1, _view as TSD.View); ArrayList transformed2 = __GeometryOperations.factorPointArray(points2, other._view as TSD.View); if (!__GeometryOperations.comparePointArray(transformed1, transformed2)) { return(false); } return(true); }
private void BoltPlatetoPlate(TSM.ContourPlate plate1, TSM.ContourPlate plate2, double height, double width) { TSM.BoltArray B = new TSM.BoltArray(); B.PartToBeBolted = plate1; B.PartToBoltTo = plate2; B.FirstPosition = new TSG.Point(0, -height / 2, 0); B.SecondPosition = new TSG.Point(0, height / 2, 0); B.BoltSize = double.Parse(boltCatalogSize1.Text); B.Tolerance = 3.00; B.BoltStandard = boltCatalogStandard1.Text; B.BoltType = TSM.BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; B.CutLength = 105; B.Length = 100; B.ExtraLength = 0; B.ThreadInMaterial = TSM.BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_NO; B.Position.Depth = TSM.Position.DepthEnum.MIDDLE; B.StartPointOffset.Dx = height / 4; B.Position.Plane = TSM.Position.PlaneEnum.MIDDLE; B.Position.Rotation = TSM.Position.RotationEnum.FRONT; B.Bolt = true; B.Washer1 = true; B.Washer2 = true; B.Washer3 = true; B.Nut1 = true; B.Nut2 = false; B.Hole1 = true; B.Hole2 = true; B.Hole3 = true; B.Hole4 = true; B.Hole5 = true; B.AddBoltDistX(height / 2); B.AddBoltDistY(width / 2); B.Insert(); }
private static void swapHandlesChooser(TSM.Part part) { if (part is TSM.Beam) { TSM.Beam beam = part as TSM.Beam; SwapHandler.swapBeam(beam); } else if (part is TSM.PolyBeam) { TSM.PolyBeam polybeam = part as TSM.PolyBeam; SwapHandler.swapContour(polybeam); } else if (part is TSM.ContourPlate) { TSM.ContourPlate plate = part as TSM.ContourPlate; SwapHandler.swapContour(plate); } part.Modify(); }
static private void setCutPoints(TSM.Part current, double delta) { if (current is TSM.ContourPlate) { TSM.ContourPlate currentCP = current as TSM.ContourPlate; foreach (Point cur in currentCP.Contour.ContourPoints) { cur.Z += delta; } if (delta <= 0) { if (currentCP.Position.DepthOffset >= 0) { currentCP.Position.Depth = Position.DepthEnum.FRONT; } else { currentCP.Position.Depth = Position.DepthEnum.BEHIND; } } else { if (currentCP.Position.DepthOffset >= 0) { currentCP.Position.Depth = Position.DepthEnum.BEHIND; } else { currentCP.Position.Depth = Position.DepthEnum.FRONT; } } currentCP.Position.DepthOffset = -2.5; } current.Modify(); }
/// <summary> /// Creates a triangular section for the transition section. /// </summary> /// <param name="bottom">Bottom arc of a conical section.</param> /// <param name="top">Top arc of a conical section.</param> /// <param name="nextBottom">Bottom arc of the next conical section.</param> /// <returns>The triangular section part.</returns> private TSM.ContourPlate MakeTriangularSection(Arc bottom, Arc top, Arc nextBottom) { var startPoint = new TSM.ContourPoint(bottom.EndPoint, new TSM.Chamfer()); var bottomPoint = new TSM.ContourPoint(nextBottom.StartPoint, new TSM.Chamfer()); var topPoint = new TSM.ContourPoint(top.EndPoint, new TSM.Chamfer()); var triangularSection = new TSM.Contour() { ContourPoints = new ArrayList { startPoint, bottomPoint, topPoint } }; var plate = new TSM.ContourPlate { Contour = triangularSection, Finish = this.finish, Profile = { ProfileString = this.sectionProfile }, Material = { MaterialString = this.material } }; return(plate); }
static private double findMinimum(TSM.Part current) { double min = Double.MaxValue; if (current is TSM.ContourPlate) { TSM.ContourPlate currentCP = current as TSM.ContourPlate; foreach (Point cur in currentCP.Contour.ContourPoints) { if (min > cur.Z) { min = cur.Z; } } } else if (current is TSM.Beam) { TSM.Beam currentBeam = current as TSM.Beam; min = Math.Min(currentBeam.StartPoint.Z, currentBeam.EndPoint.Z); } return(min); }
//InterSectionTest 2 private void button1_Click_1(object sender, EventArgs e) { //부재 선택 Picker picker = new Picker(); TSM.ModelObject part = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT, "부재를 선택하세요.") as TSM.ModelObject; TSM.ContourPlate contourPlate = part as TSM.ContourPlate; Solid solid = contourPlate.GetSolid(); //철근 정보 받기 //철근 선택 및 그룹철근 분할 ModelObjectEnumerator reinforcement = contourPlate.GetReinforcements(); List <TSM.SingleRebar> singleRebars = new List <TSM.SingleRebar>(); List <TSM.SingleRebar> group = new List <TSM.SingleRebar>(); //수정안된 철근 while (reinforcement.MoveNext()) { if (reinforcement.Current.GetType().Name == "SingleRebar") { TSM.SingleRebar singleRebar = reinforcement.Current as TSM.SingleRebar; singleRebars.Add(singleRebar); } else { TSM.RebarGroup rebarGroup = reinforcement.Current as TSM.RebarGroup; TSM.ModelObjectEnumerator rebarEnumerator = TSM.Operations.Operation.Ungrouping(rebarGroup); while (rebarEnumerator.MoveNext()) { TSM.ModelObject rebar = rebarEnumerator.Current; TSM.SingleRebar singleRebar = rebar as TSM.SingleRebar; singleRebars.Add(singleRebar); } } } //Intersect (마구리와 철근 겹치는 부분을 철근의 새 포인트로 지정한다.) TSG.LineSegment rebarLineSegment = null; ArrayList intersectLinesegment = new ArrayList(); for (int j = 0; j < singleRebars.Count; j++) //철근 선택 반복문 { TSG.Point point1 = singleRebars[j].Polygon.Points[0] as TSG.Point; TSG.Point point2 = singleRebars[j].Polygon.Points[1] as TSG.Point; TSM.SingleRebar newSingleRebar = singleRebars[j]; if (singleRebars[j].Polygon.Points.Count == 2) //직선철근일때 { rebarLineSegment = new TSG.LineSegment(point1, point2); } intersectLinesegment = solid.Intersect(rebarLineSegment); newSingleRebar.Polygon.Points[0] = intersectLinesegment[0] as TSG.Point; newSingleRebar.Polygon.Points[1] = intersectLinesegment[1] as TSG.Point; singleRebars[j].Delete(); newSingleRebar.Insert(); if (newSingleRebar.Polygon.Points[0] as TSG.Point == point1 && newSingleRebar.Polygon.Points[1] as TSG.Point == point2) { group.Add(newSingleRebar); } } TSM.RebarGroup nonmodifiedGroup = TSM.Operations.Operation.Group(group); }
private void btnConvert_Click(object sender, EventArgs e) { ModelObjectSelector mos = new ModelObjectSelector(); TSM.ModelObjectEnumerator moe = mos.GetSelectedObjects(); moe.SelectInstances = false; while (moe.MoveNext()) { if (moe.Current is TSM.Part) { TSM.Part part = moe.Current as TSM.Part; // this method needs to be called to properly fill all the properties of the part part.Select(); double partLength = 0.0; double partHeight = 0.0; double partWidth = 0.0; part.GetReportProperty("LENGTH", ref partLength); part.GetReportProperty("HEIGHT", ref partHeight); part.GetReportProperty("WIDTH", ref partWidth); TSM.ModelObjectEnumerator MyAllBooleans = part.GetBooleans(); TSM.ModelObjectEnumerator MyAllBolts = part.GetBolts(); TSM.ModelObject MyFather = part.GetFatherComponent(); TSG.CoordinateSystem coordinateSystem = part.GetCoordinateSystem(); TSM.WorkPlaneHandler planeHandler = model.GetWorkPlaneHandler(); // before we create a new plane we need to store the old one TSM.TransformationPlane original = planeHandler.GetCurrentTransformationPlane(); TSM.TransformationPlane partPlane = new TSM.TransformationPlane(coordinateSystem); planeHandler.SetCurrentTransformationPlane(partPlane); //this.DrawCoordinateSystem(); TSG.Point p1 = new TSG.Point(0, partHeight / 2, 0); TSG.Point p2 = new TSG.Point(partLength, partHeight / 2, 0); TSG.Point p3 = new TSG.Point(partLength, -partHeight / 2, 0); TSG.Point p4 = new TSG.Point(0, -partHeight / 2, 0); TSM.ContourPlate CP = new TSM.ContourPlate(); TSM.ContourPoint conturePoint1 = new TSM.ContourPoint(p1, null); TSM.ContourPoint conturePoint2 = new TSM.ContourPoint(p2, null); TSM.ContourPoint conturePoint3 = new TSM.ContourPoint(p3, null); TSM.ContourPoint conturePoint4 = new TSM.ContourPoint(p4, null); CP.AddContourPoint(conturePoint1); CP.AddContourPoint(conturePoint2); CP.AddContourPoint(conturePoint3); CP.AddContourPoint(conturePoint4); CP.Name = "NEM"; CP.Finish = "xxx"; CP.Profile.ProfileString = "PL" + partWidth; CP.Material.MaterialString = "S235"; CP.Class = "1"; CP.Insert(); while (MyAllBooleans.MoveNext()) { try { TSM.BooleanPart partBooleans = MyAllBooleans.Current as TSM.BooleanPart; TSM.Part partBool = partBooleans.OperativePart as TSM.Part; partBool.Class = TSM.BooleanPart.BooleanOperativeClassName; partBool.Insert(); TSM.BooleanPart myboolpart = new TSM.BooleanPart(); myboolpart.Father = CP; myboolpart.SetOperativePart(partBool); myboolpart.Insert(); partBool.Delete(); } catch (Exception) { throw; } } while (MyAllBolts.MoveNext()) { try { if (MyAllBolts.Current is TSM.BoltGroup) { TSM.BoltGroup b = MyAllBolts.Current as TSM.BoltGroup; TSM.Part toBolted = b.PartToBeBolted as TSM.Part; TSM.Part toBolt = b.PartToBoltTo as TSM.Part; if (toBolted.Identifier.ID == toBolt.Identifier.ID) { b.PartToBeBolted = CP; b.PartToBoltTo = CP; } else if (toBolted.Identifier.ID == part.Identifier.ID) { b.PartToBoltTo.GetBolts(); b.PartToBeBolted = CP; } else { b.PartToBoltTo = CP; b.PartToBeBolted.GetBolts(); } b.Insert(); } } catch (Exception) { throw; } } if (MyFather != null) { TSM.ModelObjectEnumerator elementOfComponenet = MyFather.GetChildren(); while (elementOfComponenet.MoveNext()) { TSM.Part element = elementOfComponenet.Current as TSM.Part; try { if (element is TSM.Part) { if (element.Identifier.ID == part.Identifier.ID) { element = CP; element.Modify(); } else { continue; } } else { continue; } } catch (Exception) { throw; } } } part.Delete(); planeHandler.SetCurrentTransformationPlane(original); } } this.model.CommitChanges(); }
public void Modify(PropertyValueChangedEventArgs e) { string label = e.ChangedItem.Label; ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects(); while (modelObjectEnum.MoveNext()) { if (modelObjectEnum.Current is Tekla.Structures.Model.ContourPlate) { Tekla.Structures.Model.ContourPlate contourPlate = (Tekla.Structures.Model.ContourPlate)modelObjectEnum.Current; if (label == "Name") { contourPlate.Name = name; } if (label == "Profile") { contourPlate.Profile.ProfileString = profile; } if (label == "Material") { contourPlate.Material.MaterialString = material; } if (label == "Finish") { contourPlate.Finish = finish; } if (label == "Class") { contourPlate.Class = classValue; } if (label == "PartPrefix") { contourPlate.PartNumber.Prefix = partPrefix; } if (label == "PartStartNo") { contourPlate.PartNumber.StartNumber = int.Parse(partStartNo); } if (label == "AssemblyPrefix") { contourPlate.AssemblyNumber.Prefix = assemblyPrefix; } if (label == "AssemblyStartNo") { contourPlate.AssemblyNumber.StartNumber = int.Parse(assemblyStartNo); } if (label == "Phase") { contourPlate.SetPhase(new Phase(int.Parse(phase))); } if (label == "PositionOnPlane") { if (positionOnPlane == PositionPlaneEnum.Left) { contourPlate.Position.Plane = Position.PlaneEnum.LEFT; } if (positionOnPlane == PositionPlaneEnum.Middle) { contourPlate.Position.Plane = Position.PlaneEnum.MIDDLE; } if (positionOnPlane == PositionPlaneEnum.Right) { contourPlate.Position.Plane = Position.PlaneEnum.RIGHT; } } if (label == "PositionOnPlaneOffset") { contourPlate.Position.PlaneOffset = double.Parse(positionOnPlaneOffset); } if (label == "PositionRotation") { if (positionRotation == PositionRotationEnum.Top) { contourPlate.Position.Rotation = Position.RotationEnum.TOP; } if (positionRotation == PositionRotationEnum.Front) { contourPlate.Position.Rotation = Position.RotationEnum.FRONT; } if (positionRotation == PositionRotationEnum.Back) { contourPlate.Position.Rotation = Position.RotationEnum.BACK; } if (positionRotation == PositionRotationEnum.Below) { contourPlate.Position.Rotation = Position.RotationEnum.BELOW; } } if (label == "PositionRotationOffset") { contourPlate.Position.RotationOffset = double.Parse(positionRotationOffset); } if (label == "PositionAtDepth") { if (positionAtDepth == PositionDepthEnum.Behind) { contourPlate.Position.Depth = Position.DepthEnum.BEHIND; } if (positionAtDepth == PositionDepthEnum.Front) { contourPlate.Position.Depth = Position.DepthEnum.FRONT; } if (positionAtDepth == PositionDepthEnum.Middle) { contourPlate.Position.Depth = Position.DepthEnum.MIDDLE; } } if (label == "AtDepthOffset") { contourPlate.Position.DepthOffset = double.Parse(positionAtDepthOffset); } if (label == "Userfield1") { contourPlate.SetUserProperty("USER_FIELD_1", userfield1); } if (label == "Userfield2") { contourPlate.SetUserProperty("USER_FIELD_2", userfield2); } if (label == "Userfield3") { contourPlate.SetUserProperty("USER_FIELD_3", userfield3); } if (label == "Userfield4") { contourPlate.SetUserProperty("USER_FIELD_4", userfield4); } if (label == "NotesComments") { contourPlate.SetUserProperty("comment", notesComments); } if (label == "FittingNotes") { contourPlate.SetUserProperty("FIT_NOTES", fittingNotes); } if (label == "FittingNotes2") { contourPlate.SetUserProperty("FIT_NOTES2", fittingNotes2); } if (label == "Cambering") { contourPlate.SetUserProperty("cambering", cambering); } if (label == "Paint") { contourPlate.SetUserProperty("PAINT", paint); } if (label == "PreliminaryMark") { contourPlate.SetUserProperty("PRELIM_MARK", preliminaryMark); } if (label == "PaintWFT") { contourPlate.SetUserProperty("PAINT_WFT", paintWFT); } if (label == "PaintDFT") { contourPlate.SetUserProperty("PAINT_DFT", paintDFT); } if (label == "ShearStart") { contourPlate.SetUserProperty("shear1", double.Parse(shearStart) * 1000); } if (label == "ShearEnd") { contourPlate.SetUserProperty("shear2", double.Parse(shearEnd) * 1000); } if (label == "AxialStart") { contourPlate.SetUserProperty("axial1", double.Parse(axialStart) * 1000); } if (label == "AxialEnd") { contourPlate.SetUserProperty("axial2", double.Parse(axialEnd) * 1000); } if (label == "MomentStart") { contourPlate.SetUserProperty("moment1", double.Parse(momentStart) * 1000); } if (label == "MomentEnd") { contourPlate.SetUserProperty("moment2", double.Parse(momentEnd) * 1000); } if (label == "ConnCodeStart") { contourPlate.SetUserProperty("CONN_CODE_END1", connCodeStart); } if (label == "ConnCodeEnd") { contourPlate.SetUserProperty("CONN_CODE_END2", connCodeEnd); } contourPlate.Modify(); model.CommitChanges(); } } }
public override bool Run(List <InputDefinition> Input) { // Fields for Run method List <T3D.Point> firstAnglePoints; List <T3D.Point> secondAnglePoints; List <T3D.Point> thirdAnglePoints; List <T3D.Point> fourthAnglePoints; List <T3D.Point> offsetPoints; double angleOnPlaneOffset; double distanceToCenter; try { // Get T3D Points from Input T3D.Point firstPoint = (T3D.Point)Input.ElementAt(0).GetInput(); T3D.Point secondPoint = (T3D.Point)Input.ElementAt(1).GetInput(); T3D.Point thirdPoint = (T3D.Point)Input.ElementAt(2).GetInput(); T3D.Point fourthPoint = (T3D.Point)Input.ElementAt(3).GetInput(); T3D.Point centerPoint = new T3D.Point(); ArrayList PlateList = (ArrayList)Input.ElementAt(4).GetInput(); // Use plate Identifiers from PlateList to obtain plates for bolting connection if (PlateList != null && PlateList.Count == 4) { _plate1 = _classModel.SelectModelObject(PlateList[0] as Tekla.Structures.Identifier) as TSM.ContourPlate; _plate2 = _classModel.SelectModelObject(PlateList[1] as Tekla.Structures.Identifier) as TSM.ContourPlate; _plate3 = _classModel.SelectModelObject(PlateList[2] as Tekla.Structures.Identifier) as TSM.ContourPlate; _plate4 = _classModel.SelectModelObject(PlateList[3] as Tekla.Structures.Identifier) as TSM.ContourPlate; } // Trim points AngleModelingUtil angleModelingUtil = new AngleModelingUtil(); firstAnglePoints = angleModelingUtil.TrimPoints(firstPoint, (_firstOffset * 25.4), thirdPoint, (_thirdOffset * 25.4)); secondAnglePoints = angleModelingUtil.TrimPoints(fourthPoint, (_fourthOffset * 25.4), secondPoint, (_secondOffset * 25.4)); if (_angleBracingType == 0) { // Create angle objects and set position AngleModeler firstAngle = new AngleModeler(_classModel); firstAngle.SetOnPlanePosition(1); firstAngle.SetRotationPosition(0); firstAngle.SetDepthPosition(1); angleOnPlaneOffset = (_angleWidth - (_angleOffset * 25.4)) * -1; // Adjust angle offset if (_anglePosition == 0) { firstAngle.SetOnPlaneOffset((_angleWidth / 2) * -1); } else { firstAngle.SetOnPlaneOffset(angleOnPlaneOffset); } // Second angle AngleModeler secondAngle = new AngleModeler(_classModel); secondAngle.SetOnPlanePosition(1); secondAngle.SetRotationPosition(0); secondAngle.SetDepthPosition(1); secondAngle.SetRotationOffset(180); // Adjust angle offset if (_anglePosition == 0) { secondAngle.SetOnPlaneOffset((_angleWidth / 2) * -1); } else { secondAngle.SetOnPlaneOffset(angleOnPlaneOffset); } // Model angles T3D.Point firstAngleStart = firstAnglePoints.ElementAt(0); T3D.Point firstAngleFinish = firstAnglePoints.ElementAt(1); T3D.Point secondAngleStart = secondAnglePoints.ElementAt(0); T3D.Point secondAngleFinish = secondAnglePoints.ElementAt(1); firstAngle.ModelAngle(firstAngleStart, firstAngleFinish, _angleProfile, false); secondAngle.ModelAngle(secondAngleStart, secondAngleFinish, _angleProfile, false); // Generate bolts AngleBolts firstAngleBolts1 = new AngleBolts(_classModel, _boltSize, _boltQty); AngleBolts firstAngleBolts2 = new AngleBolts(_classModel, _boltSize, _boltQty); AngleBolts secondAngleBolts1 = new AngleBolts(_classModel, _boltSize, _boltQty); AngleBolts secondAngleBolts2 = new AngleBolts(_classModel, _boltSize, _boltQty); AngleBolts centerBolt = new AngleBolts(_classModel, _boltSize, 1); // If angle is centered, set offset to 0 if (_anglePosition == 0) { _boltDy = 0; } else { _boltDy = angleOnPlaneOffset + (_angleWidth / 2); } // If angle is centered, set offset to 0 if (_anglePosition == 0) { // Find center point for center bolt centerPoint = angleModelingUtil.CenterPoint(firstPoint, secondPoint, thirdPoint, fourthPoint); // Bolt center bolt distanceToCenter = Math.Sqrt(Math.Pow((centerPoint.X - firstPoint.X), 2) + Math.Pow(centerPoint.Y - firstPoint.Y, 2)); centerBolt.BoltAngle(firstAnglePoints.ElementAt(0), firstAnglePoints.ElementAt(1), 0.0, distanceToCenter, (-1 * _boltDy), firstAngle.getBeam()); } else { //PROBLEM EXISTS SOMEWHERE IN THIS METHOD!!! //////////////////////////////////////////////// // Find center point for center bolt centerPoint = angleModelingUtil.CenterPoint(firstPoint, secondPoint, thirdPoint, fourthPoint); centerPoint = angleModelingUtil.OffsetCenter(firstAngleStart, firstAngleFinish, secondAngleStart, secondAngleFinish, centerPoint, _angleWidth, (_angleOffset * 25.4)); // Bolt center bolt distanceToCenter = Math.Sqrt(Math.Pow((centerPoint.X - firstPoint.X), 2) + Math.Pow(centerPoint.Y - firstPoint.Y, 2)); centerBolt.BoltAngle(firstAngleStart, firstAngleFinish, 0.0, distanceToCenter, (-1 * _boltDy), firstAngle.getBeam()); /////////////////////////////////////////////////// /////////////////////////////////////////////////// } // Bolt angles to plates firstAngleBolts1.BoltAngle(firstAngleStart, firstAngleFinish, _boltSpacing, _boltDX, (-1 * _boltDy), firstAngle.getBeam(), _plate1); firstAngleBolts2.BoltAngle(firstAngleFinish, firstAngleStart, _boltSpacing, _boltDX, _boltDy, firstAngle.getBeam(), _plate3); secondAngleBolts1.BoltAngle(secondAngleStart, secondAngleFinish, _boltSpacing, _boltDX, _boltDy, secondAngle.getBeam(), _plate4); secondAngleBolts2.BoltAngle(secondAngleFinish, secondAngleStart, _boltSpacing, _boltDX, (-1 * _boltDy), secondAngle.getBeam(), _plate2); } else if (_angleBracingType == 1) { // REMOVE THIS MESSAGE WHEN DOUBLE ANGLE BRACING IS IMPLEMENTED!!! MessageBox.Show("Double angle bracing not implemented yet"); } else { // REMOVE THIS MESSAGE WHEN DOUBLE ANGLE BRACING IS IMPLEMENTED!!! MessageBox.Show("Invalid Angle Bracing Type"); } } catch (Exception Ex) { throw; } finally { // Set workplane back to what user had before _classModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(_originalPlane); } return(true); }
public void GetProperties() { ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects(); if (modelObjectEnum.GetSize() == 1) { while (modelObjectEnum.MoveNext()) { if (modelObjectEnum.Current is Tekla.Structures.Model.ContourPlate) { Tekla.Structures.Model.ContourPlate contourPlate = (Tekla.Structures.Model.ContourPlate)modelObjectEnum.Current; TransformationPlane currentTP = new TransformationPlane(); currentTP = model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane()); contourPlate.Select(); Assembly assembly = contourPlate.GetAssembly() as Tekla.Structures.Model.Assembly; assembly.GetReportProperty("ASSEMBLY_POSITION_CODE", ref gridLocation); partType = contourPlate.GetType().Name; partID = contourPlate.Identifier.ID.ToString(); contourPlate.GetReportProperty("OWNER", ref owner); partPrefix = contourPlate.PartNumber.Prefix; partStartNo = contourPlate.PartNumber.StartNumber.ToString(); assemblyPrefix = contourPlate.AssemblyNumber.Prefix; assemblyStartNo = contourPlate.AssemblyNumber.StartNumber.ToString(); Phase CurrentPhase = new Phase(); contourPlate.GetPhase(out CurrentPhase); phase = CurrentPhase.PhaseNumber.ToString(); name = contourPlate.Name; profile = contourPlate.Profile.ProfileString; material = contourPlate.Material.MaterialString; finish = contourPlate.Finish; classValue = contourPlate.Class; if (contourPlate.Position.Plane == Position.PlaneEnum.LEFT) { positionOnPlane = PositionPlaneEnum.Left; } else if (contourPlate.Position.Plane == Position.PlaneEnum.MIDDLE) { positionOnPlane = PositionPlaneEnum.Middle; } else if (contourPlate.Position.Plane == Position.PlaneEnum.RIGHT) { positionOnPlane = PositionPlaneEnum.Right; } positionOnPlaneOffset = contourPlate.Position.PlaneOffset.ToString("F02"); if (contourPlate.Position.Rotation == Position.RotationEnum.BACK) { positionRotation = PositionRotationEnum.Back; } else if (contourPlate.Position.Rotation == Position.RotationEnum.BELOW) { positionRotation = PositionRotationEnum.Below; } else if (contourPlate.Position.Rotation == Position.RotationEnum.FRONT) { positionRotation = PositionRotationEnum.Front; } else if (contourPlate.Position.Rotation == Position.RotationEnum.TOP) { positionRotation = PositionRotationEnum.Top; } positionRotationOffset = contourPlate.Position.RotationOffset.ToString("F02"); if (contourPlate.Position.Depth == Position.DepthEnum.BEHIND) { positionAtDepth = PositionDepthEnum.Behind; } else if (contourPlate.Position.Depth == Position.DepthEnum.FRONT) { positionAtDepth = PositionDepthEnum.Front; } else if (contourPlate.Position.Depth == Position.DepthEnum.MIDDLE) { positionAtDepth = PositionDepthEnum.Middle; } positionAtDepthOffset = contourPlate.Position.DepthOffset.ToString("F02"); contourPlate.GetUserProperty("USER_FIELD_1", ref userfield1); contourPlate.GetUserProperty("USER_FIELD_2", ref userfield2); contourPlate.GetUserProperty("USER_FIELD_3", ref userfield3); contourPlate.GetUserProperty("USER_FIELD_4", ref userfield4); contourPlate.GetUserProperty("comment", ref notesComments); contourPlate.GetUserProperty("FIT_NOTES", ref fittingNotes); contourPlate.GetUserProperty("FIT_NOTES2", ref fittingNotes2); contourPlate.GetUserProperty("cambering", ref cambering); contourPlate.GetUserProperty("PAINT", ref paint); contourPlate.GetUserProperty("PRELIM_MARK", ref preliminaryMark); contourPlate.GetUserProperty("PAINT_WFT", ref paintWFT); contourPlate.GetUserProperty("PAINT_DFT", ref paintDFT); double dblshear1 = 0; contourPlate.GetUserProperty("shear1", ref dblshear1); dblshear1 = dblshear1 * 0.001; shearStart = dblshear1.ToString(); double dblshear2 = 0; contourPlate.GetUserProperty("shear2", ref dblshear2); dblshear2 = dblshear2 * 0.001; shearEnd = dblshear2.ToString(); double dblaxial1 = 0; contourPlate.GetUserProperty("axial1", ref dblaxial1); dblaxial1 = dblaxial1 * 0.001; axialStart = dblaxial1.ToString(); double dblaxial2 = 0; contourPlate.GetUserProperty("axial2", ref dblaxial2); dblaxial2 = dblaxial2 * 0.001; axialEnd = dblaxial2.ToString(); double dblmoment1 = 0; contourPlate.GetUserProperty("moment1", ref dblmoment1); dblmoment1 = dblmoment1 * 0.001; momentStart = dblmoment1.ToString(); double dblmoment2 = 0; contourPlate.GetUserProperty("moment2", ref dblmoment2); dblmoment2 = dblmoment2 * 0.001; momentEnd = dblmoment2.ToString(); contourPlate.GetUserProperty("CONN_CODE_END1", ref connCodeStart); contourPlate.GetUserProperty("CONN_CODE_END2", ref connCodeEnd); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentTP); } } } if (modelObjectEnum.GetSize() > 1) { partType = ""; partID = ""; owner = ""; gridLocation = ""; partPrefix = ""; partStartNo = ""; assemblyPrefix = ""; assemblyStartNo = ""; phase = ""; name = ""; profile = ""; material = ""; finish = ""; classValue = ""; userfield1 = ""; userfield2 = ""; userfield3 = ""; userfield4 = ""; notesComments = ""; fittingNotes = ""; fittingNotes2 = ""; cambering = ""; paint = ""; preliminaryMark = ""; paintWFT = ""; paintDFT = ""; shearStart = ""; shearEnd = ""; axialStart = ""; axialEnd = ""; momentStart = ""; momentEnd = ""; connCodeStart = ""; connCodeEnd = ""; positionOnPlane = new PositionPlaneEnum(); positionOnPlaneOffset = ""; positionRotation = new PositionRotationEnum(); positionRotationOffset = ""; positionAtDepth = new PositionDepthEnum(); positionAtDepthOffset = ""; } }
/// <summary> /// Method for bolting a single angle to a connection plate /// </summary> /// <param name="startPoint"></param> /// <param name="endPoint"></param> /// <param name="boltSpacing"></param> /// <param name="boltDx"></param> /// <param name="firstUserAngle"></param> /// <param name="firstUserPlate"></param> public void BoltAngle(T3D.Point startPoint, T3D.Point endPoint, double boltSpacing, double boltDx, double boltDy, TSM.Beam firstUserAngle, TSM.ContourPlate firstUserPlate) { try { // Only one row of bolts base.newBoltArray.AddBoltDistY(0); if (base.boltQuantity == 1) { base.newBoltArray.AddBoltDistX(0); } else { // For each bolt, add spacing between bolts along X axis for (int i = 0; i < (base.boltQuantity - 1); i++) { base.newBoltArray.AddBoltDistX(boltSpacing); } } // Set start point and end point for bolts base.setStartPoint(startPoint); base.setEndPoint(endPoint); // Add Dx and Dy bolt offset dimension to bolt array base.SetStartOffsetX(boltDx); base.SetStartOffsetY(boltDy); base.SetFinishOffsetY(boltDy); // Bolt connection plate to angle base.newBoltArray.PartToBoltTo = firstUserAngle; base.newBoltArray.PartToBeBolted = firstUserPlate; base.SetOnPlanePosition(0); base.SetRotationPosition(0); base.SetDepthPosition(0); // Set bolt type to site base.newBoltArray.BoltType = TSM.BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; // Insert bolts and update model base.InsertBolts(); base.UpdateModel(); } catch (Exception) { MessageBox.Show("Bolting connection failed!"); } }
public Plate(TSM.Beam secondaryBeam, TSM.Beam primaryBeam, double plateThickness, string plateName) { this.bPlate = CreateConturePlate(secondaryBeam, primaryBeam, plateThickness, plateName) as TSM.ContourPlate; this.bPlate.Insert(); }
//InterSectionTest 3 private void button4_Click(object sender, EventArgs e) { //부재 선택 Picker picker = new Picker(); TSM.Part part = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT, "철근형태를 수정할 부재를 선택하세요.") as TSM.Part; TSM.Part intersectingpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT, "간섭하는 부재를 선택하세요.") as TSM.Part; //Intersection 처리 double partFrontLength = 0.0; double intersectionLength = 0.0; //할당해야함 TSG.OBB iPartOBB = CreateOrientedBoundingBox(intersectingpart); TSG.Vector partLVector = new TSG.Vector(); if (part.GetType().Name == "Beam") { TSM.Beam beam = part as TSM.Beam; TSG.LineSegment lineSegment = new TSG.LineSegment(beam.StartPoint, beam.EndPoint); TSG.Point firstPoint = TSG.Intersection.LineSegmentToObb(lineSegment, iPartOBB).Point1; TSG.Point secondPoint = TSG.Intersection.LineSegmentToObb(lineSegment, iPartOBB).Point2; partFrontLength = TSG.Distance.PointToPoint(beam.StartPoint, firstPoint); intersectionLength = TSG.Distance.PointToPoint(firstPoint, secondPoint); partLVector = new TSG.Vector(beam.EndPoint - beam.StartPoint).GetNormal(); } else if (part.GetType().Name == "ContourPlate") //ContourPlate인 경우 추후 작성 { TSM.ContourPlate contourPlate = part as TSM.ContourPlate; } //철근 그룹화 해제 후 singleRebar 저장 ModelObjectEnumerator reinforcement = part.GetReinforcements(); List <TSM.SingleRebar> singleRebars = new List <TSM.SingleRebar>(); List <TSM.SingleRebar> group = new List <TSM.SingleRebar>(); //그룹화를 위한 List int rebarCount = 0; //총 단일철근 수량 ArrayList rebarInterval = new ArrayList(); //철근 간격 (싱글 타입일 때는 철근 간격을 어떻게 구하지? > 일단 PASS) while (reinforcement.MoveNext()) { if (reinforcement.Current.GetType().Name == "SingleRebar") //부재에 속한 철근이 SingleRebar타입일 때 { TSM.SingleRebar singleRebar = reinforcement.Current as TSM.SingleRebar; singleRebars.Add(singleRebar); MessageBox.Show("SingleRebar 타입은 현재 지원 불가"); } else //부재에 속한 철근이 RebarGroup타입일 때 { TSM.RebarGroup rebarGroup = reinforcement.Current as TSM.RebarGroup; rebarInterval = rebarGroup.Spacings; //철근 간격 저장 TSM.ModelObjectEnumerator rebarEnumerator = TSM.Operations.Operation.Ungrouping(rebarGroup); while (rebarEnumerator.MoveNext()) { TSM.ModelObject rebar = rebarEnumerator.Current; TSM.SingleRebar singleRebar = rebar as TSM.SingleRebar; singleRebars.Add(singleRebar); } } rebarCount = singleRebars.Count; // 총 단일수량 저장 } //철근 재배치 for (int i = 0; i < singleRebars.Count - (intersectionLength / (double)rebarInterval[0]); i++) // 딱 안떨어지는 경우 고려해줘야함 { double frontLength = (i * (double)rebarInterval[0]); if (frontLength >= partFrontLength) { if (i == singleRebars.Count) { break; } else { for (int j = 0; j < singleRebars[i].Polygon.Points.Count; j++) { TSM.SingleRebar newSingleRebar = singleRebars[i]; TSG.Point intersectionLengthPoint = new TSG.Point(intersectionLength * partLVector.X, intersectionLength * partLVector.Y, intersectionLength * partLVector.Z); newSingleRebar.Polygon.Points[j] = newSingleRebar.Polygon.Points[j] as TSG.Point + intersectionLengthPoint; singleRebars[i].Delete(); newSingleRebar.Insert(); group.Add(newSingleRebar); } } } else { group.Add(singleRebars[i]); } } for (int i = singleRebars.Count - (int)(intersectionLength / (double)rebarInterval[0]); i < singleRebars.Count; i++) { singleRebars[i].Delete(); } TSM.RebarGroup newRebarGroup = TSM.Operations.Operation.Group(group); }
private void btn_multiBeams_Click(object sender, EventArgs e) { try { Picker picker = new Picker(); ArrayList points = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON); if (points.Count >= 3) { TSG.Point start = new TSG.Point(0, 0, 0); TSG.Point middle = new TSG.Point(0, 0, 0); TSG.Point end = new TSG.Point(0, 0, 0); TSG.Vector vectorFit = new TSG.Vector(); TSG.Vector vectorZ = new TSG.Vector(); TSG.Vector vectorOne = new TSG.Vector(); TSG.Vector vectorTwo = new TSG.Vector(); ArrayList listBeams = new ArrayList(); ArrayList listPlates = new ArrayList(); double angelDegree = 0.0; for (int i = 0; i < points.Count - 1; i++) { TSM.Beam beam = BeamFirst(points[i] as TSG.Point, points[i + 1] as TSG.Point); beam.Insert(); listBeams.Add(beam); this.model.CommitChanges(); } double primaryWidth = 0.0; double primaryHeight = 0.0; for (int i = 0; i < points.Count - 1; i++) { try { start = points[i] as TSG.Point; middle = points[i + 1] as TSG.Point; end = points[i + 2] as TSG.Point; } catch { } vectorOne = new TSG.Vector(middle.X - start.X, middle.Y - start.Y, middle.Z - start.Z); vectorOne.Normalize(); vectorTwo = new TSG.Vector(middle.X - end.X, middle.Y - end.Y, middle.Z - end.Z); vectorTwo.Normalize(); double angle = vectorOne.GetAngleBetween(vectorTwo); angelDegree = angle * 180 / Math.PI; //TSG.Vector vectorFit = new TSG.Vector(1 * Math.Cos(angle / 2), 1 * Math.Cos(angle / 2), 0); vectorFit = new TSG.Vector(vectorOne.X + vectorTwo.X, vectorOne.Y + vectorTwo.Y, vectorOne.Z + vectorTwo.Z); vectorZ = vectorOne.Cross(vectorTwo); TSG.CoordinateSystem coordinateSystem = new TSG.CoordinateSystem(); double thick; if (tb_thcikPlates.Text != string.Empty) { double.TryParse(tb_thcikPlates.Text, out thick); } else { thick = 20.0; } double offset = thick; double angleFD = 90 - (angelDegree / 2); double angleFR = Math.PI * angleFD / 180; double width = 0.0; double heigth = 0.0; double x = Math.Round(vectorFit.X, 2, MidpointRounding.ToEven); double y = Math.Round(vectorFit.Y, 2, MidpointRounding.ToEven); double z = Math.Round(vectorFit.Z, 2, MidpointRounding.ToEven); TSM.Beam beam1 = listBeams[i] as TSM.Beam; TSM.Beam beam2 = listBeams[i + 1] as TSM.Beam; beam1.GetReportProperty("WIDTH", ref primaryWidth); beam1.GetReportProperty("HEIGHT", ref primaryHeight); if (x == 0.0 && y == 0.0 && z == 0.0) { TSG.Vector bAxisX = beam1.GetCoordinateSystem().AxisX; TSG.Vector bAxisY = beam1.GetCoordinateSystem().AxisY; TSG.Vector bAxisZ = bAxisY.Cross(bAxisX); coordinateSystem = new TSG.CoordinateSystem(middle, bAxisZ, bAxisY); } else { coordinateSystem = new TSG.CoordinateSystem( middle, vectorFit, vectorZ); } TSM.WorkPlaneHandler planeHandler = model.GetWorkPlaneHandler(); TSM.TransformationPlane original = planeHandler.GetCurrentTransformationPlane(); TSM.TransformationPlane beamPlane = new TSM.TransformationPlane(coordinateSystem); planeHandler.SetCurrentTransformationPlane(beamPlane); FitBeam(beam1, -offset); FitBeam(beam2, offset); if (z != 0) { vectorZ = vectorTwo.Cross(vectorOne); planeHandler.SetCurrentTransformationPlane(original); TSG.CoordinateSystem coordinatePlate = new TSG.CoordinateSystem( middle, vectorZ, vectorFit); TSM.TransformationPlane beamPlate = new TSM.TransformationPlane(coordinatePlate); planeHandler.SetCurrentTransformationPlane(beamPlate); width = primaryWidth; heigth = 50 + primaryHeight / (Math.Cos(angleFR)); } else { width = 50 + primaryWidth / (Math.Cos(angleFR)); heigth = primaryHeight; } bool positionPlate = true; for (int k = 0; k < 2; k++) { TSM.ContourPlate plate = PlateFirst(width, heigth, offset); if (positionPlate) { plate.Position.Depth = TSM.Position.DepthEnum.BEHIND; positionPlate = false; } else { plate.Position.Depth = TSM.Position.DepthEnum.FRONT; } plate.Insert(); listPlates.Add(plate); } TSM.ContourPlate plate1 = listPlates[0] as TSM.ContourPlate; TSM.ContourPlate plate2 = listPlates[1] as TSM.ContourPlate; BoltPlatetoPlate(plate1, plate2, heigth, width); WeldBeamToPlate(beam1, plate1); WeldBeamToPlate(beam2, plate2); planeHandler.SetCurrentTransformationPlane(original); this.model.CommitChanges(); listPlates.Clear(); } this.model.CommitChanges(); listBeams.Clear(); } else { MessageBox.Show(Tekla.Structures.Dialog.UIControls.LocalizeForm.Localization.GetText("albl_Invalid_input_parts"));//translation of text in message box } } catch { } }
private void markHandler(TSD.Mark currentMark) { if (currentMark.Attributes.Content.Count > 0) { System.Type[] Types = new System.Type[1]; Types.SetValue(typeof(TSD.ModelObject), 0); TSD.DrawingObjectEnumerator markObjects = currentMark.GetRelatedObjects(Types); foreach (TSD.ModelObject currentDO in markObjects) { TSM.Model myModel = new TSM.Model(); TSM.ModelObject modelObject = myModel.SelectModelObject(currentDO.ModelIdentifier); if (modelObject != null) { if (modelObject is TSM.Beam) { TSM.Beam currentMO = modelObject as TSM.Beam; markBeams.Add(new _Mark_Beam(currentMark, currentMO, currentDO, this.view)); } else if (modelObject is TSM.PolyBeam) { TSM.PolyBeam currentMO = modelObject as TSM.PolyBeam; markPolyBeams.Add(new _Mark_PolyBeam(currentMark, currentMO, currentDO, this.view)); } else if (modelObject is TSM.ContourPlate) { TSM.ContourPlate currentMO = modelObject as TSM.ContourPlate; markContourPlates.Add(new _Mark_ContourPlate(currentMark, currentMO, currentDO, this.view)); } else if (modelObject is TSM.SingleRebar) { TSM.SingleRebar currentMO = modelObject as TSM.SingleRebar; markSingleRebars.Add(new _Mark_SingleRebar(currentMark, currentMO, currentDO, this.view)); } else if (modelObject is TSM.RebarGroup) { TSM.BaseRebarGroup currentMO = modelObject as TSM.RebarGroup; markRebarBases.Add(new _Mark_RebarGroup(currentMark, currentMO, currentDO, this.view)); } else if (modelObject is TSM.BoltGroup) { TSM.BoltGroup currentMO = modelObject as TSM.BoltGroup; markBoltGroup.Add(new _Mark_BoltGroup(currentMark, currentMO, currentDO, this.view)); } } } } }