public static void IntersectionTest() { var model = new Model(); if (model.GetConnectionStatus()) { var startPoint = PickAPoint("выбери точку"); var startPointTwo = new Point(startPoint.X, startPoint.Y + 1000, startPoint.Z); List <RandomlyPlate> plateList = new List <RandomlyPlate>(); plateList.Add(new RandomlyPlate(startPoint, rnd)); plateList.Add(new RandomlyPlate(startPointTwo, rnd)); if (Helper.GetIntersectionPlate(plateList[0].ContourPoints, plateList[1].ContourPoints)) { plateList[0].Number = 1; plateList[1].Number = 2; } foreach (var item in plateList) { var plate = new ContourPlate(); foreach (var point in item.ContourPoints) { plate.AddContourPoint(new ContourPoint(point, null)); } plate.Name = "Пластина"; plate.Profile.ProfileString = "—6"; plate.Material.MaterialString = "С255"; plate.Class = $"{item.Number + 1}"; plate.Insert(); } } model.CommitChanges(); }
static void Main(string[] args) { var model = new Model(); if (model.GetConnectionStatus()) { Console.WriteLine("Give diameter"); int diameter = Int32.Parse(Console.ReadLine()); int numberOfPoints = 90; var slab = new ContourPlate(); for (int i = 0; i < numberOfPoints; i++) { slab.AddContourPoint(new ContourPoint( new Tekla.Structures.Geometry3d.Point( Math.Sin(360 / numberOfPoints * i * Math.PI / 180) * diameter / 2, Math.Cos(360 / numberOfPoints * i * Math.PI / 180) * diameter / 2, 0), null)); } slab.Class = "5"; slab.Profile.ProfileString = "500"; slab.Insert(); //Beam beam = new Beam(); //beam.StartPoint = new Tekla.Structures.Geometry3d.Point(0, 0, 0); //beam.EndPoint = new Tekla.Structures.Geometry3d.Point(0, 1500, 0); //beam.Profile.ProfileString = "600*500"; //beam.Class = "4"; //beam.Insert(); model.CommitChanges(); } }
public ContourPlate CreateCut( Point point1, Point point2, Point point3, Point point4, Part Part_To_Be_Cut) { ContourPlate contourPlate = new ContourPlate(); contourPlate.Profile.ProfileString = "PL500"; contourPlate.Material.MaterialString = "ANTIMATERIAL"; contourPlate.Finish = ""; contourPlate.Class = "BlOpCl"; contourPlate.Position.Depth = Position.DepthEnum.MIDDLE; contourPlate.AddContourPoint(new ContourPoint(point1, (Chamfer)null)); contourPlate.AddContourPoint(new ContourPoint(point2, (Chamfer)null)); contourPlate.AddContourPoint(new ContourPoint(point3, (Chamfer)null)); contourPlate.AddContourPoint(new ContourPoint(point4, (Chamfer)null)); contourPlate.Insert(); BooleanPart booleanPart = new BooleanPart(); booleanPart.Father = (ModelObject)Part_To_Be_Cut; booleanPart.OperativePart = (Part)contourPlate; booleanPart.Insert(); return(contourPlate); }
private Part DrawUpFloor(Point input, Vector alongStairVect, double width, double length, double overlap, string floorProfile, string floorMaterial) { Vector zaxis = new Vector(0, 0, -1); Vector shortEdge = Vector.Cross(zaxis, alongStairVect); alongStairVect = alongStairVect * length * (-1); Vector shortEdgeLeft = shortEdge * ((width + 2 * overlap) / 2); Vector shortEdgeRight = shortEdgeLeft * (-1); Point leftNearCornerPt = new Point(input.X + shortEdgeLeft.X, input.Y + shortEdgeLeft.Y, input.Z + shortEdgeLeft.Z); Point rightNearCornerPt = new Point(input.X + shortEdgeRight.X, input.Y + shortEdgeRight.Y, input.Z + shortEdgeRight.Z); Point leftFarCornerPt = new Point(leftNearCornerPt.X + alongStairVect.X, leftNearCornerPt.Y + alongStairVect.Y, leftNearCornerPt.Z + alongStairVect.Z); Point rightFarCornerPt = new Point(rightNearCornerPt.X + alongStairVect.X, rightNearCornerPt.Y + alongStairVect.Y, rightNearCornerPt.Z + alongStairVect.Z); ContourPoint leftCpStartPt = new ContourPoint(leftNearCornerPt, null); ContourPoint leftCpEndPt = new ContourPoint(leftFarCornerPt, null); ContourPoint rightCpStartPt = new ContourPoint(rightNearCornerPt, null); ContourPoint rightCpEndPt = new ContourPoint(rightFarCornerPt, null); ContourPlate floorBeam = new ContourPlate(); floorBeam.AddContourPoint(leftCpStartPt); floorBeam.AddContourPoint(leftCpEndPt); floorBeam.AddContourPoint(rightCpEndPt); floorBeam.AddContourPoint(rightCpStartPt); floorBeam.Profile.ProfileString = floorProfile; floorBeam.Material.MaterialString = floorMaterial; floorBeam.Position.Depth = Position.DepthEnum.FRONT; floorBeam.Insert(); return(floorBeam); }
private void MallinnaLaatta() { ModelObjectSelector mSelector = malli.GetModelObjectSelector(); ModelObjectEnumerator enumer = mSelector.GetAllObjects(); for (int i = 0; i < enumer.GetSize(); i++) { ModelObject obj = enumer.Current; if (obj is ContourPlate) { if (((ContourPlate)obj).Name == "LASKETTU_LAATTA") { ContourPlate laattaTemp = (ContourPlate)obj; laattaTemp.Contour.ContourPoints[0] = new ContourPoint(new Point(0, 0, 3000), null); laattaTemp.Contour.ContourPoints[1] = new ContourPoint(new Point(0, laatanKorkeus, 3000), null); laattaTemp.Contour.ContourPoints[2] = new ContourPoint(new Point(laatanLeveys, laatanKorkeus, 3000), null); laattaTemp.Contour.ContourPoints[3] = new ContourPoint(new Point(laatanLeveys, 0, 3000), null); PoistaRaudoitus(laattaTemp); laattaTemp.Modify(); malli.CommitChanges(); return; } } enumer.MoveNext(); } ContourPlate laatta = new ContourPlate(); laatta.Name = "LASKETTU_LAATTA"; ContourPoint vasenAlanurkka = new ContourPoint(new Point(0, 0, 3000), null); ContourPoint vasenYlanurkka = new ContourPoint(new Point(0, laatanKorkeus, 3000), null); ContourPoint oikeaYlanurkka = new ContourPoint(new Point(laatanLeveys, laatanKorkeus, 3000), null); ContourPoint oikeaAlanurkka = new ContourPoint(new Point(laatanLeveys, 0, 3000), null); laatta.AddContourPoint(vasenAlanurkka); laatta.AddContourPoint(vasenYlanurkka); laatta.AddContourPoint(oikeaYlanurkka); laatta.AddContourPoint(oikeaAlanurkka); laatta.Profile.ProfileString = Asetukset.LaatanPaksuus.ToString(); if (!string.IsNullOrWhiteSpace(Asetukset.BetoninLujuus.ToString())) { laatta.Material.MaterialString = betonimateriaalit[Asetukset.BetoninLujuus]; } else { laatta.Material.MaterialString = "Concrete_Undefined"; } laatta.Position.Depth = Position.DepthEnum.FRONT; laatta.Insert(); malli.CommitChanges(); }
public static void CreatingCuttingFCNR() { var model = new Model(); if (model.GetConnectionStatus()) { var startPoint = PickAPoint(); var startPointPart = new Point(startPoint.X, startPoint.Y, startPoint.Z + 6); #region Create_Main_Plate const int widthMainPlate = 2000; var mainPlate = Plate.MainPlate(startPoint, 6000, widthMainPlate); mainPlate.Insert(); #endregion #region Создание случайных пластин List <RandomlyPlate> plateList = new List <RandomlyPlate>(); for (int i = 0; i < rnd.Next(99, 100); i++) { plateList.Add(new RandomlyPlate(startPointPart, rnd)); } var orderByPlateList = plateList.OrderByDescending(RandomlyPlate => RandomlyPlate.Width); var n = 1; foreach (var item in orderByPlateList) { item.Number = n; n++; } var sortOrderByPlateList = Helper.SortingFCNR(orderByPlateList, widthMainPlate); foreach (var item in sortOrderByPlateList) { var plate = new ContourPlate(); foreach (var point in item.ContourPoints) { plate.AddContourPoint(new ContourPoint(point, null)); } plate.Name = "Пластина"; plate.Profile.ProfileString = "—6"; plate.Material.MaterialString = "С255"; plate.Class = $"{item.Number+1}"; plate.Insert(); } #endregion } model.CommitChanges(); }
public void UT_CutBeamByPart() { // test 0: обрезаем балку ThisBeam балкой MainBeam //.. создаем балку [0, 1000 - 2000,1000] I20 и обрезает ее //.. балкой MainBeam [500,0 - 500, 1500] I50 Point p1 = new Point(0, 3000); Point p2 = new Point(2000, 3000); ThisBeam = _TS.CreateBeam("ThisBeam", "I20B1_20_93", p1, p2 , PositionDepth: (int)Position.DepthEnum.MIDDLE); Point cp1 = new Point(1000, 0); Point cp2 = new Point(1000, 4000); MainBeam = _TS.CreateBeam("MainBeam", "I50B1_20_93", cp1, cp2 , PositionDepth: (int)Position.DepthEnum.MIDDLE , Class: BooleanPart.BooleanOperativeClassName); ThisBeam = _TS.CutBeamByPart(ThisBeam, MainBeam, false); // стираем ThisBeam и MainBeam // ThisBeam.Delete(); // MainBeam.Delete(); // Model.CommitChanges(); // test 1: обрезаем балку ThisBeam пластиной Plate p1 = new Point(3000, 2000, 1000); p2 = new Point(5000, 1000, 0); ThisBeam = _TS.CreateBeam("ThisBeam", "I20B1_20_93", p1, p2); ContourPoint c1 = new ContourPoint(new Point(4000, 1000, 0), null); ContourPoint c2 = new ContourPoint(new Point(4000, 3000, 0), null); ContourPoint c3 = new ContourPoint(new Point(4000, 3000, 2000), null); ContourPoint c4 = new ContourPoint(new Point(4000, 1000, 2000), null); var Plate = new ContourPlate(); Plate.AddContourPoint(c1); Plate.AddContourPoint(c2); Plate.AddContourPoint(c3); Plate.AddContourPoint(c4); Plate.Profile.ProfileString = "PL200"; Plate.Material.MaterialString = "C245"; Plate.Class = "2"; Plate.Name = "PLATE"; Plate.Insert(); Model.CommitChanges(); ThisBeam = _TS.CutBeamByPart(ThisBeam, Plate, false); // ThisBeam.Delete(); Plate.Delete(); Model.CommitChanges(); }
public static ContourPlate InsertPlate(Point A, Point B, Point C, string profileString, string materialString, Chamfer chamfer = null) { var cp = new ContourPlate(); cp.AddContourPoint(A, chamfer); cp.AddContourPoint(B, chamfer); cp.AddContourPoint(C, chamfer); cp.Profile.ProfileString = profileString; cp.Material.MaterialString = materialString; cp.Insert(); return(cp); }
public static ContourPlate InsertPlate(ArrayList points, string profileString, string materialString, Chamfer chamfer = null) { var cp = new ContourPlate(); foreach (Point point in points) { cp.AddContourPoint(point, chamfer); } cp.Profile.ProfileString = profileString; cp.Material.MaterialString = materialString; cp.Insert(); return(cp); }
static ContourPlate AddPlate(List <Point> points) { var contourPlate = new ContourPlate(); foreach (var point in points) { var contourPoint = new ContourPoint(point, null); contourPlate.AddContourPoint(contourPoint); } contourPlate.Profile.ProfileString = "PL100"; contourPlate.Material.MaterialString = "A36"; contourPlate.Insert(); return(contourPlate); }
static ContourPlate AddCutPlate(List <Point> points) { var cutPlate = new ContourPlate(); foreach (var point in points) { var cutPoint = new ContourPoint(point, null); cutPlate.AddContourPoint(cutPoint); } cutPlate.Profile.ProfileString = "PL100"; cutPlate.Material.MaterialString = "A36"; cutPlate.Class = BooleanPart.BooleanOperativeClassName; cutPlate.Insert(); return(cutPlate); }
private void CreatPlate(TSG.Point a, TSG.Point b, TSG.Point c, TSG.Point d, int thick) { ContourPlate curPlate = new ContourPlate(); Profile pf = new Profile(); pf.ProfileString = string.Format("PL{0}", thick); var contor = new Contour(); contor.AddContourPoint(new ContourPoint(a, null)); contor.AddContourPoint(new ContourPoint(b, null)); contor.AddContourPoint(new ContourPoint(c, null)); contor.AddContourPoint(new ContourPoint(d, null)); curPlate.Contour = contor; curPlate.Profile = pf; curPlate.Insert(); }
private Part DrawDownFloor(Point input, Vector alongStairVect, double width, double overlap, string floorProfile, string floorMaterial) { double ang = stair.Ang; double height = stair.StartPoint.Z - stair.EndPoint.Z; Vector zaxis = new Vector(0, 0, -1); Vector shortEdge = Vector.Cross(zaxis, alongStairVect); Vector shortEdgeLeft = shortEdge * ((width + 2 * overlap) / 2); Vector shortEdgeRight = shortEdgeLeft * (-1); double stairLength = height / Math.Tan(ang * Math.PI / 180); Vector longStairVect = alongStairVect * stairLength; Vector heightStairVect = zaxis * height; Point hEndPoint = new Point(input.X + heightStairVect.X, input.Y + heightStairVect.Y, input.Z + heightStairVect.Z); Point stairEndPt = new Point(hEndPoint.X + longStairVect.X, hEndPoint.Y + longStairVect.Y, hEndPoint.Z + longStairVect.Z); Vector longEdge = new Vector(stair.EndPoint.X - stairEndPt.X, stair.EndPoint.Y - stairEndPt.Y, stair.EndPoint.Z - stairEndPt.Z); Point leftNearCornerPt = new Point(stairEndPt.X + shortEdgeLeft.X, stairEndPt.Y + shortEdgeLeft.Y, stairEndPt.Z + shortEdgeLeft.Z); Point rightNearCornerPt = new Point(stairEndPt.X + shortEdgeRight.X, stairEndPt.Y + shortEdgeRight.Y, stairEndPt.Z + shortEdgeRight.Z); Point leftFarCornerPt = new Point(leftNearCornerPt.X + longEdge.X, leftNearCornerPt.Y + longEdge.Y, leftNearCornerPt.Z + longEdge.Z); Point rightFarCornerPt = new Point(rightNearCornerPt.X + longEdge.X, rightNearCornerPt.Y + longEdge.Y, rightNearCornerPt.Z + longEdge.Z); ContourPoint leftCpStartPt = new ContourPoint(leftNearCornerPt, null); ContourPoint leftCpEndPt = new ContourPoint(leftFarCornerPt, null); ContourPoint rightCpStartPt = new ContourPoint(rightNearCornerPt, null); ContourPoint rightCpEndPt = new ContourPoint(rightFarCornerPt, null); ContourPlate floorBeam = new ContourPlate(); floorBeam.AddContourPoint(leftCpStartPt); floorBeam.AddContourPoint(leftCpEndPt); floorBeam.AddContourPoint(rightCpEndPt); floorBeam.AddContourPoint(rightCpStartPt); floorBeam.Profile.ProfileString = floorProfile; floorBeam.Material.MaterialString = floorMaterial; floorBeam.Position.Depth = Position.DepthEnum.FRONT; floorBeam.Insert(); return(floorBeam); }
/// <summary> /// Adds the cut for the wallshoe components /// </summary> /// <param name="variables">List of doubles with dimensions of the component</param> /// <param name="p1">The point which gives the x position of the component on fatherpart</param> /// <param name="minY">Fatherparts solids miminum Y position</param> /// <param name="maxY">Fatherparts solids miminum Y position</param> /// <param name="changeDirection">Boolean to give the direction</param> /// <param name="fatherpart">Part to insert the cut to</param> private bool AddWallShoeCut(double[] variables, Point p1, double minY, double maxY, bool changeDirection, Part fatherpart) { try { ContourPlate cutpart = new ContourPlate(); BooleanPart bPart = new BooleanPart(); cutpart.Name = "Leikkaus"; cutpart.Position.Depth = Position.DepthEnum.MIDDLE; cutpart.Position.Plane = Position.PlaneEnum.MIDDLE; cutpart.Class = BooleanPart.BooleanOperativeClassName; cutpart.Material.MaterialString = "Reikä"; cutpart.Profile.ProfileString = "PL135"; cutpart.Profile.ProfileString = "PL" + variables[4]; if (!changeDirection) { cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - variables[0], p1.Z + variables[1]), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - variables[0], p1.Z + variables[1] + variables[2]), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + variables[1] + variables[2] + (Math.Tan(variables[3] * Math.PI / 180) * ((maxY - minY) / 2 + variables[0]))), null)); } else { cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y + variables[0], p1.Z + variables[1]), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y + variables[0], p1.Z + variables[1] + variables[2]), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + variables[1] + variables[2] + (Math.Tan(variables[3] * Math.PI / 180) * ((minY - maxY) / 2 + variables[0]))), null)); } cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + variables[1]), null)); cutpart.Insert(); bPart.Father = fatherpart; bPart.SetOperativePart(cutpart); if (!bPart.Insert()) { WriteLog("Leikkauksen (1) tekeminen epäonnistui!"); } cutpart.Delete(); } catch (Exception ex) { WriteLog(ex.Message + "\n" + ex.StackTrace); return(false); } return(true); }
private void CreateSamplePlates() { 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)); samplePlate1 = new ContourPlate { Name = "Plate", Material = { MaterialString = "S235JR" }, Profile = { ProfileString = "PL20" }, Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 } }; samplePlate1.Contour = contour1; samplePlate1.Insert(); 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)); samplePlate2 = new ContourPlate { Name = "Plate", Material = { MaterialString = "S235JR" }, Profile = { ProfileString = "PL20" }, Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 } }; samplePlate2.Contour = contour2; samplePlate2.Insert(); model.CommitChanges(); }
public static ContourPlate InsertCutPlate(ContourPlate cuttedPlate, ArrayList points, string profileString, string materialString, Chamfer chamfer = null) { var cp = new ContourPlate(); foreach (Point point in points) { cp.AddContourPoint(point, chamfer); } cp.Profile.ProfileString = profileString; cp.Material.MaterialString = materialString; cp.Class = BooleanPart.BooleanOperativeClassName; cp.Insert(); var bp = new BooleanPart { Type = BooleanPart.BooleanTypeEnum.BOOLEAN_CUT, Father = cuttedPlate }; bp.SetOperativePart(cp); bp.Insert(); cp.Delete(); return(cp); }
private void Button_Click(object sender, RoutedEventArgs e) { // Reset workplane to global currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane()); ArrayList PickedPoints = null; TSMUI.Picker myPicker = new TSMUI.Picker(); try { PickedPoints = myPicker.PickPoints(Tekla.Structures.Model.UI.Picker.PickPointEnum.PICK_POLYGON); } catch { PickedPoints = null; } if (PickedPoints != null) { ContourPlate myPlate = new ContourPlate(); myPlate.AssemblyNumber.Prefix = "P"; myPlate.AssemblyNumber.StartNumber = 1; myPlate.PartNumber.Prefix = "p"; myPlate.PartNumber.StartNumber = 1; myPlate.Name = "Plate"; myPlate.Profile.ProfileString = "PL25.4"; myPlate.Material.MaterialString = "A36"; myPlate.Finish = "GP"; myPlate.Class = "9"; myPlate.Position.Depth = Position.DepthEnum.FRONT; foreach (T3D.Point ThisPoint in PickedPoints) { myPlate.AddContourPoint(new ContourPoint(ThisPoint, new Chamfer(12.7, 12.7, Chamfer.ChamferTypeEnum.CHAMFER_LINE))); } if (!myPlate.Insert()) { Tekla.Structures.Model.Operations.Operation.DisplayPrompt("No plate was created."); } else { // Change the workplane to match coordinate system of plate currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(myPlate.GetCoordinateSystem())); // Show the plate in the model and show the workplane change currentModel.CommitChanges(); // This gets the plates coordinates and information in the current workplane. myPlate.Select(); // Draw the coordinate of the plate in the model in hte local coordinate system. TSMUI.GraphicsDrawer myDrawer = new TSMUI.GraphicsDrawer(); foreach (ContourPoint ContourPoint in myPlate.Contour.ContourPoints) { T3D.Point CornerPoint = new T3D.Point(ContourPoint.X, ContourPoint.Y, ContourPoint.Z); const double IMPERIALUNIT = 25.4; double XValue = Math.Round(CornerPoint.X / IMPERIALUNIT, 4); double YValue = Math.Round(CornerPoint.Y / IMPERIALUNIT, 4); double ZValue = Math.Round(CornerPoint.Z / IMPERIALUNIT, 4); myDrawer.DrawText(CornerPoint, "(" + XValue + "," + YValue + "," + ZValue + ")", new TSMUI.Color(1, 0, 0)); myDrawer.DrawLineSegment(new T3D.LineSegment(new T3D.Point(0, 0, 0), new T3D.Point(0, 0, 500)), new TSMUI.Color(1, 0, 0)); } } } }
public override bool Run(List <InputDefinition> Input) { try { GetValuesFromDialog(); WorkPlaneHandler wph = Model.GetWorkPlaneHandler(); TransformationPlane tp = wph.GetCurrentTransformationPlane(); TransformationPlane tppart = null; BoltGroup bg = Model.SelectModelObject((Identifier)Input[0].GetInput()) as BoltGroup; bg.Select(); List <Part> parts = new List <Part>(); parts.Add(bg.PartToBeBolted); parts.Add(bg.PartToBoltTo); foreach (Part p in bg.OtherPartsToBolt) { parts.Add(p); } #region Clear List <Part> _part = new List <Part>(); foreach (Part p in parts) { bool flag = false; foreach (Part pp in _part) { if (pp.Identifier.ID == p.Identifier.ID) { flag = true; } } if (!flag) { _part.Add(p); } } parts.Clear(); parts = _part; #endregion foreach (Part p in parts) { if (p is Beam) { Beam b = p as Beam; b.Select(); double k = 0.0; b.GetReportProperty("PROFILE.FLANGE_SLOPE_RATIO", ref k); if (k == 0) { continue; } tppart = new TransformationPlane(p.GetCoordinateSystem()); wph.SetCurrentTransformationPlane(tppart); bg.Select(); foreach (Point pb in bg.BoltPositions) { Point _pb = new Point(pb); #region Уклон полок - точки через солид GeometricPlane gp = new GeometricPlane( _pb, new Vector(0, 1, 0), new Vector(0, 0, 1)); List <List <Point> > lp = IntersectSolid(p.GetSolid(), gp); List <LineSegment> ls = new List <LineSegment>(); for (int i = 0; i < lp[0].Count - 1; i++) { Point p1 = lp[0][i]; Point p2 = lp[0][i + 1]; Vector v = new Vector(p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z); v.Normalize(1.0); if (v.Y != 0 && v.Z != 0) { ControlLine cl = new ControlLine(); cl.Line.Point1 = p1; cl.Line.Point2 = p2; // cl.Insert(); ls.Add(new LineSegment(p1, p2)); } } Point _p1 = lp[0][0]; Point _p2 = lp[0][lp[0].Count - 1]; Vector _v = new Vector(_p2.X - _p1.X, _p2.Y - _p1.Y, _p2.Z - _p1.Z); if (_v.Y != 0 && _v.Z != 0) { ls.Add(new LineSegment(_p1, _p2)); ControlLine cl = new ControlLine(); cl.Line.Point1 = _p1; cl.Line.Point2 = _p2; // cl.Insert(); } #endregion #region Точки для построения пластины double diam = bg.BoltSize; double tol = GOST_10906_78[diam][0]; double _b = GOST_10906_78[diam][1]; double t1 = GOST_10906_78[diam][2]; double t2 = GOST_10906_78[diam][3]; int kf = (_pb.Z <= ((Point)b.GetReferenceLine(false)[0]).Z ? -1 : 1); _pb.Z += kf * _b * 0.5; double h = double.MaxValue; LineSegment lsb = ls[0]; foreach (LineSegment lsi in ls) { double t = Distance.PointToLineSegment(_pb, lsi); if (h >= t) { h = t; lsb = lsi; } } //ControlLine cli = new ControlLine(); //cli.Line.Point1 = lsb.Point1; //cli.Line.Point2 = lsb.Point2; //cli.Insert(); Point pb1 = new Point(_pb.X, _pb.Y + 1000, _pb.Z); Point pbi = Intersection.LineToLine( new Line(lsb), new Line(_pb, pb1)).Point1; //cli.Line.Point1 = _pb; //cli.Line.Point2 = pbi; //cli.Insert(); #endregion ContourPlate cp = new ContourPlate(); Contour cr = new Contour(); cr.AddContourPoint(new ContourPoint(new Point(pbi.X - _b * 0.5, pbi.Y, pbi.Z), null)); cr.AddContourPoint(new ContourPoint(new Point(pbi.X + _b * 0.5, pbi.Y, pbi.Z), null)); cr.AddContourPoint(new ContourPoint(new Point(pbi.X + _b * 0.5, pbi.Y, pbi.Z - kf * _b), null)); cr.AddContourPoint(new ContourPoint(new Point(pbi.X - _b * 0.5, pbi.Y, pbi.Z - kf * _b), null)); cp.Contour = cr; cp.Profile.ProfileString = "PL" + t1.ToString(); cp.AssemblyNumber.Prefix = prefix_asm; cp.AssemblyNumber.StartNumber = start_part; cp.PartNumber.Prefix = prefix_part; cp.PartNumber.StartNumber = start_part; cp.Name = name; cp.Material.MaterialString = material; cp.Finish = finish; if (kf == -1 && pbi.Y > 0) { cp.Position.Depth = Position.DepthEnum.FRONT; } else if (kf == -1 && pbi.Y < 0) { cp.Position.Depth = Position.DepthEnum.BEHIND; } else if (kf == 1 && pbi.Y > 0) { cp.Position.Depth = Position.DepthEnum.BEHIND; } else if (kf == 1 && pbi.Y < 0) { cp.Position.Depth = Position.DepthEnum.FRONT; } cp.Insert(); if (weight != 0.0 && us_prop_weight != "") { cp.SetUserProperty(us_prop_weight, weight); cp.Modify(); } BooleanPart bp = new BooleanPart(); ContourPlate cp2 = new ContourPlate(); Contour cr2 = new Contour(); cr2.AddContourPoint(new ContourPoint(new Point(pbi.X, pbi.Y, pbi.Z), null)); cr2.AddContourPoint(new ContourPoint(new Point(pbi.X, pbi.Y, pbi.Z - kf * _b), null)); cr2.AddContourPoint(new ContourPoint(new Point(pbi.X, pbi.Y + (pbi.Y > 0 ? -1 * (t1 - t2) : (t1 - t2)), pbi.Z - kf * _b), null)); cp2.Contour = cr2; cp2.Profile.ProfileString = "PL" + (_b + 10).ToString(); cp2.Class = BooleanPart.BooleanOperativeClassName; cp2.Insert(); bp.Father = cp; bp.OperativePart = cp2; bp.Insert(); cp2.Delete(); BoltArray ba = new BoltArray(); ba.FirstPosition = pb; ba.SecondPosition = new Point(pb.X + 100, pb.Y, pb.Z); ba.BoltStandard = bg.BoltStandard; ba.Position.Rotation = Position.RotationEnum.TOP; ba.BoltType = bg.BoltType; ba.BoltSize = bg.BoltSize; ba.Tolerance = tol; ba.Bolt = false; ba.AddBoltDistX(0); ba.AddBoltDistY(0); ba.PartToBeBolted = cp; ba.PartToBoltTo = cp; ba.Insert(); } } } wph.SetCurrentTransformationPlane(tp); } catch (Exception Exc) { MessageBox.Show(Exc.ToString()); } return(true); }
public override bool Run(List <InputDefinition> Input) { try { // 오버라이드 된 DefineInput에서 List를 가져옴 // purlin = 중도리 지붕을 지탱하는 골조 // flange = 플랜지 파이프를 연결하기 위한 배관? Beam Purlin1 = (Beam)_model.SelectModelObject((Identifier)Input[0].GetInput()); Beam Purlin2 = (Beam)_model.SelectModelObject((Identifier)Input[1].GetInput()); Beam OFlange = (Beam)_model.SelectModelObject((Identifier)Input[2].GetInput()); Beam Web = (Beam)_model.SelectModelObject((Identifier)Input[3].GetInput()); Beam IFlange = (Beam)_model.SelectModelObject((Identifier)Input[4].GetInput()); // 초기값 체크 GetValuesFromDialog(); double WebThick = 0.0; double IFlangeWidth = 0.0; double IFlangeThick = 0.0; double OFlangeThick = 0.0; Web.GetReportProperty("WIDTH", ref WebThick); OFlange.GetReportProperty("WIDTH", ref OFlangeThick); IFlange.GetReportProperty("WIDTH", ref IFlangeThick); IFlange.GetReportProperty("HEIGHT", ref IFlangeWidth); if (IsDefaultValue(_PlateWidth) || _PlateWidth == 0) { _PlateWidth = (IFlangeWidth - WebThick) * 0.5; } if (IsDefaultValue(_PlateLength) || _PlateLength == 0) { _PlateLength = (IFlangeWidth - WebThick) * 0.5; } CoordinateSystem WebSys = Web.GetCoordinateSystem(); // 평면(Web)과 선(purlin1의 시작과 끝점)이 만나는 교차점 T3D.Point TopCenter = T3D.Intersection.LineToPlane(new Line(Purlin1.StartPoint, Purlin1.EndPoint), new GeometricPlane(WebSys.Origin, WebSys.AxisX, WebSys.AxisY)); // 실제 좌표점(x,y,z) CoordinateSystem WorkSystem = new CoordinateSystem(TopCenter, WebSys.AxisX.Cross(WebSys.AxisY), WebSys.AxisY); // CoordinateSystem의 실좌표를 Plane 변경 _model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(WorkSystem)); Purlin1.Select(); Purlin2.Select(); Web.Select(); OFlange.Select(); IFlange.Select(); CoordinateSystem PurSys = Purlin1.GetCoordinateSystem(); T3D.Point TopClipCenter = T3D.Intersection.LineToPlane(new Line(OFlange.StartPoint, OFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY)); T3D.Point BottCenter = T3D.Intersection.LineToPlane(new Line(IFlange.StartPoint, IFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY)); T3D.Point LeftAngleFirstPoint = new T3D.Point(-_UpperHorizontalDistance, _UpperVerticalDistance, 0); T3D.Point LeftAngleSecondPoint = new T3D.Point(-_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0); T3D.Point RightAngleFirstPoint = new T3D.Point(_UpperHorizontalDistance, _UpperVerticalDistance, 0); T3D.Point RightAngleSecondPoint = new T3D.Point(_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0); Beam LeftAngle = new Beam(); Beam RightAngle = new Beam(); Beam TopClip = new Beam(); ContourPlate LeftPlate = new ContourPlate(); ContourPlate RightPlate = new ContourPlate(); TopClip.StartPoint = new T3D.Point(-_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0); TopClip.EndPoint = new T3D.Point(_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0); if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisY.GetNormal() == new Vector(0, 1, 0)) { LeftAngle.StartPoint = LeftAngleSecondPoint; LeftAngle.EndPoint = LeftAngleFirstPoint; RightAngle.StartPoint = RightAngleFirstPoint; RightAngle.EndPoint = RightAngleSecondPoint; LeftAngle.Position.Plane = Position.PlaneEnum.LEFT; LeftAngle.Position.Rotation = Position.RotationEnum.BELOW; LeftAngle.Position.Depth = Position.DepthEnum.BEHIND; RightAngle.Position.Plane = Position.PlaneEnum.LEFT; RightAngle.Position.Rotation = Position.RotationEnum.BELOW; RightAngle.Position.Depth = Position.DepthEnum.BEHIND; TopClip.Position.Plane = Position.PlaneEnum.LEFT; TopClip.Position.Rotation = Position.RotationEnum.FRONT; TopClip.Position.Depth = Position.DepthEnum.BEHIND; LeftPlate.Position.Depth = Position.DepthEnum.FRONT; RightPlate.Position.Depth = Position.DepthEnum.FRONT; } else { LeftAngle.StartPoint = LeftAngleFirstPoint; LeftAngle.EndPoint = LeftAngleSecondPoint; RightAngle.StartPoint = RightAngleFirstPoint; RightAngle.EndPoint = RightAngleSecondPoint; LeftAngle.Position.Plane = Position.PlaneEnum.RIGHT; LeftAngle.Position.Rotation = Position.RotationEnum.TOP; LeftAngle.Position.Depth = Position.DepthEnum.FRONT; RightAngle.Position.Plane = Position.PlaneEnum.RIGHT; RightAngle.Position.Rotation = Position.RotationEnum.FRONT; RightAngle.Position.Depth = Position.DepthEnum.FRONT; TopClip.Position.Plane = Position.PlaneEnum.LEFT; TopClip.Position.Rotation = Position.RotationEnum.FRONT; TopClip.Position.Depth = Position.DepthEnum.FRONT; LeftPlate.Position.Depth = Position.DepthEnum.BEHIND; RightPlate.Position.Depth = Position.DepthEnum.BEHIND; } LeftAngle.Profile.ProfileString = _FlangeProfile; LeftAngle.Material.MaterialString = _FlangeMaterial; LeftAngle.Class = _FlangeClass; LeftAngle.Name = _FlangeName; LeftAngle.Insert(); RightAngle.Profile.ProfileString = _FlangeProfile; RightAngle.Material.MaterialString = _FlangeMaterial; RightAngle.Class = _FlangeClass; RightAngle.Name = _FlangeName; RightAngle.Insert(); double BraceWidth = 0.0; double BraceThickness = 0.0; RightAngle.GetReportProperty("WIDTH", ref BraceWidth); RightAngle.GetReportProperty("PROFILE.FLANGE_THICKNESS_1", ref BraceThickness); double BoltGauge = (BraceWidth + BraceThickness) * 0.5; LeftAngle.Position.PlaneOffset = -BoltGauge; LeftAngle.StartPointOffset.Dx = _UpperBoltHorizontalDistance; LeftAngle.EndPointOffset.Dx = _LowerBoltHorizontalDistance; LeftAngle.Modify(); RightAngle.Position.PlaneOffset = -BoltGauge; RightAngle.StartPointOffset.Dx = -_LowerBoltHorizontalDistance; RightAngle.EndPointOffset.Dx = _UpperBoltHorizontalDistance; RightAngle.Modify(); TopClip.Profile.ProfileString = "PL" + _TopClipThickness + "*" + _TopClipWidth; TopClip.Material.MaterialString = _TopClipMaterial; TopClip.Name = _TopClipName; TopClip.Insert(); Point LeftPlatePoint1 = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y, 0); Point LeftPlatePoint2 = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y + _PlateLength, 0); Point LeftPlatePoint3 = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y + _PlateLength, 0); Point LeftPlatePoint4 = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y, 0); ContourPoint LeftPlateContourPoint1 = new ContourPoint(LeftPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE)); ContourPoint LeftPlateContourPoint2 = new ContourPoint(LeftPlatePoint2, new Chamfer()); ContourPoint LeftPlateContourPoint3 = new ContourPoint(LeftPlatePoint3, new Chamfer()); ContourPoint LeftPlateContourPoint4 = new ContourPoint(LeftPlatePoint4, new Chamfer()); LeftPlate.AddContourPoint(LeftPlateContourPoint1); LeftPlate.AddContourPoint(LeftPlateContourPoint2); LeftPlate.AddContourPoint(LeftPlateContourPoint3); LeftPlate.AddContourPoint(LeftPlateContourPoint4); LeftPlate.Material.MaterialString = _PlateMaterial; LeftPlate.Profile.ProfileString = "PL" + _PlateThickness.ToString(); LeftPlate.Name = _PlateName; LeftPlate.Insert(); Point RightPlatePoint1 = new Point(BottCenter.X + WebThick * 0.5, BottCenter.Y, 0); Point RightPlatePoint2 = new Point(RightPlatePoint1.X + _PlateWidth, RightPlatePoint1.Y, 0); Point RightPlatePoint3 = new Point(RightPlatePoint2.X, RightPlatePoint2.Y + _PlateLength, 0); Point RightPlatePoint4 = new Point(RightPlatePoint3.X - _PlateWidth, RightPlatePoint3.Y, 0); ContourPoint RightPlateContourPoint1 = new ContourPoint(RightPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE)); ContourPoint RightPlateContourPoint2 = new ContourPoint(RightPlatePoint2, new Chamfer()); ContourPoint RightPlateContourPoint3 = new ContourPoint(RightPlatePoint3, new Chamfer()); ContourPoint RightPlateContourPoint4 = new ContourPoint(RightPlatePoint4, new Chamfer()); RightPlate.AddContourPoint(RightPlateContourPoint1); RightPlate.AddContourPoint(RightPlateContourPoint2); RightPlate.AddContourPoint(RightPlateContourPoint3); RightPlate.AddContourPoint(RightPlateContourPoint4); RightPlate.Material.MaterialString = _PlateMaterial; RightPlate.Profile.ProfileString = "PL" + _PlateThickness.ToString(); RightPlate.Name = _PlateName; RightPlate.Insert(); Beam LeftPurlin = Purlin1; Beam RightPurlin = Purlin2; if ((Purlin1.StartPoint.X - Purlin2.StartPoint.X) > 1 || (Purlin1.StartPoint.Y - Purlin2.StartPoint.Y) > 1) { RightPurlin = Purlin1; LeftPurlin = Purlin2; } Weld LeftPlateToIFlange = new Weld(); LeftPlateToIFlange.MainObject = IFlange; LeftPlateToIFlange.SecondaryObject = LeftPlate; LeftPlateToIFlange.ShopWeld = true; LeftPlateToIFlange.Insert(); Weld LeftPlateToWeb = new Weld(); LeftPlateToWeb.MainObject = Web; LeftPlateToWeb.SecondaryObject = LeftPlate; LeftPlateToWeb.ShopWeld = true; LeftPlateToWeb.Insert(); Weld RightPlateToIFlange = new Weld(); RightPlateToIFlange.MainObject = IFlange; RightPlateToIFlange.SecondaryObject = RightPlate; RightPlateToIFlange.ShopWeld = true; RightPlateToIFlange.Insert(); Weld RightPlateToWeb = new Weld(); RightPlateToWeb.MainObject = Web; RightPlateToWeb.SecondaryObject = RightPlate; RightPlateToWeb.ShopWeld = true; RightPlateToWeb.Insert(); PolygonWeld ClipToFlange = new PolygonWeld(); ClipToFlange.TypeAbove = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET; ClipToFlange.TypeBelow = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET; ClipToFlange.SizeAbove = _ClipWeldSize; ClipToFlange.SizeBelow = _ClipWeldSize; ClipToFlange.MainObject = OFlange; ClipToFlange.SecondaryObject = TopClip; ClipToFlange.ShopWeld = true; ClipToFlange.Polygon.Points.Add(TopClip.StartPoint); ClipToFlange.Polygon.Points.Add(TopClip.EndPoint); ClipToFlange.Insert(); // Bolting Brace with Plate or Purlin BoltArray UpperLeftBolt = new BoltArray(); UpperLeftBolt.PartToBoltTo = LeftPurlin; UpperLeftBolt.PartToBeBolted = LeftAngle; UpperLeftBolt.FirstPosition = LeftAngle.StartPoint; UpperLeftBolt.SecondPosition = LeftAngle.EndPoint; UpperLeftBolt.AddBoltDistX(0.0); UpperLeftBolt.AddBoltDistY(0.0); UpperLeftBolt.BoltSize = _BraceBoltSize; UpperLeftBolt.Tolerance = 0.0625 * 25.4; UpperLeftBolt.BoltStandard = _BraceBoltStandard; UpperLeftBolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; UpperLeftBolt.CutLength = 76.2; UpperLeftBolt.Bolt = true; UpperLeftBolt.Position.Rotation = Position.RotationEnum.FRONT; BoltArray LowerLeftBolt = new BoltArray(); LowerLeftBolt.PartToBoltTo = LeftPlate; LowerLeftBolt.PartToBeBolted = LeftAngle; LowerLeftBolt.FirstPosition = LeftAngle.EndPoint; LowerLeftBolt.SecondPosition = LeftAngle.StartPoint; LowerLeftBolt.AddBoltDistX(0.0); LowerLeftBolt.AddBoltDistY(0.0); LowerLeftBolt.BoltSize = _BraceBoltSize; LowerLeftBolt.BoltStandard = _BraceBoltStandard; LowerLeftBolt.Tolerance = 0.0625 * 25.4; LowerLeftBolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; LowerLeftBolt.CutLength = 76.2; LowerLeftBolt.Bolt = true; LowerLeftBolt.Position.Rotation = Position.RotationEnum.FRONT; BoltArray UpperRightBolt = new BoltArray(); UpperRightBolt.PartToBoltTo = RightPurlin; UpperRightBolt.PartToBeBolted = RightAngle; UpperRightBolt.FirstPosition = RightAngle.EndPoint; UpperRightBolt.SecondPosition = RightAngle.StartPoint; UpperRightBolt.AddBoltDistX(0.0); UpperRightBolt.AddBoltDistY(0.0); UpperRightBolt.BoltSize = _BraceBoltSize; UpperRightBolt.Tolerance = 0.0625 * 25.4; UpperRightBolt.BoltStandard = _BraceBoltStandard; UpperRightBolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; UpperRightBolt.CutLength = 76.2; UpperRightBolt.Bolt = true; UpperRightBolt.Position.Rotation = Position.RotationEnum.FRONT; BoltArray LowerRightBolt = new BoltArray(); LowerRightBolt.PartToBoltTo = RightPlate; LowerRightBolt.PartToBeBolted = RightAngle; LowerRightBolt.FirstPosition = RightAngle.StartPoint; LowerRightBolt.SecondPosition = RightAngle.EndPoint; LowerRightBolt.AddBoltDistX(0.0); LowerRightBolt.AddBoltDistY(0.0); LowerRightBolt.BoltSize = _BraceBoltSize; LowerRightBolt.Tolerance = 0.0625 * 25.4; LowerRightBolt.BoltStandard = _BraceBoltStandard; LowerRightBolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; LowerRightBolt.CutLength = 76.2; LowerRightBolt.Bolt = true; LowerRightBolt.Position.Rotation = Position.RotationEnum.FRONT; // Bolting ClipPlate with purlin BoltArray ClipBolts1 = new BoltArray(); ClipBolts1.PartToBoltTo = LeftPurlin; ClipBolts1.PartToBeBolted = TopClip; ClipBolts1.FirstPosition = TopClip.StartPoint; ClipBolts1.SecondPosition = TopClip.EndPoint; ClipBolts1.StartPointOffset.Dx = 31.75; ClipBolts1.AddBoltDistX(0); ClipBolts1.AddBoltDistY(76.2); ClipBolts1.StartPointOffset.Dy = 76.2; ClipBolts1.EndPointOffset.Dy = 76.2; ClipBolts1.BoltSize = _ClipBoltSize; ClipBolts1.Tolerance = 0.0625 * 25.4; ClipBolts1.BoltStandard = _CliptBoltStandard; ClipBolts1.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; ClipBolts1.CutLength = 76.2; ClipBolts1.Bolt = true; ClipBolts1.Position.Rotation = Position.RotationEnum.FRONT; BoltArray ClipBolts2 = new BoltArray(); ClipBolts2.PartToBoltTo = RightPurlin; ClipBolts2.PartToBeBolted = TopClip; ClipBolts2.FirstPosition = TopClip.StartPoint; ClipBolts2.SecondPosition = TopClip.EndPoint; ClipBolts2.StartPointOffset.Dx = _TopClipLength - 31.75; ClipBolts2.AddBoltDistX(0); ClipBolts2.AddBoltDistY(76.2); ClipBolts2.StartPointOffset.Dy = 76.2; ClipBolts2.EndPointOffset.Dy = 76.2; ClipBolts2.BoltSize = _ClipBoltSize; ClipBolts2.Tolerance = 0.0625 * 25.4; ClipBolts2.BoltStandard = _CliptBoltStandard; ClipBolts2.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE; ClipBolts2.CutLength = 76.2; ClipBolts2.Bolt = true; ClipBolts2.Position.Rotation = Position.RotationEnum.FRONT; if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisX.GetNormal() == new Vector(0, 1, 0)) { UpperLeftBolt.FirstPosition = LeftAngle.EndPoint; UpperLeftBolt.SecondPosition = LeftAngle.StartPoint; UpperLeftBolt.Position.Rotation = Position.RotationEnum.BACK; LowerLeftBolt.FirstPosition = LeftAngle.StartPoint; LowerLeftBolt.SecondPosition = LeftAngle.EndPoint; LowerLeftBolt.Position.Rotation = Position.RotationEnum.BACK; UpperRightBolt.FirstPosition = RightAngle.StartPoint; UpperRightBolt.SecondPosition = RightAngle.EndPoint; UpperRightBolt.Position.Rotation = Position.RotationEnum.BACK; LowerRightBolt.FirstPosition = RightAngle.StartPoint; LowerRightBolt.SecondPosition = RightAngle.EndPoint; LowerRightBolt.Position.Rotation = Position.RotationEnum.BACK; ClipBolts1.Position.Rotation = Position.RotationEnum.BACK; ClipBolts2.Position.Rotation = Position.RotationEnum.BACK; } UpperLeftBolt.Insert(); LowerLeftBolt.Insert(); UpperRightBolt.Insert(); LowerRightBolt.Insert(); ClipBolts1.Insert(); ClipBolts2.Insert(); } catch (Exception e) { MessageBox.Show(e.ToString()); } return(true); }
private void btnPolygonCut_Click(object sender, EventArgs e) { // Current Workplane. Remember how the user had model before you made changes TransformationPlane currentPlane = currentModel.GetWorkPlaneHandler().GetCurrentTransformationPlane(); TSMUI.Picker myPicker = new TSMUI.Picker(); Part pickedPart = null; try { pickedPart = myPicker.PickObject(Tekla.Structures.Model.UI.Picker.PickObjectEnum.PICK_ONE_PART) as Part; } catch { pickedPart = null; } if (pickedPart != null) { // Change the workplane to the coordinate system of the part currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(pickedPart.GetCoordinateSystem())); // Apply polygon cut ContourPlate contourPlateObject = new ContourPlate(); contourPlateObject.AssemblyNumber.Prefix = "XX"; contourPlateObject.AssemblyNumber.StartNumber = 1; contourPlateObject.PartNumber.Prefix = "xx"; contourPlateObject.PartNumber.StartNumber = 1; contourPlateObject.Name = "CUT"; contourPlateObject.Profile.ProfileString = "200"; contourPlateObject.Material.MaterialString = "ANTIMATERIAL"; contourPlateObject.Finish = ""; // THIS IS THE IMPORTANT PART!!! contourPlateObject.Class = BooleanPart.BooleanOperativeClassName; contourPlateObject.Position.Depth = Position.DepthEnum.MIDDLE; // When doing a polygon cut make sure you don't do it right along edge // or sometimes you might et a solid error and your part will disappear. contourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(-10, -10, 0), null)); contourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(100, -10, 0), null)); contourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(100, 100, 0), null)); contourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(-10, 100, 0), null)); if (!contourPlateObject.Insert()) { Tekla.Structures.Model.Operations.Operation.DisplayPrompt("Plate was ot created"); // Set workplane to what user had before currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane); } else { // We don't need the physical part in the model anymore. contourPlateObject.Delete(); // Set workplane to what user had before currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane); // Show the fitting in the model, the user will never see the workplane change. currentModel.CommitChanges(); } } }
private void InsertComponents(ModelObject mObj, List <TSM.Component> components) { TransformationPlane originalTransformationplane = null; try { lock (wHandler) { originalTransformationplane = wHandler.GetCurrentTransformationPlane(); } ComponentInput compInput = new ComponentInput(); Part fatherpart = mObj as Part; Assembly assembly = fatherpart.GetAssembly(); // Get the transformationplane from objects coordinate systems vectors and because objects coordinate system is not the same XY plane as of models, // so cross product needs to be made for the Y-axis TransformationPlane fatherpartsTransformationPlane = new TransformationPlane(fatherpart.GetCoordinateSystem().Origin, fatherpart.GetCoordinateSystem().AxisX, Vector.Cross(fatherpart.GetCoordinateSystem().AxisY, fatherpart.GetCoordinateSystem().AxisX)); lock (wHandler) { wHandler.SetCurrentTransformationPlane(fatherpartsTransformationPlane); } double minX = fatherpart.GetSolid().MinimumPoint.X; double minY = fatherpart.GetSolid().MinimumPoint.Y; double minZ = fatherpart.GetSolid().MinimumPoint.Z; double maxX = fatherpart.GetSolid().MaximumPoint.X; double maxY = fatherpart.GetSolid().MaximumPoint.Y; double maxZ = fatherpart.GetSolid().MaximumPoint.Z; Solid s = fatherpart.GetSolid(); FaceEnumerator fEnum = s.GetFaceEnumerator(); StringBuilder sb = new StringBuilder(); while (fEnum.MoveNext()) { sb.AppendLine(fEnum.Current.Normal.ToString()); } Point p1 = null; Point p2 = null; List <Point> cutPartPoints = new List <Point>() { new Point(), new Point(), new Point(), new Point() }; ContourPlate cutpart = null; for (int i = 0; i < components.Count; i++) { cutpart = new ContourPlate(); cutpart.Name = "Leikkaus"; cutpart.Position.Depth = Position.DepthEnum.MIDDLE; cutpart.Position.Plane = Position.PlaneEnum.MIDDLE; cutpart.Class = BooleanPart.BooleanOperativeClassName; cutpart.Material.MaterialString = "Reikä"; cutpart.Profile.ProfileString = "PL135"; BooleanPart bPart = new BooleanPart(); compInput = new ComponentInput(); switch (i) { case 0: p1 = new Point(minX + 300, 0, minZ); p2 = new Point(minX + 300, maxY, minZ); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - 52, p1.Z + 40), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - 52, p1.Z + 161.68), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + 161.68 + (Math.Tan(9.88 * Math.PI / 180) * ((maxY - minY) / 2 + 52))), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + 40), null)); cutpart.Insert(); bPart.Father = fatherpart; bPart.SetOperativePart(cutpart); if (!bPart.Insert()) { SetInfoText("Leikkauksen (1) tekeminen epäonnistui!"); } cutpart.Delete(); break; case 1: p1 = new Point(maxX - 300, 0, minZ); p2 = new Point(maxX - 300, maxY, minZ); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - 52, p1.Z + 40), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - 52, p1.Z + 161.68), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + 161.68 + (Math.Tan(9.88 * Math.PI / 180) * ((maxY - minY) / 2 + 52))), null)); cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + 40), null)); cutpart.Insert(); bPart.Father = fatherpart; bPart.SetOperativePart(cutpart); if (!bPart.Insert()) { SetInfoText("Leikkauksen (2) tekeminen epäonnistui!"); } cutpart.Delete(); break; case 2: p1 = new Point(minX + 300, 0, maxZ + 135); p2 = new Point(minX + 300, maxY, maxZ + 135); break; case 3: p1 = new Point(maxX - 300, 0, maxZ + 135); p2 = new Point(maxX - 300, maxY, maxZ + 135); break; } compInput.AddOneInputPosition(p1); compInput.AddOneInputPosition(p2); components[i].SetComponentInput(compInput); if (!components[i].Insert()) { SetInfoText("Komponentin laittaminen epäonnistui!"); } } foreach (TSM.Component c in components) { assembly.Add(c); assembly.Modify(); } } catch (Exception ex) { ExceptionOccured(ex.Message, ex.StackTrace); SetInfoText("Komponentin asettamisessa tapahtui virhe!"); } finally { lock (wHandler) { wHandler.SetCurrentTransformationPlane(originalTransformationplane); } } }
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); } }
public void CK09_PolygonCut() { // Current Workplane. Reminder how the user had the model before you did stuff. TransformationPlane CurrentPlane = Model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); Picker Picker = new Picker(); Beam PickedPart = null; try { PickedPart = (Beam)Picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART); } catch { PickedPart = null; } if (PickedPart != null) { // Change the workplane to the coordinate system of the Beam var psk = new TransformationPlane(PickedPart.GetCoordinateSystem()); Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(psk); ContourPlate ContourPlateObject = new ContourPlate(); ContourPlateObject.AssemblyNumber.Prefix = "XX"; ContourPlateObject.AssemblyNumber.StartNumber = 1; ContourPlateObject.Name = "CUT"; ContourPlateObject.PartNumber.Prefix = "xx"; ContourPlateObject.Profile.ProfileString = "200"; ContourPlateObject.Material.MaterialString = "ANTIMATERIAL"; ContourPlateObject.Finish = ""; // This is the Important Part! ContourPlateObject.Class = BooleanPart.BooleanOperativeClassName; ContourPlateObject.Position.Depth = Position.DepthEnum.MIDDLE; // when doing a polygon cut make sure you don't do roght alone edge //..or sometimes you maight get a solid error and your part will disappeared ContourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(-10, -10, 0), null)); ContourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(100, -10, 0), null)); ContourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(100, 100, 0), null)); ContourPlateObject.AddContourPoint(new ContourPoint(new T3D.Point(-10, 100, 0), null)); if (!ContourPlateObject.Insert()) { Tekla.Structures.Model.Operations.Operation.DisplayPrompt("Plate wasn't created."); // SetWorkPlane back to what user had before Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(CurrentPlane); } else { BooleanPart PolygonCut = new BooleanPart(); PolygonCut.Father = PickedPart; PolygonCut.OperativePart = ContourPlateObject; PolygonCut.Type = BooleanPart.BooleanTypeEnum.BOOLEAN_CUT; if (!PolygonCut.Insert()) { // SetWorkPlane back to what user had before Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(CurrentPlane); } else { // We don't need the phisical part in the model anymore. ContourPlateObject.Delete(); // SetWorkPlane back to what user had before Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(CurrentPlane); // Show the fitting in the model but the user //..will never see the workplane change Model.CommitChanges(); } } } }
private void CreatePlatesForBox() { 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)); bottomPlate = new ContourPlate { Name = "Plate", Material = { MaterialString = "S2345JR" }, Profile = { ProfileString = "PL100" }, Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 }, Contour = bottomContour }; 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)); sidePlate1 = new ContourPlate { Name = "Plate", Material = { MaterialString = "S235JR" }, Profile = { ProfileString = "PL100" }, Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 }, Contour = contour1 }; 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)); this.sidePlate2 = new ContourPlate { Name = "Plate", Material = { MaterialString = "S235JR" }, Profile = { ProfileString = "PL100" }, Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 }, Contour = contour2 }; 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)); sidePlate3 = new ContourPlate { Name = "Plate", Material = { MaterialString = "S235JR" }, Profile = { ProfileString = "PL100" }, Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 }, Contour = contour3 }; 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)); sidePlate4 = new ContourPlate { Name = "Plate", Material = { MaterialString = "S235JR" }, Profile = { ProfileString = "PL100" }, Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 }, Contour = contour4 }; bottomPlate.Insert(); sidePlate1.Insert(); sidePlate2.Insert(); sidePlate3.Insert(); sidePlate4.Insert(); model.CommitChanges(); }
public void CK08_CreatePlate() { ArrayList PickedPoints = null; Picker Picker = new Picker(); try { PickedPoints = Picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON); } catch { PickedPoints = null; } if (PickedPoints != null) { ContourPlate Plate = new ContourPlate(); Plate.AssemblyNumber.Prefix = "P"; Plate.AssemblyNumber.StartNumber = 1; Plate.PartNumber.Prefix = "p"; Plate.PartNumber.StartNumber = 1; Plate.Name = "PLATE"; Plate.Profile.ProfileString = "PL25"; Plate.Material.MaterialString = "C245"; Plate.Finish = ""; Plate.Class = "1"; Plate.Position.Depth = Position.DepthEnum.FRONT; foreach (T3D.Point ThisPoint in PickedPoints) { var chamfer = new Chamfer(12.7, 12.7, Chamfer.ChamferTypeEnum.CHAMFER_LINE); var conturPoint = new ContourPoint(ThisPoint, chamfer); Plate.AddContourPoint(conturPoint); } if (!Plate.Insert()) { Tekla.Structures.Model.Operations.Operation.DisplayPrompt("Plate wasn't created."); } else { // Change the workplane to the coordinate system of the plate. var transformationPlane = new TransformationPlane(Plate.GetCoordinateSystem()); Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformationPlane); // Show the plate in the model and the workplane change. Model.CommitChanges(); // This gets the plate's coordinates and information in the current workplane. Plate.Select(); ReperShow(Plate.GetCoordinateSystem()); // Draw the coordinate of the plate in the model in the local coordinate system. GraphicsDrawer Drawer = new GraphicsDrawer(); foreach (ContourPoint ContourPoint in Plate.Contour.ContourPoints) { double x = ContourPoint.X, y = ContourPoint.Y, z = ContourPoint.Z; T3D.Point CornerPoint = new T3D.Point(x, y, z); PointXYZ(ContourPoint); //double ImperialValue = 25.4; //double XValue = Math.Round(CornerPoint.X / ImperialValue, 4); //double YValue = Math.Round(CornerPoint.Y / ImperialValue, 4); //double ZValue = Math.Round(CornerPoint.Z / ImperialValue, 4); //Drawer.DrawText(CornerPoint, "(" + XValue + "," + YValue + "," + ZValue + ")", new Color(1,0,0)); Drawer.DrawLineSegment(new LineSegment(new T3D.Point(0, 0, 0), new T3D.Point(0, 0, 500)), new Color(1, 0, 0)); } mw.Msg("На экране Tekla построена пластина по заданным точкам" + " и показаны координаты этих точек и репер ПСК. [OK]"); MessageBox.Show("Построена пластина."); mw.Msg(); } } }
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); }