public override bool Run() { try { GetValuesFromDialog(); TSG.Point Point1 = (TSG.Point) this.Positions[0]; TSG.Point Point2 = (TSG.Point) this.Positions[1]; TSG.Point LengthVector = new TSG.Vector(Point2.X - Point1.X, Point2.Y - Point1.Y, Point2.Z - Point1.Z); if (this.LengthFactor > 0) { Point2.X = this.LengthFactor * LengthVector.X + Point1.X; Point2.Y = this.LengthFactor * LengthVector.Y + Point1.Y; Point2.Z = this.LengthFactor * LengthVector.Z + Point1.Z; } CreateTaperedBeam(Point1, Point2); } catch (Exception Ex) { TSM.Operations.Operation.DisplayPrompt(Ex.Message); } return(true); }
//Draws the vector of the coordinate system private static void DrawVector(T3D.Point StartPoint, T3D.Vector Vector, string Text) { Color Color = new Color(0, 1, 1); const double Radians = 0.43; Vector = Vector.GetNormal(); T3D.Vector Arrow01 = new T3D.Vector(Vector); Vector.Normalize(500); T3D.Point EndPoint = new T3D.Point(StartPoint); EndPoint.Translate(Vector.X, Vector.Y, Vector.Z); GraphicsDrawer.DrawLineSegment(StartPoint, EndPoint, Color); GraphicsDrawer.DrawText(EndPoint, Text, Color); Arrow01.Normalize(-100); T3D.Vector Arrow = ArrowVector(Arrow01, Radians); T3D.Point ArrowExtreme = new T3D.Point(EndPoint); ArrowExtreme.Translate(Arrow.X, Arrow.Y, Arrow.Z); GraphicsDrawer.DrawLineSegment(EndPoint, ArrowExtreme, Color); Arrow = ArrowVector(Arrow01, -Radians); ArrowExtreme = new T3D.Point(EndPoint); ArrowExtreme.Translate(Arrow.X, Arrow.Y, Arrow.Z); GraphicsDrawer.DrawLineSegment(EndPoint, ArrowExtreme, Color); }
public void CK06_Pick2Points() { T3D.Point FirstPoint = null; T3D.Point SecondPoint = null; Picker Picker = new Picker(); try { ArrayList PickPoints = Picker.PickPoints(Picker.PickPointEnum.PICK_TWO_POINTS); FirstPoint = PickPoints[0] as T3D.Point; SecondPoint = PickPoints[1] as T3D.Point; } catch { FirstPoint = SecondPoint = null; } if (FirstPoint != null && SecondPoint != null) { T3D.Vector XVector = new T3D.Vector(SecondPoint.X - FirstPoint.X, SecondPoint.Y - FirstPoint.Y, SecondPoint.Z - FirstPoint.Z); T3D.Vector YVector = XVector.Cross(new T3D.Vector(0, 0, -1)); Model.GetWorkPlaneHandler() .SetCurrentTransformationPlane(new TransformationPlane(FirstPoint , XVector, YVector)); ViewHandler.SetRepresentation("standard"); //PKh> should be add for Tekla-2018 Model.CommitChanges(); mw.Msg("Появляется рисунок осей X и Y ПСК, ось X в направлении от точки 1 к точке 2"); MessageBox.Show("вывел ПСК"); mw.Msg(); } }
private TSDrg.StraightDimensionSet CreateNewDim(TSDrg.View view, TSDrg.PointList pointList) { TSG.Vector upDirection; if (checkBox1.Checked) { upDirection = new TSG.Vector(1, 0, 0); } else if (checkBox2.Checked) { upDirection = new TSG.Vector(0, 1, 0); } else { lbl_status.Text = "Please select dimension orientation"; upDirection = new TSG.Vector(1, 0, 0); } double height = 0.0; TSDrg.StraightDimensionSet.StraightDimensionSetAttributes attr = new TSDrg.StraightDimensionSet.StraightDimensionSetAttributes(); TSDrg.StraightDimensionSetHandler myDimSetHandler = new TSDrg.StraightDimensionSetHandler(); TSDrg.StraightDimensionSet newDim = myDimSetHandler.CreateDimensionSet(view, pointList, upDirection, height, attr); return(newDim); }
private static void tryPredictMarks <T>(List <T> notFound, List <T> input) where T : _Mark { foreach (T output in notFound) { T3D.Vector outputvector = output.getDirection(); List <T> sameDirectionMarks = input.Where(x => x.getDirectionOther() == outputvector).ToList(); output.tryPredict <T>(sameDirectionMarks); } }
public override T3D.Vector getDirection() { T3D.Point start = __GeometryOperations.factor1Point((_part as TSM.Beam).StartPoint, _view as TSD.View); T3D.Point end = __GeometryOperations.factor1Point((_part as TSM.Beam).EndPoint, _view as TSD.View); T3D.Vector vector = __GeometryOperations.getDirectionVector(start, end); return(vector); }
private void ConvertComponent(TSM.BaseComponent component) { //Update component from database component.Select(); component.GetPhase(out TSM.Phase phase); //Check if is connection TSM.Connection connetion = null; TSM.Detail detail = null; T3D.Vector upVector = null; if (component is TSM.Connection) { connetion = component as TSM.Connection; upVector = connetion.UpVector; } else if (component is TSM.Detail) { detail = component as TSM.Detail; upVector = detail.UpVector; } //Select component in model new TSM.UI.ModelObjectSelector().Select(new System.Collections.ArrayList() { component }); //Convert component var akit = new TS.MacroBuilder(); akit.Callback("acmdChangeJointTypeToCallback", "DETAIL", "main_frame"); akit.Run(); component.Select(); //After conversion some connections changes its direction so we need to repair that connections if (connetion != null) { connetion.Select(); connetion.AutoDirectionType = TS.AutoDirectionTypeEnum.AUTODIR_NA; connetion.UpVector = upVector; } //After conversion some details changes its direction so we need to repair that details if (detail != null) { detail.Select(); detail.AutoDirectionType = TS.AutoDirectionTypeEnum.AUTODIR_NA; detail.UpVector = upVector; } //After conversion components change its phase to current we need to repait it component.SetPhase(phase); component.Modify(); }
private void alignMarks(MarkBase baseMark, List <MarkBase> barMarks) { TSG.Point basePoint = baseMark.InsertionPoint; MarkBase[] sortedBarMarks = barMarks.ToArray(); Double[] sortedBarMarkXpos = new Double[barMarks.Count]; bool reversed = false; //create array of barmark positions for sorting for (int i = 0; i < sortedBarMarks.Length; i++) { TSDrg.LeaderLinePlacing placing = (LeaderLinePlacing)sortedBarMarks[i].Placing; //drawcircle(placing.StartPoint, sortedBarMarks[i].GetView()); sortedBarMarkXpos[i] = placing.StartPoint.X; } //sort and check for position of the basemark, if basemark is at the end, then reverse order of marks for sorting Array.Sort(sortedBarMarkXpos, sortedBarMarks); if (basePoint.X > sortedBarMarkXpos.Last()) { reversed = true; Array.Reverse(sortedBarMarks); Array.Reverse(sortedBarMarkXpos); } Double newInsertionYpos = basePoint.Y - PS.Default.usr_BarMarkYOffset; //move barmarks for (int i = 0; i < sortedBarMarks.Length; i++) { TSG.Point currBarMarkPosition = sortedBarMarks[i].InsertionPoint; double newInsertionXpos = 0.0; if (reversed == true) { newInsertionXpos = sortedBarMarkXpos[i] + 75 + sortedBarMarks[i].GetObjectAlignedBoundingBox().Width / 2; } else { newInsertionXpos = sortedBarMarkXpos[i] - 75 - sortedBarMarks[i].GetObjectAlignedBoundingBox().Width / 2; } TSG.Point newInsertionPoint = new TSG.Point(newInsertionXpos, newInsertionYpos); TSG.Vector moveVector = new TSG.Vector( newInsertionPoint.X - currBarMarkPosition.X, newInsertionPoint.Y - currBarMarkPosition.Y, 0.0); sortedBarMarks[i].MoveObjectRelative(moveVector); sortedBarMarks[i].Modify(); newInsertionYpos -= PS.Default.usr_BarMarkYOffset; } }
public GeometricPlane PickFace() { Picker picker = new Picker(); PickInput input = picker.PickFace("Pick a FACE"); IEnumerator enumerator = input.GetEnumerator(); List <T3D.Point> points = new List <T3D.Point>(); while (enumerator.MoveNext()) { InputItem item = enumerator.Current as InputItem; if (item.GetInputType() == InputItem.InputTypeEnum.INPUT_POLYGON) { ArrayList alist = item.GetData() as ArrayList; // int counter = 1; foreach (T3D.Point p in alist) { points.Add(p); // Txt(p, counter.ToString()); // counter++; } } } T3D.Point origin = points[1]; T3D.Vector axisX = new T3D.Vector(points[0] - points[1]); T3D.Vector axisY = new T3D.Vector(points[2] - points[1]); GeometricPlane geomPlane = new GeometricPlane(origin, axisX, axisY); Model model = new Model(); WorkPlaneHandler workPlane = model.GetWorkPlaneHandler(); TransformationPlane currentPlane = workPlane.GetCurrentTransformationPlane(); Matrix matrix = currentPlane.TransformationMatrixToLocal; T3D.Point p1 = matrix.Transform(geomPlane.Origin); T3D.Point p2 = matrix.Transform(geomPlane.Origin + geomPlane.Normal); geomPlane.Origin = p1; geomPlane.Normal = new T3D.Vector(p2 - p1); T3D.Point dummy = null; int counter = 1; foreach (T3D.Point pt in points) { dummy = matrix.Transform(pt); Txt(dummy, counter.ToString()); counter++; } return(geomPlane); }
/// <summary>Checks if the point is on the line segment. Line segment is the fragment of line in 3d with start point and end point. Method should be private but in public may be usefull</summary> /// <param name="lineSegment">The line segment</param> /// <param name="point">The point to check</param> /// <returns>Return true if point is on the line segment between start and end point. Otherwise return false.</returns> public static bool IsThePointOnTheLineSegment(T3D.LineSegment lineSegment, T3D.Point point) { if (T3D.Distance.PointToPoint(lineSegment.Point1, point) < 0.1) { return(true); } if (T3D.Distance.PointToPoint(lineSegment.Point2, point) < 0.1) { return(true); } var vector1 = new T3D.Vector(lineSegment.Point1 - point); var vector2 = new T3D.Vector(lineSegment.Point2 - point); return(Math.Abs(vector1.GetAngleBetween(vector2) - Math.PI) < 0.001); }
public static T3D.Vector getDirectionVector(T3D.Point start, T3D.Point end) { double dX = end.X - start.X; double dY = end.Y - start.Y; double dZ = end.Z - start.Z; double dT = Math.Pow(Math.Pow(dX, 2) + Math.Pow(dY, 2) + Math.Pow(dZ, 2), 0.5); dX = dX / dT; dY = dY / dT; dZ = dZ / dT; T3D.Vector vector = new T3D.Vector(dX, dY, dZ); return(vector); }
public void conver_coordinates_center_point(t3d.Point center, t3d.Point point1, out t3d.Point center1, out t3d.Point point2) { TransformationPlane transformationPlane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); t3d.Vector vector = new Vector(-center.X + point1.X, -center.Y + point1.Y, -center.Z + point1.Z); t3d.Vector vectory = vector.Cross(new Vector(0, 0, -1)); vector.Normalize(); vectory.Normalize(); TransformationPlane transformation = new TransformationPlane(center, vector, vectory); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformation); center1 = transformation.TransformationMatrixToLocal.Transform (transformationPlane.TransformationMatrixToGlobal.Transform(center)); point2 = transformation.TransformationMatrixToLocal.Transform (transformationPlane.TransformationMatrixToGlobal.Transform(point1)); }
//Draws the arrows of the vectors private static T3D.Vector ArrowVector(T3D.Vector Vector, double Radians) { double X, Y, Z; if (Vector.X == 0 && Vector.Y == 0) { X = Vector.X; Y = (Vector.Y * Math.Cos(Radians)) - (Vector.Z * Math.Sin(Radians)); Z = (Vector.Y * Math.Sin(Radians)) + (Vector.Z * Math.Cos(Radians)); } else { X = (Vector.X * Math.Cos(Radians)) - (Vector.Y * Math.Sin(Radians)); Y = (Vector.X * Math.Sin(Radians)) + (Vector.Y * Math.Cos(Radians)); Z = Vector.Z; } return(new T3D.Vector(X, Y, Z)); }
private void alignMarksHorizontal(List <MarkBase> barMarks) { MarkBase[] sortedBarMarks = barMarks.ToArray(); for (int i = 0; i < sortedBarMarks.Length; i++) { TSDrg.LeaderLinePlacing placing = (LeaderLinePlacing)sortedBarMarks[i].Placing; double newInsertionXpos = sortedBarMarks[i].InsertionPoint.X; double newInsertionYpos = placing.StartPoint.Y + sortedBarMarks[i].GetObjectAlignedBoundingBox().Height / 2; TSG.Point currBarMarkPosition = sortedBarMarks[i].InsertionPoint; TSG.Point newInsertionPoint = new TSG.Point(newInsertionXpos, newInsertionYpos); TSG.Vector moveVector = new TSG.Vector( newInsertionPoint.X - currBarMarkPosition.X, newInsertionPoint.Y - currBarMarkPosition.Y, 0.0); sortedBarMarks[i].MoveObjectRelative(moveVector); sortedBarMarks[i].Modify(); } }
private TSG.CoordinateSystem GetBasicViewsCoordinateSystemForTopView(TSG.CoordinateSystem objectCoordinateSystem) { TSG.CoordinateSystem result = new TSG.CoordinateSystem() { Origin = new TSG.Point(objectCoordinateSystem.Origin), AxisX = new TSG.Vector(objectCoordinateSystem.AxisX) * -1.0, AxisY = new TSG.Vector(objectCoordinateSystem.AxisY) }; TSG.Vector tempVector = (result.AxisX.Cross(UpDirection)); if (tempVector == new TSG.Vector()) { tempVector = (objectCoordinateSystem.AxisY.Cross(UpDirection)); } result.AxisX = tempVector.Cross(UpDirection).GetNormal(); result.AxisY = UpDirection.GetNormal(); return(result); }
private void btnPickPoints_Click(object sender, EventArgs e) { T3D.Point firstPoint = null; // first point picked by user T3D.Point secondPoint = null; // second point picked by user TSMUI.Picker picker = new TSMUI.Picker(); // picker for user to pick points try { // store picked points in an ArrayList ArrayList pickedPoints = picker.PickPoints(Tekla.Structures.Model.UI.Picker.PickPointEnum.PICK_TWO_POINTS); firstPoint = pickedPoints[0] as T3D.Point; // first picked point secondPoint = pickedPoints[1] as T3D.Point; // second picked point } catch // if user cancels without selecting points { // set both points to null firstPoint = null; secondPoint = null; // inform user that first and second points weren't chosen MessageBox.Show("First and second points were not chosen."); } finally { // if first and second points aren't null if (firstPoint != null && secondPoint != null) { // subtract distance between two points T3D.Vector XVector = new T3D.Vector(secondPoint.X - firstPoint.X, secondPoint.Y - firstPoint.Y, secondPoint.Z - firstPoint.Z); T3D.Vector YVector = new T3D.Vector(new T3D.Vector(0, 0, -1)); // use selected points to set work plane Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(firstPoint, XVector, YVector)); // commit changes to model Model.CommitChanges(); } } }
public void FittingBeamByFace() { Beam beam = PickBeam(); GeometricPlane geomPlane = PickFace(); Fitting fitting = new Fitting(); fitting.Father = beam; CoordinateSystem beamCS = beam.GetCoordinateSystem(); ReperShow(beamCS); Line lineAlongBeamAxisX = new Line(beamCS.Origin, beamCS.AxisX); //do u need Z asis //T3D.Vector axisZ = beamCS. T3D.Point intersectionPoint = Intersection.LineToPlane(lineAlongBeamAxisX, geomPlane); PointShow(intersectionPoint, "intersectionPoint"); T3D.Point randomPoint = new T3D.Point(intersectionPoint + new T3D.Point(500, 500, 500)); PointShow(randomPoint, "randomPoint"); randomPoint = Projection.PointToPlane(randomPoint, geomPlane); PointShow(randomPoint, "Projected randomPoint"); T3D.Vector x = new T3D.Vector(randomPoint - intersectionPoint); T3D.Vector y = geomPlane.Normal.Cross(x); CoordinateSystem itersect = new CoordinateSystem(intersectionPoint, x, y); ReperShow(itersect); Plane plane = new Plane(); plane.Origin = intersectionPoint; plane.AxisX = x; plane.AxisY = y; x.Normalize(500); y.Normalize(500); fitting.Plane = plane; fitting.Insert(); Model.CommitChanges(); }
private void button2_Click(object sender, EventArgs e) { // *기본 가정 // 1) 슬라브를 배치할 두 빔은 평행 // 2) 슬라브는 비스듬하게 배치되지 않음.(두빔에 항상 수직방향으로 배치됨) // 3) 슬라브는 z평면과 수평하게 배치됨 TSM.Model currentModel = new TSM.Model(); try { // 1. 슬라브 객체 생성 ContourPlate contourPlate = new ContourPlate(); // 2. 슬라브 생성할 두 부재 선택 Picker picker = new Picker(); TSM.ModelObject mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "슬라브를 삽입할 첫번째 부재를 선택하세요."); TSM.Beam startBeam = mainpart as TSM.Beam; mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "슬라브를 삽입할 두번째 부재를 선택하세요."); TSM.Beam endBeam = mainpart as TSM.Beam; // 3. 기본 방향벡터 생성 // 1) StartBeam의 길이방향 단위벡터 TSG.Vector startBeamLDirectionVector = new TSG.Vector(startBeam.EndPoint - startBeam.StartPoint).GetNormal(); // 2) StartBeam의 높이방향 단위벡터- TSG.Vector startBeamHDirecitionVector = new TSG.Vector(0, 0, 1); //추후 기울어진 빔에도 적용가능하도록 변경 // EdgeEnumerator를 통해 StartBeam의 높이방향 단위벡터 구하기 Solid solid = startBeam.GetSolid(); if (solid != null) { EdgeEnumerator edgeEnumerator = solid.GetEdgeEnumerator(); int edgeCount = 0; while (edgeEnumerator.MoveNext()) { var edge = edgeEnumerator.Current as Edge; if (edge != null) { Console.WriteLine("Start : " + edge.StartPoint.ToString()); Console.WriteLine("End : " + edge.EndPoint.ToString()); Console.WriteLine("Type :" + edge.Type.ToString()); if (edgeCount == 8) { startBeamHDirecitionVector = new TSG.Vector((edge.EndPoint.X - edge.StartPoint.X) / 2, (edge.EndPoint.Y - edge.StartPoint.Y) / 2, (edge.EndPoint.Z - edge.StartPoint.Z) / 2).GetNormal(); } edgeCount++; } } } // 3) StartBeam -> EndBeam 방향 단위벡터 (중점에서 중점 잇는 벡터) TSG.Point sbSP = startBeam.StartPoint; TSG.Point sbEP = startBeam.EndPoint; TSG.Point ebSP = endBeam.StartPoint; TSG.Point ebEP = endBeam.EndPoint; TSG.Point starBeamCenterPoint = new TSG.Point((sbSP.X + sbEP.X) / 2, (sbSP.Y + sbEP.Y) / 2, (sbSP.Z + sbEP.Z) / 2); TSG.Point endBeamCenterPoint = new TSG.Point((ebSP.X + ebEP.X) / 2, (ebSP.Y + ebEP.Y) / 2, (ebSP.Z + ebEP.Z) / 2); TSG.Vector startBeamToEndBeamVector = new TSG.Vector((ebSP.X + ebEP.X) / 2 - (sbSP.X + sbEP.X) / 2, (ebSP.Y + ebEP.Y) / 2 - (sbSP.Y + sbEP.Y) / 2, (ebSP.Z + ebEP.Z) / 2 - (sbSP.Z + sbEP.Z) / 2); TSG.Vector startBeamToEndBeamDirectionVector = new TSG.Vector((ebSP.X + ebEP.X) / 2 - (sbSP.X + sbEP.X) / 2, (ebSP.Y + ebEP.Y) / 2 - (sbSP.Y + sbEP.Y) / 2, (ebSP.Z + ebEP.Z) / 2 - (sbSP.Z + sbEP.Z) / 2).GetNormal(); // 3. 슬라브 치수 및 기타속성 입력 ( 현재는 상수 ) double slabWidthLeft = 300; double slabWidthCenter = 300; double slabWidthRight = 300; double slabThickness = 100; double ribThickness = 200; double ribDistUpper = 50; double ribDistLower = 30; double ribInterval = ribDistUpper - ribDistLower; double startOffset = 100; contourPlate.Profile.ProfileString = (startBeamToEndBeamVector.GetLength() - startOffset * 2).ToString(); contourPlate.Material.MaterialString = "C24"; // 4. 슬라브 시작점 설정 // 1) 길이방향(일단은 startPoint점에서 시작하는걸로) String direction = "정방향"; //사용자가 직접 선택. 정방향 or 역방향 TSG.Point slabStartPoint = new TSG.Point(); if (direction == "정방향") { slabStartPoint = startBeam.StartPoint; } else if (direction == "역방향") { slabStartPoint = startBeam.EndPoint; startBeamLDirectionVector = startBeamLDirectionVector * -1; } // 2) 높이방향 double heightConstant = 0.0; //depth type에 따른 슬라브 생성높이 변경 if (startBeam.Position.Depth == Position.DepthEnum.FRONT) { heightConstant = 1.0; } else if (startBeam.Position.Depth == Position.DepthEnum.MIDDLE) { heightConstant = 0.5; } slabStartPoint += startBeamHDirecitionVector * ((Methods.GetGirderHeight(startBeam) * heightConstant + slabThickness + ribThickness)); // 3) endBeam방향 slabStartPoint += startBeamToEndBeamDirectionVector * (startOffset); // 5. 슬라브 포인트 입력 List <TSG.Point> pointList = new List <TSG.Point>(); pointList.Add(slabStartPoint); pointList.Add(pointList[0] + (startBeamHDirecitionVector * slabThickness * -1)); pointList.Add(pointList[1] + (startBeamLDirectionVector * slabWidthLeft)); pointList.Add(pointList[2] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness * -1)); pointList.Add(pointList[3] + (startBeamLDirectionVector * ribDistLower)); pointList.Add(pointList[4] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness)); pointList.Add(pointList[5] + (startBeamLDirectionVector * slabWidthCenter)); pointList.Add(pointList[6] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness * -1)); pointList.Add(pointList[7] + (startBeamLDirectionVector * ribDistLower)); pointList.Add(pointList[8] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness)); pointList.Add(pointList[9] + (startBeamLDirectionVector * slabWidthRight)); pointList.Add(pointList[10] + (startBeamHDirecitionVector * slabThickness)); for (int i = 0; i <= 11; i++) { contourPlate.AddContourPoint(new ContourPoint(pointList[i], null)); } // 4. 슬라브 깊이타입 결정 // 1) StartBeam 중앙에서 L,H Direction의 법선 벡터방향 으로 Line을 뻗어 EndBeam과 겹치는 부분이 있는지 확인 // 2) 겹치면 깊이타입 Front , 겹치지 않으면 Back // StartBeam 중앙에서 L,H Direction의 법선 벡터(외적 결과값) TSG.Vector crossResult = TSG.Vector.Cross(startBeamHDirecitionVector, startBeamLDirectionVector); // 외적벡터의 연장선 TSG.Point extendedPoint = new TSG.Point(starBeamCenterPoint.X, starBeamCenterPoint.Y, starBeamCenterPoint.Z) + new TSG.Point(crossResult.X * 10000, crossResult.Y * 10000, crossResult.Z * 10000); TSG.LineSegment centerLineSegment = new TSG.LineSegment(starBeamCenterPoint, extendedPoint); //endBeam의 Plane 작성 TSG.Vector planeNormalVector = crossResult; //조건 중 startBeam과 endBeam이 평행하므로 평면을 구성하는 법선벡터 또한 같다. TSG.GeometricPlane endBeamPlane = new TSG.GeometricPlane(endBeamCenterPoint, planeNormalVector); //두 line이 겹치는지 확인하는 Point (겹치면 값이 있고 안겹치면 값이 없음) TSG.Point isIntersect = TSG.Intersection.LineSegmentToPlane(centerLineSegment, endBeamPlane); if (isIntersect != null) // endBeam이 오른쪽에 있을 때 { if (direction == "정방향") { contourPlate.Position.Depth = Position.DepthEnum.BEHIND; } else if (direction == "역방향") { contourPlate.Position.Depth = Position.DepthEnum.FRONT; } } else if (isIntersect == null) // endBeam이 오른쪽에 없을 때 { if (direction == "정방향") { contourPlate.Position.Depth = Position.DepthEnum.FRONT; } else if (direction == "역방향") { contourPlate.Position.Depth = Position.DepthEnum.BEHIND; } } bool result = false; result = contourPlate.Insert(); currentModel.CommitChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
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 { } }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { TSM.Model model = new TSM.Model(); TSD.DrawingHandler drawingHandler = new TSD.DrawingHandler(); TSG.Vector UpDirection = new TSG.Vector(0.0, 0.0, 1.0); TSD.Size A3 = new TSD.Size(410, 287); TSM.TransformationPlane current = model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TSM.TransformationPlane()); TSM.ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects(); while (modelObjectEnum.MoveNext()) { if (modelObjectEnum.Current is Tekla.Structures.Model.Part) { TSM.Part selectedPart = (TSM.Part)modelObjectEnum.Current; string USER_FIELD_3 = "", USER_FIELD_4 = ""; selectedPart.GetUserProperty("USER_FIELD_3", ref USER_FIELD_3); selectedPart.GetUserProperty("USER_FIELD_4", ref USER_FIELD_4); USER_FIELD_4 = USER_FIELD_4.Replace("(?)", ""); selectedPart.SetUserProperty("USER_FIELD_4", USER_FIELD_4); if (USER_FIELD_3 == "M") { TSD.Drawing gaDrawing = new TSD.GADrawing("BRAD-Mod-Ass", A3); gaDrawing.Name = selectedPart.Name; gaDrawing.Title1 = "SITEWORK"; gaDrawing.Title2 = USER_FIELD_3 + USER_FIELD_4; gaDrawing.Title3 = ""; gaDrawing.Insert(); drawingHandler.SetActiveDrawing(gaDrawing, false); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new Tekla.Structures.Model.TransformationPlane(selectedPart.GetCoordinateSystem())); TSM.Solid tsolid = selectedPart.GetSolid(); TSG.Point tsMinPt = tsolid.MinimumPoint; TSG.Point tsMaxPt = tsolid.MaximumPoint; model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new Tekla.Structures.Model.TransformationPlane()); if (selectedPart.Name.Contains("BEAM")) { TSG.CoordinateSystem ModelObjectCoordSys = selectedPart.GetCoordinateSystem(); TSG.CoordinateSystem PlanViewCoordSys = new TSG.CoordinateSystem(); PlanViewCoordSys.Origin = new TSG.Point(ModelObjectCoordSys.Origin); PlanViewCoordSys.AxisX = new TSG.Vector(ModelObjectCoordSys.AxisX) * -1.0; PlanViewCoordSys.AxisY = new TSG.Vector(ModelObjectCoordSys.AxisY); TSG.Vector tempVector = (PlanViewCoordSys.AxisX.Cross(UpDirection)); if (tempVector == new TSG.Vector()) { tempVector = (ModelObjectCoordSys.AxisY.Cross(UpDirection)); } PlanViewCoordSys.AxisX = tempVector.Cross(UpDirection); PlanViewCoordSys.AxisY = tempVector; TSM.Solid solid = selectedPart.GetSolid(); TSG.AABB aabbPlanView = new TSG.AABB(); aabbPlanView.MinPoint = new TSG.Point(-50, tsMinPt.Z - 50, tsMinPt.Y - 50); aabbPlanView.MaxPoint = new TSG.Point(tsMaxPt.X + 50, tsMaxPt.Z + 50, tsMaxPt.Y + 50); TSD.View PlanView = new TSD.View(gaDrawing.GetSheet(), PlanViewCoordSys, PlanViewCoordSys, aabbPlanView, "BRAD-Mod-Ass"); PlanView.Name = "TOP"; PlanView.Scale = 10; PlanView.Attributes.Shortening.CutParts = true; PlanView.Attributes.Shortening.MinimumLength = 1200; PlanView.Attributes.Shortening.Offset = 0.5; PlanView.Insert(); PlanView.Attributes.FixedViewPlacing = true; PlanView.Origin = new TSG.Point(100, 200); PlanView.Modify(); TSG.CoordinateSystem FrontViewCoordSys = (TSG.CoordinateSystem)PlanViewCoordSys; FrontViewCoordSys.AxisX = tempVector.Cross(UpDirection).GetNormal(); FrontViewCoordSys.AxisY = UpDirection.GetNormal(); TSG.AABB aabbFrontView = new TSG.AABB(); aabbFrontView.MinPoint = new TSG.Point(-50, tsMinPt.Y - 50, tsMinPt.Z - 50); aabbFrontView.MaxPoint = new TSG.Point(tsMaxPt.X + 50, tsMaxPt.Y + 50, tsMaxPt.Z + 50); TSD.View FrontView = new TSD.View(gaDrawing.GetSheet(), FrontViewCoordSys, FrontViewCoordSys, aabbFrontView, "BRAD-Mod-Ass"); FrontView.Name = "FRONT"; FrontView.Scale = 10; FrontView.Attributes.Shortening.CutParts = true; FrontView.Attributes.Shortening.MinimumLength = 1200; FrontView.Attributes.Shortening.Offset = 0.5; FrontView.Insert(); FrontView.Attributes.FixedViewPlacing = true; FrontView.Origin = new TSG.Point(100, (200 - FrontView.Height - 2)); FrontView.Modify(); } if (selectedPart.Name.Contains("COLUMN")) { TSG.CoordinateSystem ModelObjectCoordSys = selectedPart.GetCoordinateSystem(); TSG.CoordinateSystem PlanViewCoordSys = new TSG.CoordinateSystem(); PlanViewCoordSys.Origin = new TSG.Point(ModelObjectCoordSys.Origin); PlanViewCoordSys.AxisX = new TSG.Vector(ModelObjectCoordSys.AxisX); PlanViewCoordSys.AxisY = new TSG.Vector(ModelObjectCoordSys.AxisY); TSG.Vector tempVector = (PlanViewCoordSys.AxisX.Cross(UpDirection)); if (tempVector == new TSG.Vector()) { tempVector = (ModelObjectCoordSys.AxisY.Cross(UpDirection)); } TSG.AABB aabbPlanView = new TSG.AABB(); aabbPlanView.MinPoint = new TSG.Point(-50, tsMinPt.Y - 50, tsMinPt.Z - 50); aabbPlanView.MaxPoint = new TSG.Point(tsMaxPt.X + 50, tsMaxPt.Y + 50, tsMaxPt.Z + 50); TSD.View PlanView = new TSD.View(gaDrawing.GetSheet(), PlanViewCoordSys, PlanViewCoordSys, aabbPlanView, "BRAD-Mod-Ass"); PlanView.Name = "TOP"; PlanView.Scale = 10; PlanView.Attributes.Shortening.CutParts = true; PlanView.Attributes.Shortening.MinimumLength = 1200; PlanView.Attributes.Shortening.Offset = 0.5; PlanView.Origin = new TSG.Point(100, 200); PlanView.Insert(); PlanView.Attributes.FixedViewPlacing = true; PlanView.Modify(); TSG.CoordinateSystem FrontViewCoordSys = (TSG.CoordinateSystem)PlanViewCoordSys; FrontViewCoordSys.AxisY = new TSG.Vector(ModelObjectCoordSys.AxisY).Cross(UpDirection) * -1; TSG.AABB aabbFrontView = new TSG.AABB(); aabbFrontView.MinPoint = new TSG.Point(-50, tsMinPt.Z - 50, tsMinPt.Y - 50); aabbFrontView.MaxPoint = new TSG.Point(tsMaxPt.X + 50, tsMaxPt.Z + 50, tsMaxPt.Y + 50); TSD.View FrontView = new TSD.View(gaDrawing.GetSheet(), FrontViewCoordSys, FrontViewCoordSys, aabbFrontView, "BRAD-Mod-Ass"); FrontView.Name = "FRONT"; FrontView.Scale = 10; FrontView.Attributes.Shortening.CutParts = true; FrontView.Attributes.Shortening.MinimumLength = 1200; FrontView.Attributes.Shortening.Offset = 0.5; FrontView.Origin = new TSG.Point(100, (200 - FrontView.Height - 30)); FrontView.Insert(); FrontView.Attributes.FixedViewPlacing = true; FrontView.Modify(); } drawingHandler.CloseActiveDrawing(true); } } } MessageBox.Show("Drawings Created"); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(current); } catch { } }
public static void pvector(T3D.Vector pp, string txt) { MainForm._form.add_text(txt + " : " + pp.X.ToString("F1") + " ; " + pp.Y.ToString("F1") + " ; " + pp.Z.ToString("F1")); }
private void button1_Click(object sender, EventArgs e) { //1. 기본 가정 // 1) 슬라브를 배치할 두 빔은 평행 // 2) 슬라브는 비스듬하게 배치되지 않음.(두빔에 항상 수직방향으로 배치됨) // 3) 슬라브는 z평면과 수평하게 배치됨 ContourPlate contourPlate = new ContourPlate(); contourPlate.Position.Depth = Position.DepthEnum.FRONT; //2. 현재 모델의 좌표계(글로벌좌표계) 및 Z 벡터 저장 TSM.Model currentModel = new TSM.Model(); WorkPlaneHandler workPlaneHandler = currentModel.GetWorkPlaneHandler(); TransformationPlane originPlane = workPlaneHandler.GetCurrentTransformationPlane(); //3. 슬라브 생성할 두 부재 선택 Picker picker = new Picker(); TSM.ModelObject mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "슬라브를 삽입할 첫번째 부재를 선택하세요."); TSM.Beam startBeam = mainpart as TSM.Beam; mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "슬라브를 삽입할 두번째 부재를 선택하세요."); TSM.Beam endBeam = mainpart as TSM.Beam; //4. 새 좌표계 생성(startBeam과 EndBeam과의 관계 내포) TSG.Vector coordinateVector2 = new TSG.Vector(startBeam.EndPoint - startBeam.StartPoint); TSG.Vector coordinateVector1 = new TSG.Vector(endBeam.EndPoint - startBeam.StartPoint); TransformationPlane slabCoordinateSystem = new TransformationPlane(startBeam.StartPoint, coordinateVector2, coordinateVector1); workPlaneHandler.SetCurrentTransformationPlane(slabCoordinateSystem); //5. 슬라브 Point시작점 위치 잡기 //1) 슬라브 벡터 설정 TSG.Vector slabVector = new TSG.Vector(0, 1, 0); //3) offset길이만큼 beam1 e.p 방향으로 이동(추후 작성) //4) 걸침 높이만큼 z축 방향으로 이동(여기서는 slab Height로 가야함)(추후 작성) //6. 슬라브 치수요소 입력 ( 현재는 상수 ) double slabWidthLeft = 300; double slabWidthCenter = 300; double slabWidthRight = 300; double slabHeight = 300; double ribDistUpper = 50; double ribDistLower = 30; double slabThickness = 100; //7. 슬라브 시작점 설정 TSG.Point slabStartPoint = new TSG.Point(0, 0, (Methods.GetGirderHeight(startBeam) * 0.5 + slabHeight) * -1); //Y방향 설정 double startOffset = 100; slabStartPoint += slabVector * Methods.GetGirderWidth(startBeam) * 0.5; slabStartPoint += slabVector * startOffset * -1; //8. 슬라브 포인트 입력 (수정) TSG.Point point1 = new TSG.Point(slabStartPoint.X, slabStartPoint.Y, slabStartPoint.Z); TSG.Point point2 = new TSG.Point(slabStartPoint.X, slabStartPoint.Y, slabStartPoint.Z + (slabThickness)); TSG.Point point3 = new TSG.Point(slabStartPoint.X + slabWidthLeft - ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness)); TSG.Point point4 = new TSG.Point(slabStartPoint.X + slabWidthLeft - ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight)); TSG.Point point5 = new TSG.Point(slabStartPoint.X + slabWidthLeft + ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight)); TSG.Point point6 = new TSG.Point(slabStartPoint.X + slabWidthLeft + ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness)); TSG.Point point7 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter - ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness)); TSG.Point point8 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter - ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight)); TSG.Point point9 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight)); TSG.Point point10 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness)); TSG.Point point11 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + slabWidthRight, slabStartPoint.Y, slabStartPoint.Z + (slabThickness)); TSG.Point point12 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + slabWidthRight, slabStartPoint.Y, slabStartPoint.Z); //TSG.Point point1 = new TSG.Point(slabStartPoint.X, slabStartPoint.Y, slabStartPoint.Z); //TSG.Point point2 = new TSG.Point(slabStartPoint.X, slabStartPoint.Y, slabStartPoint.Z + (slabThickness) * -1); //TSG.Point point3 = new TSG.Point(slabStartPoint.X + slabWidthLeft - ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness) * -1); //TSG.Point point4 = new TSG.Point(slabStartPoint.X + slabWidthLeft - ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight) * -1); //TSG.Point point5 = new TSG.Point(slabStartPoint.X + slabWidthLeft + ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight) * -1); //TSG.Point point6 = new TSG.Point(slabStartPoint.X + slabWidthLeft + ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness) * -1); //TSG.Point point7 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter - ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness) * -1); //TSG.Point point8 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter - ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight) * -1); //TSG.Point point9 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + ribDistLower / 2, slabStartPoint.Y, slabStartPoint.Z + (slabHeight) * -1); //TSG.Point point10 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + ribDistUpper / 2, slabStartPoint.Y, slabStartPoint.Z + (slabThickness) * -1); //TSG.Point point11 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + slabWidthRight, slabStartPoint.Y, slabStartPoint.Z + (slabThickness) * -1); //TSG.Point point12 = new TSG.Point(slabStartPoint.X + slabWidthLeft + slabWidthCenter + slabWidthRight, slabStartPoint.Y, slabStartPoint.Z); contourPlate.AddContourPoint(new ContourPoint(point1, null)); contourPlate.AddContourPoint(new ContourPoint(point2, null)); contourPlate.AddContourPoint(new ContourPoint(point3, null)); contourPlate.AddContourPoint(new ContourPoint(point4, null)); contourPlate.AddContourPoint(new ContourPoint(point5, null)); contourPlate.AddContourPoint(new ContourPoint(point6, null)); contourPlate.AddContourPoint(new ContourPoint(point7, null)); contourPlate.AddContourPoint(new ContourPoint(point8, null)); contourPlate.AddContourPoint(new ContourPoint(point9, null)); contourPlate.AddContourPoint(new ContourPoint(point10, null)); contourPlate.AddContourPoint(new ContourPoint(point11, null)); contourPlate.AddContourPoint(new ContourPoint(point12, null)); contourPlate.Profile.ProfileString = "2000"; contourPlate.Material.MaterialString = "C24"; bool result = false; result = contourPlate.Insert(); currentModel.CommitChanges(); //모델의 좌표계를 재로드 workPlaneHandler.SetCurrentTransformationPlane(originPlane); }
//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); }