/// <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 ConnectedMember AddConnectedMember3point(int idMember, int idCss, int idPointA, int idPointB, int idPointC) { PolyLine3D polyLine3D = new PolyLine3D(); polyLine3D.Id = idMember; openStructModel.AddObject(polyLine3D); //Segments LineSegment3D ls1 = new LineSegment3D(); ls1.Id = openStructModel.GetMaxId(ls1) + 1; openStructModel.AddObject(ls1); ls1.StartPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointA)); ls1.EndPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointB)); polyLine3D.Segments.Add(new ReferenceElement(ls1)); LineSegment3D ls2 = new LineSegment3D(); ls2.Id = openStructModel.GetMaxId(ls2) + 1; openStructModel.AddObject(ls2); ls2.StartPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointB)); ls2.EndPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointC)); polyLine3D.Segments.Add(new ReferenceElement(ls2)); Element1D el1 = new Element1D(); el1.Id = openStructModel.GetMaxId(el1) + 1; el1.Name = "E" + el1.Id; el1.Segment = new ReferenceElement(ls1); el1.CrossSectionBegin = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); el1.CrossSectionEnd = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); openStructModel.AddObject(el1); Element1D el2 = new Element1D(); el2.Id = openStructModel.GetMaxId(el2) + 1; el2.Name = "E" + el2.Id; el2.Segment = new ReferenceElement(ls2); el2.CrossSectionBegin = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); el2.CrossSectionEnd = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); openStructModel.AddObject(el2); Member1D mb = new Member1D(); mb.Id = idMember; mb.Name = "B" + mb.Id; mb.Elements1D.Add(new ReferenceElement(el1)); mb.Elements1D.Add(new ReferenceElement(el2)); openStructModel.Member1D.Add(mb); ConnectedMember conMb = new ConnectedMember(); conMb.Id = mb.Id; conMb.MemberId = new ReferenceElement(mb); return(conMb); }
private void CreateIDEAOpenModelResults() { openStructModelR = new OpenModelResult(); openStructModelR.ResultOnMembers = new List <ResultOnMembers>(); ResultOnMembers resIF = new ResultOnMembers(); for (int ib = 0; ib < openStructModel.Member1D.Count; ib++) { Member1D mb = openStructModel.Member1D[ib]; for (int iel = 0; iel < mb.Elements1D.Count; iel++) { Element1D elem = openStructModel.Element1D.First(c => c.Id == mb.Elements1D[iel].Id); ResultOnMember resMember = new ResultOnMember(new Member() { Id = elem.Id, MemberType = MemberType.Element1D }, ResultType.InternalForces); int numPoints = 10; for (int ip = 0; ip <= numPoints; ip++) { ResultOnSection resSec = new ResultOnSection(); resSec.AbsoluteRelative = AbsoluteRelative.Relative; resSec.Position = (double)ip / (double)numPoints; int count = openStructModel.LoadCase.Count; for (int i = 1; i <= count; i++) { ResultOfInternalForces resLc = new ResultOfInternalForces(); int loadCaseNumber = i; resLc.Loading = new ResultOfLoading() { Id = loadCaseNumber, LoadingType = LoadingType.LoadCase }; resLc.Loading.Items.Add(new ResultOfLoadingItem() { Coefficient = 1.0 }); resLc.N = 15000; resLc.Qy = 2; resLc.Qz = 3; resLc.Mx = 4; resLc.My = (ip + 1) * 21000; resLc.Mz = 6; resSec.Results.Add(resLc); } resMember.Results.Add(resSec); } resIF.Members.Add(resMember); } } openStructModelR.ResultOnMembers.Add(resIF); }
/// <summary> /// Create member 1D /// </summary> /// <param name="model">Idea open model</param> /// <param name="id">Member id</param> /// <param name="type">Member type</param> /// <param name="element">Element</param> /// <returns>Member 1D</returns> private static Member1D CreateMember1D(OpenModel model, int id, Member1DType type, Element1D element) { Member1D member1D = new Member1D(); member1D.Id = id; member1D.Name = "M" + member1D.Id.ToString(); member1D.Member1DType = type; member1D.Elements1D.Add(new ReferenceElement(element)); return(member1D); }
private double GetLength(OpenModel openStructModel, Member1D mb) { Element1D el = openStructModel.Element1D.First(c => c.Id == mb.Elements1D[0].Id); LineSegment3D seg = openStructModel.LineSegment3D.First(c => c.Id == el.Segment.Id); Point3D pA = openStructModel.Point3D.First(c => c.Id == seg.StartPoint.Id); Point3D pB = openStructModel.Point3D.First(c => c.Id == seg.EndPoint.Id); Vector3D vector = new Vector3D(); vector.X = pA.X - pB.X; vector.Y = pA.Y - pB.Y; vector.Z = pA.Z - pB.Z; return(Math.Sqrt(((vector.X * vector.X) + (vector.Y * vector.Y) + (vector.Z * vector.Z)))); }
/// <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); }
private ConnectedMember AddConnectedMember2point(int idMember, int idCss, int idPointA, int idPointB, double eccentricity) { PolyLine3D polyLine3D = new PolyLine3D(); polyLine3D.Id = openStructModel.GetMaxId(polyLine3D) + 1; openStructModel.AddObject(polyLine3D); LineSegment3D ls = new LineSegment3D(); ls.Id = openStructModel.GetMaxId(ls) + 1; ls.StartPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointA)); ls.EndPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointB)); openStructModel.AddObject(ls); polyLine3D.Segments.Add(new ReferenceElement(ls)); Element1D el = new Element1D(); el.Id = openStructModel.GetMaxId(el) + 1; el.Name = "E" + el.Id.ToString(); el.Segment = new ReferenceElement(ls); el.EccentricityBeginZ = eccentricity; el.CrossSectionBegin = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); el.CrossSectionEnd = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); openStructModel.AddObject(el); Member1D mb = new Member1D(); mb.Id = idMember; mb.Name = "B" + mb.Id.ToString(); mb.Elements1D.Add(new ReferenceElement(el)); openStructModel.Member1D.Add(mb); ConnectedMember conMb = new ConnectedMember(); conMb.Id = mb.Id; conMb.MemberId = new ReferenceElement(mb); return(conMb); }
private ConnectedMember AddConnectedMember(int idMember, int idCss, int idPointA, int idPointB, int idPointC, int idPointD, int idPointE) { PolyLine3D polyLine3D = new PolyLine3D(); polyLine3D.Id = idMember; openStructModel.AddObject(polyLine3D); //SEGMENTEN (voeg ls3 en ls4 toe) LineSegment3D ls1 = new LineSegment3D(); ls1.Id = openStructModel.GetMaxId(ls1) + 1; openStructModel.AddObject(ls1); ls1.StartPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointA)); ls1.EndPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointB)); polyLine3D.Segments.Add(new ReferenceElement(ls1)); LineSegment3D ls2 = new LineSegment3D(); ls2.Id = openStructModel.GetMaxId(ls2) + 1; openStructModel.AddObject(ls2); ls2.StartPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointB)); ls2.EndPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointC)); polyLine3D.Segments.Add(new ReferenceElement(ls2)); LineSegment3D ls3 = new LineSegment3D(); ls3.Id = openStructModel.GetMaxId(ls3) + 1; openStructModel.AddObject(ls3); ls3.StartPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointC)); ls3.EndPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointD)); polyLine3D.Segments.Add(new ReferenceElement(ls3)); LineSegment3D ls4 = new LineSegment3D(); ls4.Id = openStructModel.GetMaxId(ls4) + 1; openStructModel.AddObject(ls4); ls4.StartPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointD)); ls4.EndPoint = new ReferenceElement(openStructModel.Point3D.First(c => c.Id == idPointE)); polyLine3D.Segments.Add(new ReferenceElement(ls4)); //ELEMENTEN (Crosssections toekennen) Element1D el1 = new Element1D(); el1.Id = openStructModel.GetMaxId(el1) + 1; el1.Name = "E" + el1.Id; el1.Segment = new ReferenceElement(ls1); el1.CrossSectionBegin = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); el1.CrossSectionEnd = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); openStructModel.AddObject(el1); Element1D el2 = new Element1D(); el2.Id = openStructModel.GetMaxId(el2) + 1; el2.Name = "E" + el2.Id; el2.Segment = new ReferenceElement(ls2); el2.CrossSectionBegin = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); el2.CrossSectionEnd = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); openStructModel.AddObject(el2); Element1D el3 = new Element1D(); el3.Id = openStructModel.GetMaxId(el3) + 1; el3.Name = "E" + el3.Id; el3.Segment = new ReferenceElement(ls3); el3.CrossSectionBegin = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); el3.CrossSectionEnd = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); openStructModel.AddObject(el3); Element1D el4 = new Element1D(); el4.Id = openStructModel.GetMaxId(el4) + 1; el4.Name = "E" + el4.Id; el4.Segment = new ReferenceElement(ls4); el4.CrossSectionBegin = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); el4.CrossSectionEnd = new ReferenceElement(openStructModel.CrossSection.First(c => c.Id == idCss)); openStructModel.AddObject(el4); //MEMBERS Member1D mb = new Member1D(); mb.Id = idMember; mb.Name = "B" + mb.Id; mb.Elements1D.Add(new ReferenceElement(el1)); mb.Elements1D.Add(new ReferenceElement(el2)); mb.Elements1D.Add(new ReferenceElement(el3)); mb.Elements1D.Add(new ReferenceElement(el4)); openStructModel.Member1D.Add(mb); ConnectedMember conMb = new ConnectedMember(); conMb.Id = mb.Id; conMb.MemberId = new ReferenceElement(mb); return(conMb); }
protected override ModelBIM ImportActive(CountryCode countryCode, RequestedItemsType requestedType) { try { if (_selectedObjects?.Count == 0) { Debug.Fail("Nothing selected"); return(null); } var materials = new Dictionary <string, MatSteelEc2>(); var crossSections = new Dictionary <string, CrossSectionParameter>(); var pointConnections = _selectedObjects.OfType <StructuralPointConnection>().ToList(); var curveMembers = _selectedObjects.OfType <StructuralCurveMember>().ToList(); var assemblies = _selectedObjects.OfType <ElementAssembly>().ToList(); if (pointConnections.Count == 0) { MessageBoxHelper.ShowInformation("please select a PointConnection object to identify the connectionPoint", null); return(null); } // read all nodes (maybe it's esier) var nodes = _integrationBase.ApiCore.DtObjects.GetObjects <StructuralPointConnection>( _integrationBase.CurrentProject.Id, false, false, true); OpenModel openModel = new OpenModel { OriginSettings = new OriginSettings() { CrossSectionConversionTable = IdeaRS.OpenModel.CrossSectionConversionTable.NoUsed, CountryCode = countryCode } }; int ccsId = 1; int matId = 1; int lsId = 1; int memberId = 1; // ConnectionPoint ConnectionPoint connectionPoint = null; foreach (var point in pointConnections) { // ad main node to openModel connectionPoint = new ConnectionPoint(); if (point.NodeId.HasValue) { ConnectionPointId = point.NodeId.Value; } Point3D node = AddNodeToOpenModel(point, openModel, ConnectionPointId); connectionPoint.Node = new ReferenceElement(node); connectionPoint.Id = ConnectionPointId; connectionPoint.Name = string.Format("Conn-{0}", ConnectionPointId); connectionPoint.ProjectFileName = Path.Combine(".\\Connections", connectionPoint.Name + ".ideaCon"); } // try to add Member1D objects if they are not selected by user foreach (var assembly in assemblies) { if (assembly.Connections == null) { continue; } foreach (var c in assembly.Connections) { var ce = c as RelConnectsElements; if (ce == null || curveMembers.Find(x => x.Id == ce.RelatedElement.Value) != null) { continue; } var cm = _integrationBase.ApiCore.DtObjects.GetObjectInternal(ce.RelatedElement.Value) as StructuralCurveMember; if (cm != null) { foreach (var cm1 in pointConnections[0].ConnectsStructuralMembers) { if (cm.Id.ToString() == cm1.RelatingStructuralMember.GetValueOrDefault().ToString()) { curveMembers.Add(cm); } } } } } // create Element1D from StructuralCurveMember foreach (var element in curveMembers) { var matName = element.GetStringProperty(TableNames.contentAttributes, MaterialAttributeId) ?? "S355"; if (!materials.ContainsKey(matName)) { MatSteelEc2 material = new MatSteelEc2(); // set properties material.Id = matId++; material.Name = matName; material.E = 210000000000; material.G = material.E / (2 * (1 + 0.3)); material.Poisson = 0.3; material.UnitMass = 7850; material.SpecificHeat = 0.6; material.ThermalExpansion = 0.000012; material.ThermalConductivity = 45; material.IsDefaultMaterial = false; material.OrderInCode = 0; material.StateOfThermalExpansion = ThermalExpansionState.Code; material.StateOfThermalConductivity = ThermalConductivityState.Code; material.StateOfThermalSpecificHeat = ThermalSpecificHeatState.Code; material.StateOfThermalStressStrain = ThermalStressStrainState.Code; material.StateOfThermalStrain = ThermalStrainState.Code; material.fy = 355000000; material.fu = 510000000; material.fy40 = 335000000; material.fu40 = 470000000; material.DiagramType = SteelDiagramType.Bilinear; // add material to the model openModel.AddObject(material); materials.Add(matName, material); } var crossSection = element.GetStringProperty(TableNames.contentAttributes, CrossSectionAttributeId) ?? "HE200"; crossSection = crossSection.Replace("HE200B", "HEB200"); crossSection = crossSection.Replace("HE240B", "HEB240"); if (!crossSections.ContainsKey(crossSection)) { CrossSectionParameter css = new CrossSectionParameter { Id = ccsId++, Name = crossSection, CrossSectionRotation = 0, CrossSectionType = CrossSectionType.RolledI, Material = new ReferenceElement(materials[matName]) }; css.Parameters.Add(new ParameterString() { Name = "UniqueName", Value = crossSection }); // add cross sections to the model openModel.AddObject(css); crossSections.Add(crossSection, css); } if (element?.ConnectedBy.Count != 2) { continue; } var node = nodes.Find(x => x.Id == element?.ConnectedBy[0].RelatedStructuralConnection.Value); if (node == null) { continue; } Point3D ptA = AddNodeToOpenModel(node, openModel, node.NodeId.GetValueOrDefault()); node = nodes.Find(x => x.Id == element?.ConnectedBy[1].RelatedStructuralConnection.Value); Point3D ptB = AddNodeToOpenModel(node, openModel, node.NodeId.GetValueOrDefault()); var member1d = new Member1D { Id = memberId++, Name = element.Name }; IdeaRS.OpenModel.Geometry3D.PolyLine3D polyLine3D = new IdeaRS.OpenModel.Geometry3D.PolyLine3D { Id = member1d.Id }; var start = new WM.Point3D(ptA.X, ptA.Y, ptA.Z); var end = new WM.Point3D(ptB.X, ptB.Y, ptB.Z); var dirVectort = end - start; GetAngles(dirVectort, out double alpha, out double beta); beta *= -1; CI.Geometry3D.Matrix44 lcsSegmentMatrix = new CI.Geometry3D.Matrix44(); if (!IsZero(beta)) { // gamma pitch lcsSegmentMatrix.Rotate(beta, new CI.Geometry3D.Vector3D(0, 1, 0)); } if (!IsZero(alpha)) { // beta direction lcsSegmentMatrix.Rotate(alpha, new CI.Geometry3D.Vector3D(0, 0, 1)); } IdeaRS.OpenModel.Geometry3D.LineSegment3D ls = new IdeaRS.OpenModel.Geometry3D.LineSegment3D { Id = member1d.Id, StartPoint = new ReferenceElement(ptA), EndPoint = new ReferenceElement(ptB), LocalCoordinateSystem = new IdeaRS.OpenModel.Geometry3D.CoordSystemByVector() { VecX = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = lcsSegmentMatrix.AxisX.DirectionX, Y = lcsSegmentMatrix.AxisX.DirectionY, Z = lcsSegmentMatrix.AxisX.DirectionZ, } , VecY = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = lcsSegmentMatrix.AxisY.DirectionX, Y = lcsSegmentMatrix.AxisY.DirectionY, Z = lcsSegmentMatrix.AxisY.DirectionZ, } , VecZ = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = lcsSegmentMatrix.AxisZ.DirectionX, Y = lcsSegmentMatrix.AxisZ.DirectionY, Z = lcsSegmentMatrix.AxisZ.DirectionZ, } }, }; polyLine3D.Segments.Add(new ReferenceElement(ls)); openModel.PolyLine3D.Add(polyLine3D); openModel.LineSegment3D.Add(ls); Element1D element1d = new Element1D { Id = member1d.Id, Name = element.Id.ToString(), //element.Name, Its esier for mapping Element1D with bimplus Structuralcurvemember RotationRx = element.GetDoubleProperty(TableNames.contentAttributes, RotationAttributeId) ?? 0, CrossSectionBegin = new ReferenceElement(crossSections[crossSection]), CrossSectionEnd = new ReferenceElement(crossSections[crossSection]), Segment = new ReferenceElement(ls) }; openModel.Element1D.Add(element1d); member1d.Elements1D.Add(new ReferenceElement(element1d)); openModel.Member1D.Add(member1d); if (connectionPoint != null) { ConnectedMember conMb = new ConnectedMember { Id = member1d.Id, MemberId = new ReferenceElement(member1d), IsContinuous = false, }; connectionPoint.ConnectedMembers.Add(conMb); } BeamData beamData = new BeamData { Id = member1d.Id, Name = element1d.Name, OriginalModelId = member1d.Id.ToString(), // member1d.Name, IsAdded = false, MirrorY = false, RefLineInCenterOfGravity = true, }; if (openModel.Connections.Count == 0) { openModel.Connections.Add(new ConnectionData()); } (openModel.Connections[0].Beams ?? (openModel.Connections[0].Beams = new List <BeamData>())).Add(beamData); } // create Member1D from assemblies /* foreach (var assembly in assemblies) * { * var member1d = new Member1D * { * Id = assembly.OrderNumber.GetValueOrDefault(), * Name = assembly.Name * }; * foreach (var c in assembly.Connections) * { * var ce = c as RelConnectsElements; * var element = openModel.Element1D.Find(x => x.Name == ce.RelatedElement.ToString()); * if (element == null) continue; * member1d.Elements1D.Add(new ReferenceElement(element)); * openModel.Member1D.Add(member1d); * } * }*/ /*if (connectionPoint != null) * { * var p0t = pointConnections.Find(x => x.NodeId.GetValueOrDefault() == ConnectionPointId); * if (p0t != null && p0t.ConnectsStructuralMembers != null) * { * foreach (var cm in p0t.ConnectsStructuralMembers) * { * var member = openModel.Element1D.Find(x => x.Name == cm.RelatingStructuralMember.GetValueOrDefault().ToString()); * if (member == null) * continue; * ConnectedMember conMb = new ConnectedMember * { * Id = member.Id, * MemberId = new ReferenceElement(member), * IsContinuous = false, * }; * connectionPoint.ConnectedMembers.Add(conMb); * * // BEAM DATA - definition * BeamData bData = new BeamData * { * Id = conMb.Id, * OriginalModelId = "???", // ass.Id.ToString(), is it important? * IsAdded = false, * MirrorY = false, * RefLineInCenterOfGravity = false, * }; * if (openModel.Connections.Count == 0) * { * openModel.Connections.Add(new ConnectionData { Beams = new List<BeamData>() }); * } * openModel.Connections[0].Beams.Add(bData); * } * } * * }*/ openModel.AddObject(connectionPoint); // important !!! OpenModelResult openModelResult = new OpenModelResult() { ResultOnMembers = new System.Collections.Generic.List <ResultOnMembers>() { new ResultOnMembers() } }; OpenMessages openMessages = new OpenMessages(); return(new ModelBIM() { Items = new List <BIMItemId>() { new BIMItemId() { Id = connectionPoint.Id, Type = BIMItemType.Node } }, Model = openModel, Results = openModelResult, Messages = openMessages, Project = AllplanBimplusDemo.Properties.Settings.Default.IdeaDefaultWorkingDir, }); } catch (Exception e) { MessageBoxHelper.ShowInformation(e.Message, null); return(null); } }
private void CreateIDEAOpenModelResultsOLD(Joint joint) { Project project = joint.project; openModelResult.ResultOnMembers = new List <ResultOnMembers>(); ResultOnMembers resultIF = new ResultOnMembers(); for (int ibeam = 0; ibeam < openModel.Member1D.Count; ibeam++) { //Continues Chord consist out of one member Member1D mb = openModel.Member1D[ibeam]; for (int iele = 0; iele < mb.Elements1D.Count; iele++) { //Continues chord consist out of two elements Element1D elem = openModel.Element1D.First(a => a.Id == mb.Elements1D[iele].Id); //results on members are constant in the framework ResultOnMember resMember = new ResultOnMember(new Member() { Id = elem.Id, MemberType = MemberType.Element1D }, ResultType.InternalForces); int numPoints = 10; for (int ip = 0; ip <= numPoints; ip++) { ResultOnSection resSec = new ResultOnSection(); resSec.AbsoluteRelative = AbsoluteRelative.Relative; resSec.Position = (double)ip / (double)numPoints; //iterate over loadcases int count = openModel.LoadCase.Count; for (int i = 1; i <= count; i++) { ResultOfInternalForces resLoadCase = new ResultOfInternalForces(); int loadCaseNumber = i; resLoadCase.Loading = new ResultOfLoading() { Id = loadCaseNumber, LoadingType = LoadingType.LoadCase }; resLoadCase.Loading.Items.Add(new ResultOfLoadingItem() { Coefficient = 1.0 }); //Check if Startpoint is equal to centerpoint int GrassId = elem.Id - 1;//Element1D.Id - 1 == ElementRAZ.id int GrassLCId = i - 1; AttachedMember attached = joint.attachedMembers.Find(a => a.ElementRAZ.id == GrassId); //The following if statements simulate that every member has a local coordinate system //where the local z - axis points counterclockwise(shear force) //and where the positive bending moment is clockwise if (attached.isStartPoint == true) { //Pick startloads // API to IDEA UI, My and Vz are plotted negatively double N0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.N; double My0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.My * -1; double Vz0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Vz * -1; double Vy0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Vy; double Mz0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Mz; double Mt0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Mt; //From Karamba3D to Framework double N = N0; double My = My0; double Vz = Vz0; double Vy = Vy0; double Mz = Mz0; double Mt = Mt0; //From Framework to IDEA VectorRAZ unitvector = attached.ideaLine.vector.Unitize();//gaat niet op bij ColumnT-Joint want gebruikt globale asses ipv locale if (unitvector.X < -10e-6) { if (attached is BearingMember) //exception { resLoadCase.N = N; // resLoadCase.My = My * (-1); // in case of start point M of the begin element of the chords needs to be flipped resLoadCase.Qz = Vz * (-1); // resLoadCase.Qy = Vy; resLoadCase.Mz = Mz0; resLoadCase.Mx = Mt; resSec.Results.Add(resLoadCase); } else//members where rule needs to be applied to { resLoadCase.N = N;// resLoadCase.My = My * -1; // resLoadCase.Qz = Vz * -1; // resLoadCase.Qy = Vy; resLoadCase.Mz = Mz0; resLoadCase.Mx = Mt; resSec.Results.Add(resLoadCase); } } else { resLoadCase.N = N; // resLoadCase.My = My; // resLoadCase.Qz = Vz; // resLoadCase.Qy = Vy; resLoadCase.Mz = Mz0; resLoadCase.Mx = Mt; resSec.Results.Add(resLoadCase); } } else//isEndPoint { //Pick endloads //API to IDEA UI, My and Vz are plotted negatively double N0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.N; double My0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.My * -1; double Vz0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Vz * -1; double Vy0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Vy; double Mz0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Mz; double Mt0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Mt; //From Karamba3D to Framework double N = N0; double My = My0 * (-1); //*-1 double Vz = Vz0 * (-1); //*-1 double Vy = Vy0 * (-1); //*-1 double Mz = Mz0 * (-1); //*-1 double Mt = Mt0 * (-1); //*-1 //From Framework to IDEA VectorRAZ unitvector = attached.ideaLine.vector.Unitize();//gaat niet op bij ColumnT-Joint want gebruikt globale asses ipv locale if (unitvector.X < -10e-6) { if (attached is BearingMember) //exception { resLoadCase.N = N; // resLoadCase.My = My * (-1); // in case of start point M of the begin element of the chords needs to be flipped resLoadCase.Qz = Vz * (-1); // resLoadCase.Qy = Vy * (-1); resLoadCase.Mz = Mz0 * (-1); resLoadCase.Mx = Mt * (-1); resSec.Results.Add(resLoadCase); } else//members where rule needs to be applied to { resLoadCase.N = N;// resLoadCase.My = My * (-1); // * (-1) resLoadCase.Qz = Vz * (-1); // * (-1) resLoadCase.Qy = Vy * (-1); resLoadCase.Mz = Mz0 * (-1); resLoadCase.Mx = Mt * (-1); resSec.Results.Add(resLoadCase); } } else { resLoadCase.N = N; // resLoadCase.My = My; // resLoadCase.Qz = Vz; // resLoadCase.Qy = Vy; resLoadCase.Mz = Mz0; resLoadCase.Mx = Mt; resSec.Results.Add(resLoadCase); } } } resMember.Results.Add(resSec); } resultIF.Members.Add(resMember); } } openModelResult.ResultOnMembers.Add(resultIF); }
private void CreateIDEAOpenModelResults(Joint joint) { Project project = joint.project; openModelResult.ResultOnMembers = new List <ResultOnMembers>(); ResultOnMembers resultIF = new ResultOnMembers(); for (int ibeam = 0; ibeam < openModel.Member1D.Count; ibeam++) { //Continues Chord consist out of one member Member1D mb = openModel.Member1D[ibeam]; //Loop is needed in case of a continuous member for (int iele = 0; iele < mb.Elements1D.Count; iele++) { //Continues chord consists out of two elements Element1D elem = openModel.Element1D.First(a => a.Id == mb.Elements1D[iele].Id);//wordt hier de link met het verkeerde element gelegd? //word de verkeerde id toegekent? //results on members are constant in the framework ResultOnMember resMember = new ResultOnMember(new Member() { Id = elem.Id, MemberType = MemberType.Element1D }, ResultType.InternalForces); int numPoints = 10; for (int ip = 0; ip <= numPoints; ip++) { ResultOnSection resSec = new ResultOnSection(); resSec.AbsoluteRelative = AbsoluteRelative.Relative; resSec.Position = (double)ip / (double)numPoints; //iterate over loadcases int count = openModel.LoadCase.Count; for (int i = 1; i <= count; i++) { ResultOfInternalForces resLoadCase = new ResultOfInternalForces(); int loadCaseNumber = i; resLoadCase.Loading = new ResultOfLoading() { Id = loadCaseNumber, LoadingType = LoadingType.LoadCase }; resLoadCase.Loading.Items.Add(new ResultOfLoadingItem() { Coefficient = 1.0 }); //Check if Startpoint is equal to centerpoint int GrassId = elem.Id - 1;//Element1D.Id - 1 == ElementRAZ.id int GrassLCId = i - 1; AttachedMember attached = joint.attachedMembers.Find(a => a.ElementRAZ.id == GrassId); //The following if statements simulate that every member has a local coordinate system //where the local z-axis points counterclockwise (shear force) //and where the positive bending moment is clockwise if (attached.isStartPoint == true) { //Pick startloads //API to IDEA UI, My, Vy and Vz are plotted negatively double N0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.N; double My0 = (-1) * 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.My; double Vz0 = (-1) * 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Vz; double Vy0 = (-1) * 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Vy; double Mz0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Mz; double Mt0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].startLoads.Mt; //From Karamba3D to Framework double N = N0; double My = My0; double Vz = Vz0; double Vy = Vy0; double Mz = Mz0; double Mt = Mt0; resLoadCase.N = N; // resLoadCase.My = My; // resLoadCase.Qz = Vz; // resLoadCase.Qy = Vy; resLoadCase.Mz = Mz; resLoadCase.Mx = Mt; resSec.Results.Add(resLoadCase); } else//isEndPoint { //Pick endloads //API to IDEA UI, My, Vy and Vz are plotted negatively double N0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.N; double My0 = (-1) * 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.My; double Vz0 = (-1) * 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Vz; double Vy0 = (-1) * 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Vy; double Mz0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Mz; double Mt0 = 1000 * joint.project.loadcases[GrassLCId].loadsPerLineRAZs[GrassId].endLoads.Mt; //From Karamba3D to Framework double N = N0 * (-1); double My = My0 * (-1); // double Vz = Vz0 * (-1); double Vy = Vy0 * (-1); double Mz = Mz0 * (-1); // double Mt = Mt0 * (-1); resLoadCase.N = N; // resLoadCase.My = My; // resLoadCase.Qz = Vz; // resLoadCase.Qy = Vy; resLoadCase.Mz = Mz; resLoadCase.Mx = Mt; resSec.Results.Add(resLoadCase); } } resMember.Results.Add(resSec); } resultIF.Members.Add(resMember); } } openModelResult.ResultOnMembers.Add(resultIF); }
private void AddConnectedMember(AttachedMember attachedMember, ConnectionPoint connectionPoint) { PolyLine3D polyLine3D = new PolyLine3D(); polyLine3D.Id = openModel.GetMaxId(polyLine3D) + 1; openModel.AddObject(polyLine3D); //endpoints Point3D pA = openModel.Point3D.First(a => a.Id == attachedMember.ideaLine.Start.id); Point3D pB = openModel.Point3D.First(a => a.Id == attachedMember.ideaLine.End.id); //create line segment LineSegment3D lineSegment = new LineSegment3D(); lineSegment.Id = openModel.GetMaxId(lineSegment) + 1; lineSegment.StartPoint = new ReferenceElement(pA); lineSegment.EndPoint = new ReferenceElement(pB); openModel.AddObject(lineSegment); polyLine3D.Segments.Add(new ReferenceElement(lineSegment)); ///* double xcor = attachedMember.ElementRAZ.line.vector.X; double ycor = attachedMember.ElementRAZ.line.vector.Y; double zcor = attachedMember.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 }; lineSegment.LocalCoordinateSystem = LocalCoordinateSystem; //*/ //create element Element1D element1D = new Element1D(); //element1D.Id = openModel.GetMaxId(element1D) + 1; element1D.Id = attachedMember.ElementRAZ.id + 1; //Use of Id from Grasshopper Model + Plus One element1D.Name = "Element " + element1D.Id.ToString(); element1D.Segment = new ReferenceElement(lineSegment); IdeaRS.OpenModel.CrossSection.CrossSection crossSection = openModel.CrossSection.First(a => a.Id == attachedMember.ElementRAZ.crossSection.id); element1D.CrossSectionBegin = new ReferenceElement(crossSection); element1D.CrossSectionEnd = new ReferenceElement(crossSection); if (attachedMember is ConnectingMember) { ConnectingMember connectingMember = attachedMember as ConnectingMember; double eccentricty = new double(); if (connectingMember.localEccentricity == -0) { eccentricty = 0; } else { eccentricty = connectingMember.localEccentricity; } element1D.EccentricityBeginZ = eccentricty; element1D.EccentricityEndZ = eccentricty; } openModel.AddObject(element1D); //create member Member1D member1D = new Member1D(); member1D.Id = openModel.GetMaxId(member1D) + 1; member1D.Name = "Member " + member1D.Id.ToString(); member1D.Elements1D.Add(new ReferenceElement(element1D)); 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 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 CreateIDEAOpenModelResults(Joint joint) { Project project = joint.project; openModelResult.ResultOnMembers = new List <ResultOnMembers>(); ResultOnMembers resultIF = new ResultOnMembers(); for (int ibeam = 0; ibeam < openModel.Member1D.Count; ibeam++) { //Continues Chord consist out of one member Member1D mb = openModel.Member1D[ibeam]; //Loop is needed in case of a continuous member for (int iele = 0; iele < mb.Elements1D.Count; iele++) { //Continouos chord consists out of two elements Element1D elem = openModel.Element1D.First(a => a.Id == mb.Elements1D[iele].Id);//wordt hier de link met het verkeerde element gelegd? //word de verkeerde id toegekent? //results on members are constant in the framework ResultOnMember resMember = new ResultOnMember(new Member() { Id = elem.Id, MemberType = MemberType.Element1D }, ResultType.InternalForces); int numPoints = 1; for (int ip = 0; ip <= numPoints; ip++) { ResultOnSection resSec = new ResultOnSection(); resSec.AbsoluteRelative = AbsoluteRelative.Relative; resSec.Position = (double)ip / (double)numPoints; //iterate over loadcases int count = openModel.LoadCase.Count; for (int i = 1; i <= count; i++) { ResultOfInternalForces resLoadCase = new ResultOfInternalForces(); int loadCaseNumber = i; resLoadCase.Loading = new ResultOfLoading() { Id = loadCaseNumber, LoadingType = LoadingType.LoadCase }; resLoadCase.Loading.Items.Add(new ResultOfLoadingItem() { Coefficient = 1.0 }); //Check if Startpoint is equal to centerpoint int GrassId = elem.Id - 1; //Element1D.Id - 1 == ElementRAZ.id int GrassLCId = i - 1; //Loadcase grasshopper starts at 0, Loadcase IDEA starts at 1. List <BearingMember> BM = joint.attachedMembers.OfType <BearingMember>().ToList(); //Find the element to check: isStartpoint true or false AttachedMember attached = joint.attachedMembers.Find(a => a.ElementRAZ.id == GrassId); if (attached.isStartPoint == true) // { SetStartLoads(1, joint, GrassLCId, GrassId, resLoadCase, resSec); } else//isEndPoint { if (attached is BearingMember && BM.Count == 2) { SetEndLoads(1, joint, GrassLCId, GrassId, resLoadCase, resSec); } else { SetEndLoads(-1, joint, GrassLCId, GrassId, resLoadCase, resSec); } } } resMember.Results.Add(resSec); } resultIF.Members.Add(resMember); } } openModelResult.ResultOnMembers.Add(resultIF); }
private void AddConnectedMember(AttachedMember attachedMember, ConnectionPoint connectionPoint) { PolyLine3D polyLine3D = new PolyLine3D(); polyLine3D.Id = openModel.GetMaxId(polyLine3D) + 1; openModel.AddObject(polyLine3D); //endpoints Point3D pA = openModel.Point3D.First(a => a.Id == attachedMember.ideaLine.Start.id); Point3D pB = openModel.Point3D.First(a => a.Id == attachedMember.ideaLine.End.id); //create line segment LineSegment3D lineSegment = new LineSegment3D(); lineSegment.Id = openModel.GetMaxId(lineSegment) + 1; lineSegment.StartPoint = new ReferenceElement(pA); lineSegment.EndPoint = new ReferenceElement(pB); openModel.AddObject(lineSegment); polyLine3D.Segments.Add(new ReferenceElement(lineSegment)); SetLCS(attachedMember, lineSegment); //create element Element1D element1D = new Element1D(); //element1D.Id = openModel.GetMaxId(element1D) + 1; element1D.Id = attachedMember.ElementRAZ.id + 1; //Use of Id from Grasshopper Model + Plus One element1D.Name = "Element " + element1D.Id.ToString(); element1D.Segment = new ReferenceElement(lineSegment); IdeaRS.OpenModel.CrossSection.CrossSection crossSection = openModel.CrossSection.First(a => a.Id == attachedMember.ElementRAZ.crossSection.id); element1D.CrossSectionBegin = new ReferenceElement(crossSection); element1D.CrossSectionEnd = new ReferenceElement(crossSection); //element1D.RotationRx = attachedMember.ElementRAZ.rotationLCS; if (attachedMember is ConnectingMember) { ConnectingMember connectingMember = attachedMember as ConnectingMember; double eccentricty = new double(); if (connectingMember.localEccentricity == -0) { eccentricty = 0; } else { eccentricty = connectingMember.localEccentricity; } element1D.EccentricityBeginZ = eccentricty; element1D.EccentricityEndZ = eccentricty; } openModel.AddObject(element1D); //create member Member1D member1D = new Member1D(); member1D.Id = openModel.GetMaxId(member1D) + 1; member1D.Name = "Member " + member1D.Id.ToString(); member1D.Elements1D.Add(new ReferenceElement(element1D)); 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); }