private void CreateIDEAOpenModelConnection() { ConnectionPoint connection = new ConnectionPoint(); connection.Node = new ReferenceElement(openStructModel.Point3D.First(n => n.Id == 3)); connection.Id = 1; connection.Name = "Con " + "N3"; ConnectedMember conMb1 = AddConnectedMember(1, 1, 1, 3, 5); ConnectedMember conMb2 = AddConnectedMember(2, 1, 2, 3); ConnectedMember conMb3 = AddConnectedMember(3, 1, 3, 4); connection.ConnectedMembers.Add(conMb1); connection.ConnectedMembers.Add(conMb2); connection.ConnectedMembers.Add(conMb3); openStructModel.AddObject(connection); connection = new ConnectionPoint(); connection.Node = new ReferenceElement(openStructModel.Point3D.First(n => n.Id == 6)); connection.Id = 2; connection.Name = "Con " + "N6"; ConnectedMember con2Mb1 = AddConnectedMember(4, 1, 4, 6); ConnectedMember con2Mb2 = AddConnectedMember(5, 1, 5, 6); connection.ConnectedMembers.Add(con2Mb1); connection.ConnectedMembers.Add(con2Mb2); openStructModel.AddObject(connection); }
/// <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); }
/// <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 columnCss = model.CrossSection.FirstOrDefault(item => item.Name == "125TFB"); var beamCss = model.CrossSection.FirstOrDefault(item => item.Name == "100TFB"); // member - column ConnectedMember column = Helpers.CreateMember(model, 1, Member1DType.Column, columnCss, "N1", "N2", "N3"); // member - beam ConnectedMember beam = Helpers.CreateMember(model, 2, Member1DType.Beam, beamCss, "N2", "N4"); // add members to the model model.AddObject(column); model.AddObject(beam); //// create the connection point in the node N2 //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(column); //CP1.ConnectedMembers.Add(beam); //model.AddObject(CP1); }
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); }
/// <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); }
private void NewConnection(int idMember, int idCss, int idPointA, int idPointB) { ConnectionPoint connection = new ConnectionPoint(); connection.Node = new ReferenceElement(openStructModel.Point3D.First(n => n.Id == idPointA)); connection.Id = idPointA; connection.Name = "Con " + "N" + idPointA.ToString(); ConnectedMember conMb = AddConnectedMember(idMember, idCss, idPointA, idPointB); connection.ConnectedMembers.Add(conMb); openStructModel.AddObject(connection); }
private void CreateIDEAOpenModelConnection() { ConnectionPoint connection = new ConnectionPoint(); connection.Node = new ReferenceElement(openStructModel.Point3D.First(n => n.Id == 2)); connection.Id = 1; connection.Name = "Con " + "N2"; ConnectedMember conMb1 = AddConnectedMember(1, 1, 1, 2); ConnectedMember conMb2 = AddConnectedMember(2, 2, 2, 3); connection.ConnectedMembers.Add(conMb1); connection.ConnectedMembers.Add(conMb2); openStructModel.AddObject(connection); }
/// <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 void CreateIDEAOpenModelConnection() { ConnectionPoint connection = new ConnectionPoint(); connection.Node = new ReferenceElement(openStructModel.Point3D.First(n => n.Id == 2)); connection.Id = 1; connection.Name = "Con " + "N3"; ConnectedMember conMb1 = AddConnectedMember3point(1, 2, 1, 2, 3); ConnectedMember conMb2 = AddConnectedMember2point(2, 3, 2, 4, 0); ConnectedMember conMb3 = AddConnectedMember2point(3, 3, 2, 5, 0); ConnectedMember conMb4 = AddConnectedMember2point(4, 3, 2, 6, 0); connection.ConnectedMembers.Add(conMb1); connection.ConnectedMembers.Add(conMb2); connection.ConnectedMembers.Add(conMb3); connection.ConnectedMembers.Add(conMb4); openStructModel.AddObject(connection); }
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 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 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); }