/// <summary> /// Add members and connection points to the IDEA open model /// </summary> /// <param name="model">Open model</param> private static void CreateFrameGeometry(OpenModel model) { // find appropriate cross sections var css_he_240b = model.CrossSection.FirstOrDefault(item => item.Name == "HE240B"); var css_he_200b = model.CrossSection.FirstOrDefault(item => item.Name == "HE200B"); // member for left floor beam ConnectedMember M1 = Helpers.CreateMember(model, 1, Member1DType.Beam, css_he_200b, "N2", "N4"); // member for right floor beam ConnectedMember M2 = Helpers.CreateMember(model, 2, Member1DType.Beam, css_he_200b, "N4", "N6"); // member for left column ConnectedMember M3 = Helpers.CreateMember(model, 3, Member1DType.Column, css_he_240b, "N1", "N2", "N7"); // member for middle column ConnectedMember M4 = Helpers.CreateMember(model, 4, Member1DType.Column, css_he_240b, "N3", "N4", "N8"); // member for right column ConnectedMember M5 = Helpers.CreateMember(model, 5, Member1DType.Column, css_he_240b, "N5", "N6", "N9"); // member for upper continuous beam ConnectedMember M6 = Helpers.CreateMember(model, 6, Member1DType.Beam, css_he_200b, "N7", "N8", "N9"); // add members to the model model.AddObject(M1); model.AddObject(M2); model.AddObject(M3); model.AddObject(M4); model.AddObject(M5); model.AddObject(M6); // create first connection point ConnectionPoint CP1 = new ConnectionPoint(); CP1.Node = new ReferenceElement(model.Point3D.FirstOrDefault(n => n.Name == "N2")); CP1.Id = model.GetMaxId(CP1) + 1; CP1.Name = "CON " + CP1.Id.ToString(); CP1.ConnectedMembers.Add(M1); CP1.ConnectedMembers.Add(M3); model.AddObject(CP1); // create second connection point ConnectionPoint CP2 = new ConnectionPoint(); CP2.Node = new ReferenceElement(model.Point3D.FirstOrDefault(n => n.Name == "N4")); CP2.Id = model.GetMaxId(CP2) + 1; CP2.Name = "CON " + CP2.Id.ToString(); CP2.ConnectedMembers.Add(M1); CP2.ConnectedMembers.Add(M2); CP2.ConnectedMembers.Add(M4); model.AddObject(CP2); }
/// <summary> /// Add combinations to the IDEA open model /// </summary> /// <param name="model">OpenModel</param> private static void AddCombinationsToIOM(OpenModel model) { // create first combination input CombiInputEC CI1 = new CombiInputEC(); CI1.Id = model.GetMaxId(CI1) + 1; CI1.Name = "Co.#1"; CI1.Description = "SelfWeight + PernamentLoading + LiveLoad"; CI1.TypeCombiEC = TypeOfCombiEC.ULS; CI1.TypeCalculationCombi = TypeCalculationCombiEC.Linear; CombiItem item = new CombiItem(); item.Id = 1; item.Coeff = 1; item.LoadCase = new ReferenceElement(model.LoadCase.FirstOrDefault(l => l.Name == "SelfWeight")); CI1.Items.Add(item); item = new CombiItem(); item.Id = 2; item.Coeff = 1; item.LoadCase = new ReferenceElement(model.LoadCase.FirstOrDefault(l => l.Name == "PernamentLoading")); CI1.Items.Add(item); item = new CombiItem(); item.Id = 3; item.Coeff = 1; item.LoadCase = new ReferenceElement(model.LoadCase.FirstOrDefault(l => l.Name == "LiveLoad")); CI1.Items.Add(item); model.AddObject(CI1); // create second combination input CombiInputEC CI2 = new CombiInputEC(); CI2.Id = model.GetMaxId(CI2) + 1; CI2.Name = "Co.#2"; CI2.Description = "SelfWeight"; CI2.TypeCombiEC = TypeOfCombiEC.ULS; CI2.TypeCalculationCombi = TypeCalculationCombiEC.Linear; item = new CombiItem(); item.Id = 1; item.Coeff = 1; item.LoadCase = new ReferenceElement(model.LoadCase.FirstOrDefault(l => l.Name == "SelfWeight")); CI2.Items.Add(item); model.AddObject(CI2); }
/// <summary> /// Create member /// </summary> /// <param name="model">Idea open model</param> /// <param name="id">Member id</param> /// <param name="type">Member type</param> /// <param name="css">Cross section</param> /// <param name="startNode">Start node</param> /// <param name="endNode">End node</param> /// <returns>Connected member</returns> public static ConnectedMember CreateMember(OpenModel model, int id, Member1DType type, CrossSection css, string startNode, string endNode) { // create line segments LineSegment3D segment = CreateLineSegment3D(model, startNode, endNode); // create polylines PolyLine3D polyline = new PolyLine3D(); polyline.Id = model.GetMaxId(polyline) + 1; polyline.Segments.Add(new ReferenceElement(segment)); // add polylines and segments to the model model.AddObject(polyline); model.AddObject(segment); // create 1D elements Element1D element = CreateElement1D(model, css, segment); model.AddObject(element); // create 1D members Member1D member = CreateMember1D(model, id, type, element); model.Member1D.Add(member); // create and return connected member ConnectedMember connectedMember = new ConnectedMember(); connectedMember.Id = id; connectedMember.MemberId = new ReferenceElement(member); return(connectedMember); }
private void AddMaterialsToOpenModel() { MatSteelEc2 matOM = new MatSteelEc2(); matOM.Id = openStructModel.GetMaxId(matOM) + 1; matOM.Name = "S275"; matOM.E = 210000000000; matOM.G = matOM.E / (2 * (1 + 0.3)); matOM.Poisson = 0.3; matOM.UnitMass = 7870 / 9.81; matOM.fu = 430000000; matOM.fy = 275000000; matOM.fu40 = 410000000; matOM.fy40 = 255000000; matOM.SpecificHeat = 0.49; matOM.ThermalConductivity = 50.2; matOM.ThermalExpansion = 0.0000022; openStructModel.AddObject(matOM); }
/// <summary> /// Create element 1D /// </summary> /// <param name="model">Idea open model</param> /// <param name="css">Cross section</param> /// <param name="segment">Line segment</param> /// <returns>Element 1D</returns> private static Element1D CreateElement1D(OpenModel model, CrossSection css, LineSegment3D segment) { Element1D element1D = new Element1D(); element1D.Id = model.GetMaxId(element1D) + 1; element1D.Name = "E" + element1D.Id.ToString(); element1D.Segment = new ReferenceElement(segment); element1D.CrossSectionBegin = new ReferenceElement(css); element1D.CrossSectionEnd = new ReferenceElement(css); return(element1D); }
/// <summary> /// Create member /// </summary> /// <param name="model">Idea open model</param> /// <param name="id">Member id</param> /// <param name="type">Member type</param> /// <param name="css">Cross section</param> /// <param name="startNode">Start node</param> /// <param name="middleNode">Middle node</param> /// <param name="endNode">End node</param> /// <returns>Connected member</returns> public static ConnectedMember CreateMember(OpenModel model, int id, Member1DType type, CrossSection css, string startNode, string middleNode, string endNode) { // column members have different coordination system in our example bool transformCoordSystem = type == Member1DType.Column ? true : false; // create line segments LineSegment3D segment1 = CreateLineSegment3D(model, startNode, middleNode, transformCoordSystem); model.AddObject(segment1); LineSegment3D segment2 = CreateLineSegment3D(model, middleNode, endNode, transformCoordSystem); model.AddObject(segment2); // create polylines PolyLine3D polyline = new PolyLine3D(); polyline.Id = model.GetMaxId(polyline) + 1; polyline.Segments.Add(new ReferenceElement(segment1)); polyline.Segments.Add(new ReferenceElement(segment2)); model.AddObject(polyline); // create 1D elements Element1D element1 = CreateElement1D(model, css, segment1); model.AddObject(element1); Element1D element2 = CreateElement1D(model, css, segment2); model.AddObject(element2); // create 1D members Member1D member = CreateMember1D(model, id, type, element1, element2); model.Member1D.Add(member); // create and return connected member ConnectedMember connectedMember = new ConnectedMember(); connectedMember.Id = id; connectedMember.MemberId = new ReferenceElement(member); return(connectedMember); }
// ad node to openModel private Point3D AddNodeToOpenModel(StructuralPointConnection conPoint, OpenModel openStructModel, int id = 0) { var pt = openStructModel.Point3D.Find(c => IsEqual(c.X, conPoint.X.GetValueOrDefault(), limits) && IsEqual(c.Y, conPoint.Y.GetValueOrDefault(), limits) && IsEqual(c.Z, conPoint.Z.GetValueOrDefault(), limits)); if (pt != null) { return(pt); } else { IdeaRS.OpenModel.Geometry3D.Point3D point = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = conPoint.X.GetValueOrDefault(), Y = conPoint.Y.GetValueOrDefault(), Z = conPoint.Z.GetValueOrDefault() }; point.Id = (id > 0 ? id : (openStructModel.GetMaxId(point) + 1)); point.Name = point.Id.ToString(); openStructModel.Point3D.Add(point); return(point); } }
/// <summary> /// Create line segment /// </summary> /// <param name="model">Idea open model</param> /// <param name="startNode">Start node</param> /// <param name="endNode">End node</param> /// <param name="transformCoordSystem">Tranform coordinate system</param> /// <returns>Line segment 3D</returns> private static LineSegment3D CreateLineSegment3D(OpenModel model, string startNode, string endNode, bool transformCoordSystem = false) { LineSegment3D segment3D = new LineSegment3D(); segment3D.Id = model.GetMaxId(segment3D) + 1; segment3D.StartPoint = new ReferenceElement(model.Point3D.FirstOrDefault(item => item.Name == startNode)); segment3D.EndPoint = new ReferenceElement(model.Point3D.FirstOrDefault(item => item.Name == endNode)); if (transformCoordSystem) { CoordSystemByPoint system = new CoordSystemByPoint(); system.Point = new Point3D() { X = 100000, Y = 0, Z = 0 }; system.InPlane = Plane.ZX; segment3D.LocalCoordinateSystem = system; } return(segment3D); }
static private OpenModel CreateConnectionGeometry(OpenModel openModel) { //Add connection point IdeaRS.OpenModel.Connection.ConnectionPoint connection = new IdeaRS.OpenModel.Connection.ConnectionPoint(); IdeaRS.OpenModel.Geometry3D.Point3D point = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 3, Z = 3 }; point.Id = openModel.GetMaxId(point) + 1; point.Name = point.Id.ToString(); openModel.Point3D.Add(point); connection.Node = new ReferenceElement(point); connection.Name = point.Name; connection.Id = openModel.GetMaxId(connection) + 1; //add connection openModel.Connections.Add(new IdeaRS.OpenModel.Connection.ConnectionData()); //add Beams openModel.Connections[0].Beams = new List <IdeaRS.OpenModel.Connection.BeamData>(); //member1D 1 IdeaRS.OpenModel.Connection.BeamData beam1Data = new IdeaRS.OpenModel.Connection.BeamData { Name = "M1", Id = 1, OriginalModelId = "1", IsAdded = false, MirrorY = false, RefLineInCenterOfGravity = false, }; openModel.Connections[0].Beams.Add(beam1Data); var member1 = openModel.Member1D.Find(x => x.Id == 1); IdeaRS.OpenModel.Connection.ConnectedMember conMb = new IdeaRS.OpenModel.Connection.ConnectedMember { Id = member1.Id, MemberId = new ReferenceElement(member1), IsContinuous = false, }; connection.ConnectedMembers.Add(conMb); //member1D 3 var member3 = openModel.Member1D.Find(x => x.Id == 3); IdeaRS.OpenModel.Connection.ConnectedMember conMb3 = new IdeaRS.OpenModel.Connection.ConnectedMember { Id = member3.Id, MemberId = new ReferenceElement(member3), IsContinuous = true, }; connection.ConnectedMembers.Add(conMb3); IdeaRS.OpenModel.Connection.BeamData beam2Data = new IdeaRS.OpenModel.Connection.BeamData { Name = "M3", Id = 3, OriginalModelId = member3.Id.ToString(), IsAdded = false, MirrorY = false, RefLineInCenterOfGravity = false, }; openModel.Connections[0].Beams.Add(beam2Data); openModel.AddObject(connection); //add plate IdeaRS.OpenModel.Connection.PlateData plateData = new IdeaRS.OpenModel.Connection.PlateData { Name = "P1", Thickness = 0.02, Id = 11, Material = "S355", OriginalModelId = "11", Origin = new IdeaRS.OpenModel.Geometry3D.Point3D { X = -1.87, Y = 2.88, Z = 2.7 }, AxisX = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 1, Z = 0 }, AxisY = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 0, Z = 1 }, AxisZ = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 1, Y = 0, Z = 0 }, Region = "M 0 0 L 0.24 0 L 0.24 0.5 L 0 0.5 L 0 0", }; (openModel.Connections[0].Plates ?? (openModel.Connections[0].Plates = new List <IdeaRS.OpenModel.Connection.PlateData>())).Add(plateData); // add cut openModel.Connections[0].CutBeamByBeams = new List <IdeaRS.OpenModel.Connection.CutBeamByBeamData> { new IdeaRS.OpenModel.Connection.CutBeamByBeamData { CuttingObject = new ReferenceElement(plateData), ModifiedObject = new ReferenceElement(beam1Data), Orientation = CutOrientation.Parallel, WeldType = WeldType.DoubleFillet, IsWeld = true, } }; IdeaRS.OpenModel.Connection.BoltGrid boltGrid = new IdeaRS.OpenModel.Connection.BoltGrid() { Id = 41, ConnectedPartIds = new List <string>(), Diameter = 0.016, HeadDiameter = 0.024, DiagonalHeadDiameter = 0.026, HeadHeight = 0.01, BoreHole = 0.018, TensileStressArea = 157, NutThickness = 0.013, AnchorLen = 0.05, Material = "8.8", Standard = "M 16", }; boltGrid.Origin = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = plateData.Origin.X, Y = plateData.Origin.Y, Z = plateData.Origin.Z }; boltGrid.AxisX = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = plateData.AxisX.X, Y = plateData.AxisX.Y, Z = plateData.AxisX.Z }; boltGrid.AxisY = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = plateData.AxisY.X, Y = plateData.AxisY.Y, Z = plateData.AxisY.Z }; boltGrid.AxisZ = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = plateData.AxisZ.X, Y = plateData.AxisZ.Y, Z = plateData.AxisZ.Z }; boltGrid.Positions = new List <IdeaRS.OpenModel.Geometry3D.Point3D> { new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.87, Y = 2.92, Z = 2.8 }, new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.87, Y = 3.08, Z = 2.8 }, new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.87, Y = 2.92, Z = 3.15 }, new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.87, Y = 3.08, Z = 3.15 } }; boltGrid.ConnectedPartIds = new List <string>() { beam2Data.OriginalModelId, plateData.OriginalModelId }; (openModel.Connections[0].BoltGrids ?? (openModel.Connections[0].BoltGrids = new List <IdeaRS.OpenModel.Connection.BoltGrid>())).Add(boltGrid); //add plate 2 IdeaRS.OpenModel.Connection.PlateData plateData2 = new IdeaRS.OpenModel.Connection.PlateData { Name = "P2", Thickness = 0.02, Id = 12, Material = "S355", OriginalModelId = "12", Origin = new IdeaRS.OpenModel.Geometry3D.Point3D { X = -2.103, Y = 2.88, Z = 2.75 }, AxisX = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 1, Y = 0, Z = 0 }, AxisY = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 1, Z = 0 }, AxisZ = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 0, Z = 1 }, Region = "M 0 0 L 0.206 0 L 0.206 0.105 L 0.195 0.115 L 0.011 0.115 L 0.0 0.105 L 0 0", }; (openModel.Connections[0].Plates ?? (openModel.Connections[0].Plates = new List <IdeaRS.OpenModel.Connection.PlateData>())).Add(plateData2); //add weld between memeber 2 and plate 2 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData = new IdeaRS.OpenModel.Connection.WeldData() { Id = 31, ConnectedPartIds = new List <string>() { plateData2.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 2.995, Z = 2.76 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 2.995, Z = 2.76 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; (openModel.Connections[0].Welds ?? (openModel.Connections[0].Welds = new List <IdeaRS.OpenModel.Connection.WeldData>())).Add(weldData); //add weld3 between memeber 2 and plate 2 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData3 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 33, ConnectedPartIds = new List <string>() { plateData2.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 2.90, Z = 2.76 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 2.90, Z = 2.76 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData3); //add weld4 between memeber 2 and plate 2 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData4 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 34, ConnectedPartIds = new List <string>() { plateData2.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 2.90, Z = 2.76 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 2.90, Z = 2.76 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData4); //add plate 3 IdeaRS.OpenModel.Connection.PlateData plateData3 = new IdeaRS.OpenModel.Connection.PlateData { Name = "P3", Thickness = 0.02, Id = 13, Material = "S355", OriginalModelId = "13", Origin = new IdeaRS.OpenModel.Geometry3D.Point3D { X = -2.103, Y = 2.88, Z = 3.1 }, AxisX = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 1, Y = 0, Z = 0 }, AxisY = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 1, Z = 0 }, AxisZ = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 0, Z = 1 }, Region = "M 0 0 L 0.206 0 L 0.206 0.105 L 0.195 0.115 L 0.011 0.115 L 0.0 0.105 L 0 0", }; openModel.Connections[0].Plates.Add(plateData3); //add weld between memeber 2 and plate 3 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData2 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 32, ConnectedPartIds = new List <string>() { plateData3.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 2.995, Z = 3.11 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 2.995, Z = 3.11 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData2); //add weld5 between memeber 2 and plate 3 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData5 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 35, ConnectedPartIds = new List <string>() { plateData3.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 2.90, Z = 3.11 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 2.90, Z = 3.11 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData5); //add weld6 between memeber 2 and plate 3 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData6 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 36, ConnectedPartIds = new List <string>() { plateData3.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 2.90, Z = 3.11 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 2.90, Z = 3.11 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData6); //add plate 4 IdeaRS.OpenModel.Connection.PlateData plateData4 = new IdeaRS.OpenModel.Connection.PlateData { Name = "P4", Thickness = 0.02, Id = 14, Material = "S355", OriginalModelId = "14", Origin = new IdeaRS.OpenModel.Geometry3D.Point3D { X = -2.103, Y = 3.12, Z = 2.75 }, AxisX = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 1, Y = 0, Z = 0 }, AxisY = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = -1, Z = 0 }, AxisZ = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 0, Z = 1 }, Region = "M 0 0 L 0.206 0 L 0.206 0.105 L 0.195 0.115 L 0.011 0.115 L 0.0 0.105 L 0 0", }; openModel.Connections[0].Plates.Add(plateData4); //add weld7 between memeber 2 and plate 4 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData7 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 37, ConnectedPartIds = new List <string>() { plateData4.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 3.005, Z = 2.76 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 3.005, Z = 2.76 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData7); //add weld8 between memeber 2 and plate 4 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData8 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 38, ConnectedPartIds = new List <string>() { plateData4.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 3.1, Z = 2.76 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 3.1, Z = 2.76 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData8); //add weld9 between memeber 2 and plate 4 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData9 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 39, ConnectedPartIds = new List <string>() { plateData4.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 3.1, Z = 2.76 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 3.1, Z = 2.76 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData9); //add plate 5 IdeaRS.OpenModel.Connection.PlateData plateData5 = new IdeaRS.OpenModel.Connection.PlateData { Name = "P5", Thickness = 0.02, Id = 15, Material = "S355", OriginalModelId = "15", Origin = new IdeaRS.OpenModel.Geometry3D.Point3D { X = -2.103, Y = 3.12, Z = 3.1 }, AxisX = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 1, Y = 0, Z = 0 }, AxisY = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = -1, Z = 0 }, AxisZ = new IdeaRS.OpenModel.Geometry3D.Vector3D { X = 0, Y = 0, Z = 1 }, Region = "M 0 0 L 0.206 0 L 0.206 0.105 L 0.195 0.115 L 0.011 0.115 L 0.0 0.105 L 0 0", }; openModel.Connections[0].Plates.Add(plateData5); //add weld10 between memeber 2 and plate 5 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData10 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 40, ConnectedPartIds = new List <string>() { plateData5.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 3.005, Z = 3.11 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2, Y = 3.005, Z = 3.11 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData10); //add weld11 between memeber 2 and plate 5 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData11 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 41, ConnectedPartIds = new List <string>() { plateData5.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 3.10, Z = 3.11 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -2.103, Y = 3.10, Z = 3.11 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData11); //add weld12 between memeber 2 and plate 5 - stiffener IdeaRS.OpenModel.Connection.WeldData weldData12 = new IdeaRS.OpenModel.Connection.WeldData() { Id = 46, ConnectedPartIds = new List <string>() { plateData5.OriginalModelId, beam2Data.OriginalModelId }, Start = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 3.10, Z = 3.11 }, End = new IdeaRS.OpenModel.Geometry3D.Point3D() { X = -1.897, Y = 3.10, Z = 3.11 }, Thickness = 0.004, WeldType = IdeaRS.OpenModel.Connection.WeldType.DoubleFillet, }; openModel.Connections[0].Welds.Add(weldData12); return(openModel); }
static private OpenModel CreateConnectionGeometry(OpenModel openModel) { //Get geometrical point IdeaRS.OpenModel.Geometry3D.Point3D point = openModel.Point3D.Find(p => p.Name.Equals("N2", StringComparison.InvariantCultureIgnoreCase)); //Create a new connection point IdeaRS.OpenModel.Connection.ConnectionPoint connectionPoint = new IdeaRS.OpenModel.Connection.ConnectionPoint(); connectionPoint.Node = new ReferenceElement(point); connectionPoint.Name = point.Name; connectionPoint.Id = openModel.GetMaxId(connectionPoint) + 1; //create the new connection data var newConnectionData = new IdeaRS.OpenModel.Connection.ConnectionData(); //create list for beams newConnectionData.Beams = new List <IdeaRS.OpenModel.Connection.BeamData>(); { //member1D - column var columnMember = openModel.Member1D.Find(x => x.Id == 1); IdeaRS.OpenModel.Connection.ConnectedMember connectedColumn = new IdeaRS.OpenModel.Connection.ConnectedMember { Id = columnMember.Id, MemberId = new ReferenceElement(columnMember), IsContinuous = true, }; connectionPoint.ConnectedMembers.Add(connectedColumn); IdeaRS.OpenModel.Connection.BeamData columnData = new IdeaRS.OpenModel.Connection.BeamData { Name = "Column", Id = 1, OriginalModelId = columnMember.Id.ToString(), IsAdded = false, MirrorY = false, RefLineInCenterOfGravity = false, }; newConnectionData.Beams.Add(columnData); } { //member1D - beam IdeaRS.OpenModel.Connection.BeamData beamData = new IdeaRS.OpenModel.Connection.BeamData { Name = "Beam", Id = 2, OriginalModelId = "2", IsAdded = false, MirrorY = false, RefLineInCenterOfGravity = false, }; newConnectionData.Beams.Add(beamData); var column = openModel.Member1D.Find(x => x.Id == 2); IdeaRS.OpenModel.Connection.ConnectedMember connectedBeam = new IdeaRS.OpenModel.Connection.ConnectedMember { Id = column.Id, MemberId = new ReferenceElement(column), IsContinuous = false, }; connectionPoint.ConnectedMembers.Add(connectedBeam); } openModel.Connections.Add(newConnectionData); openModel.AddObject(connectionPoint); return(openModel); }
private void AddConnectedMember(List <BearingMember> bearingMembers, ConnectionPoint connectionPoint) { PolyLine3D polyLine3D = new PolyLine3D(); polyLine3D.Id = openModel.GetMaxId(polyLine3D) + 1; openModel.AddObject(polyLine3D); Point3D pA = new Point3D(); Point3D pB = new Point3D(); Point3D pC = new Point3D(); Point3D pD = new Point3D(); //view from point [B], point [B] is centerpoint of connection if (bearingMembers[0].isStartPoint == false) { if (bearingMembers[1].isStartPoint == true) { // [A]=0=>[B]=1=>[C] pA = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.Start.id); pB = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.End.id); pC = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.Start.id); pD = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.End.id); } else { // [A]=0=>[B]<=1=[C] pA = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.Start.id); pB = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.End.id); pC = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.End.id); pD = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.Start.id); } } else { if (bearingMembers[1].isStartPoint == true) { // [A]<=0=[B]=1=>[C] pA = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.End.id); pB = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.Start.id); pC = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.Start.id); pD = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.End.id); } else { // [A]<=0=[B]<=1=[C] pA = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.End.id); pB = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.Start.id); pC = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.End.id); pD = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.Start.id); /* * pA = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.End.id); * pB = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.Start.id); * pC = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.End.id); * pD = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.Start.id); */ } } //segments /* * Point3D pA = openModel.Point3D.First(a => a.Id == bearingMembers[0].ideaLine.Start.id); * Point3D pB = openModel.Point3D.First(a => a.Id == bearingMembers[0].ideaLine.End.id); * Point3D pC = openModel.Point3D.First(a => a.Id == bearingMembers[1].ideaLine.Start.id); * Point3D pD = openModel.Point3D.First(a => a.Id == bearingMembers[1].ideaLine.End.id); */ List <Point3D> points = new List <Point3D>() { pA, pB, pC, pD }; //Point3D pointB = points.Where(a => a.Id == connectionPoint.Id).First(); //Point3D pointA = points.Where(a => a.Id != connectionPoint.Id).ToList()[0];//logica //Point3D pointC = points.Where(a => a.Id != connectionPoint.Id).ToList()[1]; //Note: not most robust solution, e.g. does not hold in case of segments with inverse vectors Point3D pointA = pA; //Endpoint of first member Point3D pointB = pB; //Startpoint of first member Point3D pointC = pD; //Endpoint of second member LineSegment3D lineSegment1 = new LineSegment3D(); lineSegment1.Id = openModel.GetMaxId(lineSegment1) + 1; openModel.AddObject(lineSegment1); lineSegment1.StartPoint = new ReferenceElement(pointA); lineSegment1.EndPoint = new ReferenceElement(pointB); polyLine3D.Segments.Add(new ReferenceElement(lineSegment1)); ///* //Defining LCS for First lineSegment double xcor = bearingMembers[0].ElementRAZ.line.vector.X; double ycor = bearingMembers[0].ElementRAZ.line.vector.Y; double zcor = bearingMembers[0].ElementRAZ.line.vector.Z; //Define LCS (local-y in XY plane) and unitize VectorRAZ vx = new VectorRAZ(xcor, ycor, zcor).Unitize(); VectorRAZ vy = new VectorRAZ(); VectorRAZ vz = new VectorRAZ(); if (xcor == 0.0 && ycor == 0.0) { vy = new VectorRAZ(0.0, 1.0, 0.0).Unitize(); vz = new VectorRAZ((-zcor), 0.0, (xcor)).Unitize(); } else { vy = new VectorRAZ(-ycor, xcor, 0.0).Unitize(); vz = new VectorRAZ((-zcor * xcor), (-zcor * ycor), ((xcor * xcor) + (ycor * ycor))).Unitize(); } var LocalCoordinateSystem = new CoordSystemByVector(); LocalCoordinateSystem.VecX = new Vector3D() { X = vx.X, Y = vx.Y, Z = vx.Z }; LocalCoordinateSystem.VecY = new Vector3D() { X = vy.X, Y = vy.Y, Z = vy.Z }; LocalCoordinateSystem.VecZ = new Vector3D() { X = vz.X, Y = vz.Y, Z = vz.Z }; lineSegment1.LocalCoordinateSystem = LocalCoordinateSystem; //*/ LineSegment3D lineSegment2 = new LineSegment3D(); lineSegment2.Id = openModel.GetMaxId(lineSegment2) + 1; openModel.AddObject(lineSegment2); lineSegment2.StartPoint = new ReferenceElement(pointB); lineSegment2.EndPoint = new ReferenceElement(pointC); polyLine3D.Segments.Add(new ReferenceElement(lineSegment2)); ///* /////Defining LCS for Second lineSegment double xcor2 = bearingMembers[1].ElementRAZ.line.vector.X; double ycor2 = bearingMembers[1].ElementRAZ.line.vector.Y; double zcor2 = bearingMembers[1].ElementRAZ.line.vector.Z; //Define LCS (local-y in XY plane) and unitize VectorRAZ vx2 = new VectorRAZ(xcor2, ycor2, zcor2).Unitize(); VectorRAZ vy2 = new VectorRAZ(); VectorRAZ vz2 = new VectorRAZ(); if (xcor2 == 0.0 && ycor2 == 0.0) { vy2 = new VectorRAZ(0.0, 1.0, 0.0).Unitize(); vz2 = new VectorRAZ((-zcor2), 0.0, (xcor2)).Unitize(); } else { vy2 = new VectorRAZ(-ycor2, xcor2, 0.0).Unitize(); vz2 = new VectorRAZ((-zcor2 * xcor2), (-zcor2 * ycor2), ((xcor2 * xcor2) + (ycor2 * ycor2))).Unitize(); } var LocalCoordinateSystem2 = new CoordSystemByVector(); LocalCoordinateSystem2.VecX = new Vector3D() { X = vx2.X, Y = vx2.Y, Z = vx2.Z }; LocalCoordinateSystem2.VecY = new Vector3D() { X = vy2.X, Y = vy2.Y, Z = vy2.Z }; LocalCoordinateSystem2.VecZ = new Vector3D() { X = vz2.X, Y = vz2.Y, Z = vz2.Z }; lineSegment2.LocalCoordinateSystem = LocalCoordinateSystem2; //*/ //create elements Element1D el1 = new Element1D(); //el1.Id = openModel.GetMaxId(el1) + 1; el1.Id = bearingMembers[0].ElementRAZ.id + 1; //Use of Id from Grasshopper Model + Plus One el1.Name = "E" + el1.Id.ToString(); el1.Segment = new ReferenceElement(lineSegment1); IdeaRS.OpenModel.CrossSection.CrossSection crossSection = openModel.CrossSection.First(a => a.Id == bearingMembers[0].ElementRAZ.crossSection.id); el1.CrossSectionBegin = new ReferenceElement(crossSection); el1.CrossSectionEnd = new ReferenceElement(crossSection); openModel.AddObject(el1); Element1D el2 = new Element1D(); //el2.Id = openModel.GetMaxId(el2) + 1; el2.Id = bearingMembers[1].ElementRAZ.id + 1; //Use of Id from Grasshopper Model + Plus One el2.Name = "E" + el2.Id.ToString(); el2.Segment = new ReferenceElement(lineSegment2); el2.CrossSectionBegin = new ReferenceElement(crossSection); el2.CrossSectionEnd = new ReferenceElement(crossSection); openModel.AddObject(el2); //create member Member1D member1D = new Member1D(); member1D.Id = openModel.GetMaxId(member1D) + 1; member1D.Name = "Member" + member1D.Id.ToString(); member1D.Elements1D.Add(new ReferenceElement(el1)); member1D.Elements1D.Add(new ReferenceElement(el2)); openModel.Member1D.Add(member1D); //create connected member ConnectedMember connectedMember = new ConnectedMember(); connectedMember.Id = member1D.Id; connectedMember.MemberId = new ReferenceElement(member1D); connectionPoint.ConnectedMembers.Add(connectedMember); }
private void AddConnectedMember(List <BearingMember> bearingMembers, ConnectionPoint connectionPoint) { PolyLine3D polyLine3D = new PolyLine3D(); polyLine3D.Id = openModel.GetMaxId(polyLine3D) + 1; openModel.AddObject(polyLine3D); Point3D pA = new Point3D(); Point3D pB = new Point3D(); Point3D pB2 = new Point3D(); Point3D pC = new Point3D(); pA = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.Start.id); pB = openModel.Point3D.First(a => a.Id == bearingMembers[0].ElementRAZ.line.End.id); pB2 = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.Start.id); pC = openModel.Point3D.First(a => a.Id == bearingMembers[1].ElementRAZ.line.End.id); List <Point3D> points = new List <Point3D>() { pA, pB, pB2, pC }; Point3D pointA = pA; //Endpoint of first member Point3D pointB = pB; //Startpoint of first member Point3D pointC = pC; //Endpoint of second member LineSegment3D lineSegment1 = new LineSegment3D(); lineSegment1.Id = openModel.GetMaxId(lineSegment1) + 1; openModel.AddObject(lineSegment1); lineSegment1.StartPoint = new ReferenceElement(pointA); lineSegment1.EndPoint = new ReferenceElement(pointB); polyLine3D.Segments.Add(new ReferenceElement(lineSegment1)); SetLCS(bearingMembers[0], lineSegment1); LineSegment3D lineSegment2 = new LineSegment3D(); lineSegment2.Id = openModel.GetMaxId(lineSegment2) + 1; openModel.AddObject(lineSegment2); lineSegment2.StartPoint = new ReferenceElement(pointB); lineSegment2.EndPoint = new ReferenceElement(pointC); polyLine3D.Segments.Add(new ReferenceElement(lineSegment2)); SetLCS(bearingMembers[1], lineSegment2); //create elements Element1D el1 = new Element1D(); //el1.Id = openModel.GetMaxId(el1) + 1; el1.Id = bearingMembers[0].ElementRAZ.id + 1; //Use of Id from Grasshopper Model + Plus One el1.Name = "E" + el1.Id.ToString(); el1.Segment = new ReferenceElement(lineSegment1); IdeaRS.OpenModel.CrossSection.CrossSection crossSection = openModel.CrossSection.First(a => a.Id == bearingMembers[0].ElementRAZ.crossSection.id); el1.CrossSectionBegin = new ReferenceElement(crossSection); el1.CrossSectionEnd = new ReferenceElement(crossSection); //el1.RotationRx = bearingMembers[0].ElementRAZ.rotationLCS; openModel.AddObject(el1); Element1D el2 = new Element1D(); //el2.Id = openModel.GetMaxId(el2) + 1; el2.Id = bearingMembers[1].ElementRAZ.id + 1; //Use of Id from Grasshopper Model + Plus One el2.Name = "E" + el2.Id.ToString(); el2.Segment = new ReferenceElement(lineSegment2); el2.CrossSectionBegin = new ReferenceElement(crossSection); el2.CrossSectionEnd = new ReferenceElement(crossSection); //el2.RotationRx = bearingMembers[1].ElementRAZ.rotationLCS; openModel.AddObject(el2); //create member Member1D member1D = new Member1D(); member1D.Id = openModel.GetMaxId(member1D) + 1; member1D.Name = "Member" + member1D.Id.ToString(); member1D.Elements1D.Add(new ReferenceElement(el1)); member1D.Elements1D.Add(new ReferenceElement(el2)); openModel.Member1D.Add(member1D); //create connected member ConnectedMember connectedMember = new ConnectedMember(); connectedMember.Id = member1D.Id; connectedMember.MemberId = new ReferenceElement(member1D); connectionPoint.ConnectedMembers.Add(connectedMember); }