/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static IMaterialFragment FromRFEM(this rf.Material material) { IMaterialFragment bhMaterial = null; string[] stringArr = material.TextID.Split('@'); MaterialType matType = material.GetMaterialType();// Engine.Adapters.RFEM.Query.GetMaterialType(material); string matName = Engine.Adapters.RFEM.Query.GetMaterialName(material); switch (matType) { case MaterialType.Aluminium: bhMaterial = Engine.Structure.Create.Aluminium(matName); break; case MaterialType.Steel: bhMaterial = Engine.Structure.Create.Steel(matName); break; case MaterialType.Concrete: bhMaterial = Engine.Structure.Create.Concrete(matName); break; case MaterialType.Timber: //TODO: as this uses vector over double assumption is the the below turns Timber into an incorrect Isotropic material !!! BH.oM.Geometry.Vector young = new oM.Geometry.Vector() { X = material.ElasticityModulus, Y = material.ElasticityModulus, Z = material.ElasticityModulus }; BH.oM.Geometry.Vector poissons = new oM.Geometry.Vector() { X = material.PoissonRatio, Y = material.PoissonRatio, Z = material.PoissonRatio }; BH.oM.Geometry.Vector shear = new oM.Geometry.Vector() { X = material.ShearModulus, Y = material.ShearModulus, Z = material.ShearModulus }; BH.oM.Geometry.Vector thermal = new oM.Geometry.Vector() { X = material.ThermalExpansion, Y = material.ThermalExpansion, Z = material.ThermalExpansion }; bhMaterial = Engine.Structure.Create.Timber(matName, young, poissons, shear, thermal, material.SpecificWeight, 0.05); break; case MaterialType.Rebar: case MaterialType.Tendon: case MaterialType.Glass: case MaterialType.Cable: case MaterialType.Undefined: default: break; } bhMaterial.SetAdapterId(typeof(RFEMId), material.No); return(bhMaterial); }
/***************************************************/ private ISectionProperty GetSectionProperty(int crossSectionNumber) { ISectionProperty sectionProperty; if (!m_sectionDict.TryGetValue(crossSectionNumber, out sectionProperty)) { rf.ICrossSection rfISection = modelData.GetCrossSection(crossSectionNumber, rf.ItemAt.AtNo); rf.CrossSection rfSection = rfISection.GetData(); rf.Material rfMat = modelData.GetMaterial(rfSection.MaterialNo, rf.ItemAt.AtNo).GetData(); sectionProperty = rfISection.FromRFEM(rfMat); m_sectionDict.Add(crossSectionNumber, sectionProperty); } return(sectionProperty); }
public static string GetMaterialName(rf.Material rfMaterial) { string materialName; string[] materialString = rfMaterial.TextID.Split('@'); if (materialString.Length < 2) { materialName = rfMaterial.Description; } else { materialName = materialString[0].Split('|')[1]; } return(materialName); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ //Text ID contains the following parameters: //• NameID - Language independent name of the material according to the German terminology. //• TypeID - Language independent type of the material. //• NormID - Language independent code of the material. //Format: NameID|material ID@TypeID|material type@NormID|material code //Example: NameID|Steel S 235@TypeID|STEEL@StandardID|DIN EN 1993-1-1-10 public static MaterialType GetMaterialType(this rf.Material rfMaterial) { string[] materialString = rfMaterial.TextID.Split('@'); if (materialString.Count() < 2) { Engine.Base.Compute.RecordWarning("Don't know how to make" + rfMaterial.TextID + ". Steel created instead!"); return(MaterialType.Steel); } switch (materialString[1]) { case "TypeID|STEEL": return(MaterialType.Steel); case "TypeID|ALUMINIUM": return(MaterialType.Aluminium); case "TypeID|CONCRETE": return(MaterialType.Concrete); case "TypeID|TIMBER": case "TypeID|CONIFEROUS": return(MaterialType.Timber); case "TypeID|CABLE": return(MaterialType.Cable); case "TypeID|GLASS": return(MaterialType.Glass); case "TypeID|REBAR": return(MaterialType.Rebar); case "TypeID|TENDON": return(MaterialType.Tendon); default: Engine.Base.Compute.RecordWarning("Don't know how to make: " + materialString[1]); return(MaterialType.Undefined); } }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private bool CreateCollection(IEnumerable <IMaterialFragment> materialFragments) { if (materialFragments.Count() > 0) { int idNum = 0; List <IMaterialFragment> matList = materialFragments.ToList(); rf.Material[] rfMaterials = new rf.Material[matList.Count()]; for (int i = 0; i < matList.Count(); i++) { idNum = GetAdapterId <int>(matList[i]);// NextId(matList[i].GetType())); rfMaterials[i] = matList[i].ToRFEM(idNum); modelData.SetMaterial(rfMaterials[i]); } //modelData.SetMaterials(rfMaterials); } return(true); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ //The List<string> in the methods below can be changed to a list of any type of identification more suitable for the toolkit //If no ids are provided, the convention is to return all elements of the type private List <ISectionProperty> ReadSectionProperties(List <string> ids = null) { List <ISectionProperty> sectionPropList = new List <ISectionProperty>(); //ReadSectionFromRFEMLibrary("IPE 200"); if (ids == null) { foreach (rf.CrossSection rfSection in modelData.GetCrossSections()) { rf.Material rfMaterial = modelData.GetMaterial(rfSection.MaterialNo, rf.ItemAt.AtNo).GetData(); rf.ICrossSection rfISection = modelData.GetCrossSection(rfSection.No, rf.ItemAt.AtNo); ISectionProperty section = rfISection.FromRFEM(rfMaterial); sectionPropList.Add(section); int sectionId = rfSection.No; if (!m_sectionDict.ContainsKey(sectionId)) { m_sectionDict.Add(sectionId, section); } } } else { foreach (string id in ids) { rf.ICrossSection rfISection = modelData.GetCrossSection(Int32.Parse(id), rf.ItemAt.AtNo); rf.CrossSection rfSection = rfISection.GetData(); rf.Material rfMaterial = modelData.GetMaterial(rfSection.MaterialNo, rf.ItemAt.AtNo).GetData(); sectionPropList.Add(rfISection.FromRFEM(rfMaterial)); } } return(sectionPropList); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static ISectionProperty FromRFEM(this rf.ICrossSection rfISectionProperty, rf.Material rfMaterial) { rf.CrossSection rfSectionProperty = rfISectionProperty.GetData(); string sectionName = rfSectionProperty.Description; rf3.DB_CRSC_PROPERTY[] sectionDBProps = null; object libraryObj = null; if (sectionName != "") { try { libraryObj = rfISectionProperty.GetDatabaseCrossSection(); rf3.IrfCrossSectionDB sectionFromDB = libraryObj as rf3.IrfCrossSectionDB; int propCount = sectionFromDB.rfGetPropertyCount(); sectionDBProps = new rf3.DB_CRSC_PROPERTY[propCount]; sectionFromDB.rfGetPropertyArrAll(propCount, sectionDBProps); } catch { Engine.Base.Compute.RecordWarning("Could not create section named " + sectionName + " from library parameters. Best guess on name will be used"); } } IMaterialFragment materialFragment = rfMaterial.FromRFEM(); IProfile profile = Engine.Adapters.RFEM.Compute.GetSectionProfile(sectionName, sectionDBProps); if (profile != null) { IGeometricalSection geoSection = BH.Engine.Structure.Create.SectionPropertyFromProfile(profile, materialFragment, rfSectionProperty.TextID);// this creates the right property if the right material is provided geoSection.SetAdapterId(typeof(RFEMId), rfSectionProperty.No); geoSection.Name = rfSectionProperty.TextID; return(geoSection); } else { ExplicitSection expSection = new ExplicitSection(); expSection.Material = materialFragment; expSection.Area = rfSectionProperty.AxialArea; expSection.J = rfSectionProperty.TorsionMoment; expSection.Asy = rfSectionProperty.ShearAreaY; expSection.Asz = rfSectionProperty.ShearAreaZ; expSection.Iy = rfSectionProperty.BendingMomentY; expSection.Iz = rfSectionProperty.BendingMomentZ; expSection.SetAdapterId(typeof(RFEMId), rfSectionProperty.No); expSection.Name = rfSectionProperty.TextID; return(expSection); } }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static rf.Material ToRFEM(this IMaterialFragment materialFragment, int materialId) { //Example: NameID|Steel S 235@TypeID|STEEL@StandardID|DIN EN 1993-1-1-10 rf.Material rfMaterial = new rf.Material(); rfMaterial.No = materialId; rfMaterial.Description = materialFragment.Name; rfMaterial.SpecificWeight = materialFragment.Density * 10; //translate from kg/m3 to kN/m3 if (materialFragment.GetType() == typeof(Aluminium)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | ALUMINIUM" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(Steel)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | STEEL" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(Concrete)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | CONCRETE" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(GenericIsotropicMaterial)) { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | STEEL" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(Timber)) { //TODO: this looks like orthotropic is turned into isotropic !!! IOrthotropic material = materialFragment as IOrthotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff.X; rfMaterial.PoissonRatio = material.PoissonsRatio.Y; rfMaterial.ElasticityModulus = material.YoungsModulus.Z; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | TIMBER" + "@StandardID | No norm set!"; } else if (materialFragment.GetType() == typeof(GenericOrthotropicMaterial)) { IOrthotropic material = materialFragment as IOrthotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff.X; rfMaterial.PoissonRatio = material.PoissonsRatio.Y; rfMaterial.ElasticityModulus = material.YoungsModulus.Z; rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | TIMBER" + "@StandardID | No norm set!"; } else { IIsotropic material = materialFragment as IIsotropic; rfMaterial.ThermalExpansion = material.ThermalExpansionCoeff; rfMaterial.PoissonRatio = material.PoissonsRatio; rfMaterial.ElasticityModulus = material.YoungsModulus; Engine.Base.Compute.RecordWarning("Cannot make " + materialFragment.Name + ". Replaced with standard steel"); rfMaterial.TextID = "NameID | " + materialFragment.Name + "@TypeID | STEEL" + "@StandardID | No norm set!"; } return(rfMaterial); }
private List <Dlubal.RFEM5.Surface> CreateRfemSurfaces(List <Rhino.Geometry.Brep> Rh_Srf, double srfThicknessInMethod, string srfMaterialTextDescription, string srfCommentMethodIn) { //cycling through all Surfaces and creating RFEM objects; int nodeCount = 1; int lineCount = 1; int surfaceCount = 1; //list for curves describing surface edges List <Rhino.Geometry.Curve> RhSimpleLines = new List <Rhino.Geometry.Curve>(); //lists for nodes, lines and surfaces to be created List <Dlubal.RFEM5.Node> RfemNodeList = new List <Dlubal.RFEM5.Node>(); List <Dlubal.RFEM5.Line> RfemLineList = new List <Dlubal.RFEM5.Line>(); List <Dlubal.RFEM5.Surface> RfemSurfaceList = new List <Dlubal.RFEM5.Surface>(); //---- Interface with RFEM, getting available element numbers ---- #region Interface with RFEM, getting available element numbers // Gets interface to running RFEM application. IApplication app = Marshal.GetActiveObject("RFEM5.Application") as IApplication; // Locks RFEM licence app.LockLicense(); // Gets interface to active RFEM model. IModel model = app.GetActiveModel(); // Gets interface to model data. IModelData data = model.GetModelData(); // Gets Max node, line , surface support numbers int currentNewNodeNo = data.GetLastObjectNo(ModelObjectType.NodeObject) + 1; int currentNewLineNo = data.GetLastObjectNo(ModelObjectType.LineObject) + 1; int currentNewSurfaceNo = data.GetLastObjectNo(ModelObjectType.SurfaceObject) + 1; int currentNewMaterialNo = data.GetLastObjectNo(ModelObjectType.MaterialObject) + 1; #endregion // Defines material used for all surfaces Dlubal.RFEM5.Material material = new Dlubal.RFEM5.Material(); material.No = currentNewMaterialNo; material.TextID = srfMaterialTextDescription; material.ModelType = MaterialModelType.IsotropicLinearElasticType; //start cycling through all surfaces foreach (Rhino.Geometry.Brep RhSingleSurface in Rh_Srf) { #region simplification of perimeter edges // clearing previous surface data before starting to work on new surface: RhSimpleLines.Clear(); //simplifying edges - adding to array; Rhino.Geometry.Curve[] curves = RhSingleSurface.DuplicateEdgeCurves(true); curves = Rhino.Geometry.Curve.JoinCurves(curves); foreach (Rhino.Geometry.Curve RhSingleCurve in curves) { if (RhSingleCurve.IsPolyline()) { if (RhSingleCurve.SpanCount == 1) { //if this is simple linear line RhSimpleLines.Add(RhSingleCurve); } else { foreach (Rhino.Geometry.Curve explodedSurface in RhSingleCurve.DuplicateSegments()) { //if this is polyline RhSimpleLines.Add(explodedSurface); } } } else { foreach (Rhino.Geometry.Curve explodedLine in RhSingleCurve.ToPolyline(0, 0, 3.14, 1, 0, 0, 0, segmentLength, true).DuplicateSegments()) { //if this is curved lines RhSimpleLines.Add(explodedLine); } } #endregion int surfaceNodeCounter = 0; //counts nodes witin one surface. nodeCount counts overall nodes in model int surfaceLineCounter = 0; // counts lines (edges) for one surface, lineCount counts overall lines in model //cycling through perimeter of the surface and defining lines surface #region Defining nodes and lines for one surface for (int i = 0; i < RhSimpleLines.Count; i++) { //defining variables needed to store geometry and RFEM info Rhino.Geometry.Point3d startPoint = RhSimpleLines[i].PointAtStart; Rhino.Geometry.Point3d endPoint = RhSimpleLines[i].PointAtEnd; //if this is the first line for the surface if (i == 0) { // defining start and end nodes of the line Dlubal.RFEM5.Node tempCurrentStartNode = new Dlubal.RFEM5.Node(); Dlubal.RFEM5.Node tempCurrentEndNode = new Dlubal.RFEM5.Node(); tempCurrentStartNode.No = currentNewNodeNo; tempCurrentStartNode.X = Math.Round(startPoint.X, 5); tempCurrentStartNode.Y = Math.Round(startPoint.Y, 5); tempCurrentStartNode.Z = Math.Round(startPoint.Z, 5); tempCurrentEndNode.No = currentNewNodeNo + 1; tempCurrentEndNode.X = Math.Round(endPoint.X, 5); tempCurrentEndNode.Y = Math.Round(endPoint.Y, 5); tempCurrentEndNode.Z = Math.Round(endPoint.Z, 5); RfemNodeList.Add(tempCurrentStartNode); RfemNodeList.Add(tempCurrentEndNode); // defining line Dlubal.RFEM5.Line tempCurrentLine = new Dlubal.RFEM5.Line(); tempCurrentLine.No = currentNewLineNo; tempCurrentLine.Type = LineType.PolylineType; tempCurrentLine.NodeList = $"{tempCurrentStartNode.No}, {tempCurrentEndNode.No}"; RfemLineList.Add(tempCurrentLine); nodeCount = nodeCount + 2; surfaceNodeCounter = surfaceNodeCounter + 2; lineCount++; surfaceLineCounter++; currentNewNodeNo = currentNewNodeNo + 2; currentNewLineNo++; } //if this is the last node for the surface else if (i == RhSimpleLines.Count - 1) { //no need to define new node as these are both already defined //create line connecting previous node with first node for surface // defining start and end nodes of the line Dlubal.RFEM5.Line tempCurrentLine = new Dlubal.RFEM5.Line(); tempCurrentLine.No = currentNewLineNo; tempCurrentLine.Type = LineType.PolylineType; tempCurrentLine.NodeList = $"{RfemNodeList[RfemNodeList.Count - 1].No}, {RfemNodeList[RfemNodeList.Count - surfaceNodeCounter].No}"; RfemLineList.Add(tempCurrentLine); lineCount++; surfaceLineCounter++; currentNewLineNo++; } else { //if this is just a node somewhere on edges //defining end node of line Dlubal.RFEM5.Node tempCurrentEndNode = new Dlubal.RFEM5.Node(); // defining start and end nodes of the line Dlubal.RFEM5.Line tempCurrentLine = new Dlubal.RFEM5.Line(); tempCurrentEndNode.No = currentNewNodeNo; tempCurrentEndNode.X = Math.Round(endPoint.X, 5); tempCurrentEndNode.Y = Math.Round(endPoint.Y, 5); tempCurrentEndNode.Z = Math.Round(endPoint.Z, 5); RfemNodeList.Add(tempCurrentEndNode); tempCurrentLine.No = currentNewLineNo; tempCurrentLine.Type = LineType.PolylineType; tempCurrentLine.NodeList = $"{RfemNodeList[RfemNodeList.Count - 2].No}, {RfemNodeList[RfemNodeList.Count - 1].No}"; RfemLineList.Add(tempCurrentLine); nodeCount++; surfaceNodeCounter++; lineCount++; surfaceLineCounter++; currentNewNodeNo++; currentNewLineNo++; } } #endregion //defines surface data #region Defining data of the surface to be written // start with making a string with "list" of lines forming the surface int surfaceFirstLine = currentNewLineNo - RhSimpleLines.Count; int surfaceLastLine = surfaceFirstLine + RhSimpleLines.Count - 1; string surfaceLineList = ""; for (int i = surfaceFirstLine; i < surfaceLastLine; i++) { surfaceLineList = surfaceLineList + i.ToString() + ","; } surfaceLineList = surfaceLineList + surfaceLastLine.ToString(); // defining RFEM parameter of surface Dlubal.RFEM5.Surface surfaceData = new Dlubal.RFEM5.Surface(); surfaceData.No = currentNewSurfaceNo; surfaceData.MaterialNo = material.No; surfaceData.GeometryType = SurfaceGeometryType.PlaneSurfaceType; surfaceData.BoundaryLineList = surfaceLineList; surfaceData.Comment = srfCommentMethodIn; // if -1 is input as thickness, surface is created as rigid, otherwise it is "standard" if (srfThicknessInMethod == -1) { surfaceData.StiffnessType = SurfaceStiffnessType.RigidStiffnessType; } else if (srfThicknessInMethod == 0) { surfaceData.StiffnessType = SurfaceStiffnessType.NullStiffnessType; } else { surfaceData.StiffnessType = SurfaceStiffnessType.StandardStiffnessType; surfaceData.Thickness.Constant = srfThicknessInMethod; } //adding surface to elements to be written RfemSurfaceList.Add(surfaceData); surfaceCount++; currentNewSurfaceNo++; #endregion } } //try writing the surface; #region Writing the surface and releasing RFEM model try { //prepares model for modification. data.PrepareModification(); data.SetMaterial(material); //This version writes nodes one-by-one because the data.SetNodes() for array appears not to be working foreach (Node currentRfemNode in RfemNodeList) { data.SetNode(currentRfemNode); } //This version writes lines one-by-one because the data.SetLines() for array appears not to be working foreach (Dlubal.RFEM5.Line currentRfemLine in RfemLineList) { data.SetLine(currentRfemLine); } //This version writes lines one-by-one because the data.SetLines() for array appears not to be working foreach (Dlubal.RFEM5.Surface currentRfemSurface in RfemSurfaceList) { data.SetSurface(currentRfemSurface); } //finishes modifications - regenerates numbering etc. data.FinishModification(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error - Surface Write", MessageBoxButtons.OK, MessageBoxIcon.Error); } //resetting counters; nodeCount = 1; lineCount = 1; surfaceCount = 1; // Releases interface to RFEM model. model = null; // Unlocks licence and releases interface to RFEM application. if (app != null) { app.UnlockLicense(); app = null; } // Cleans Garbage Collector and releases all cached COM interfaces. System.GC.Collect(); System.GC.WaitForPendingFinalizers(); #endregion //output 'success' as true writeSuccess = true; ///the Surfaces below outputs created RFEM surfaces in output parameter ///current funcionality does not use this return(RfemSurfaceList); }
private List <Dlubal.RFEM5.Member> CreateRfemMembers(List <Dlubal.RFEM5.Line> rfemLineMethodIn, string sectionIdMethodIn, string materialIdMethodIn, Dlubal.RFEM5.MemberHinge rfemHingeStartMethodIn, Dlubal.RFEM5.MemberHinge rfemHingeEndMethodIn, double rotationMethodIn, string commentsListMethodIn) { //---- Interface with RFEM, getting available element numbers ---- #region Estabilishing connection with RFEM, getting available element numbers // Gets interface to running RFEM application. IApplication app = Marshal.GetActiveObject("RFEM5.Application") as IApplication; // Locks RFEM licence app.LockLicense(); // Gets interface to active RFEM model. IModel model = app.GetActiveModel(); // Gets interface to model data. IModelData data = model.GetModelData(); // Gets Max node, line , line support numbers int currentNewMemberNo = data.GetLastObjectNo(ModelObjectType.MemberObject) + 1; int currentNewSectionNo = data.GetLastObjectNo(ModelObjectType.CrossSectionObject) + 1; int currentNewMaterialNo = data.GetLastObjectNo(ModelObjectType.MaterialObject) + 1; int currentNewHingeNo = data.GetLastObjectNo(ModelObjectType.MemberHingeObject) + 1; #endregion //---- Defining material, cross section and releases ---- #region Defining material, cross section and releases //define material Dlubal.RFEM5.Material material = new Dlubal.RFEM5.Material(); material.No = currentNewMaterialNo; material.TextID = materialIdMethodIn; material.ModelType = MaterialModelType.IsotropicLinearElasticType; //define cross section CrossSection tempCrossSection = new CrossSection(); tempCrossSection.No = currentNewSectionNo; tempCrossSection.TextID = sectionIdMethodIn; tempCrossSection.MaterialNo = currentNewMaterialNo; //define member hinge numbers if (rfemHingeStartInput.No != -1) { rfemHingeStartInput.No = currentNewHingeNo; } if (rfemHingeEndInput.No != -1) { rfemHingeEndMethodIn.No = currentNewHingeNo + 1; } #endregion //---- Process all lines and create members on those ---- #region Processing all lines, creating RFEM member objects for (int i = 0; i < rfemLineMethodIn.Count; i++) { //test if line exists try { data.GetLine(rfemLineMethodIn[i].No, ItemAt.AtNo); } catch { continue; } //assign member properties Dlubal.RFEM5.Member tempMember = new Dlubal.RFEM5.Member(); tempMember.No = currentNewMemberNo; tempMember.LineNo = rfemLineMethodIn[i].No; tempMember.EndCrossSectionNo = currentNewSectionNo; tempMember.StartCrossSectionNo = currentNewSectionNo; tempMember.TaperShape = TaperShapeType.Linear; tempMember.Rotation.Type = RotationType.Angle; tempMember.Rotation.Angle = rotationMethodIn * (Math.PI / 180); if (rfemHingeStartInput.No != -1) { tempMember.StartHingeNo = currentNewHingeNo; } if (rfemHingeEndInput.No != -1) { tempMember.EndHingeNo = currentNewHingeNo + 1; } tempMember.Comment = commentsListMethodIn; // if -1 is input as section, member is created as rigid, otherwise it is "standard" if (sectionIdInput == "-1") { tempMember.Type = MemberType.Rigid; } else if (sectionIdInput == "0") { tempMember.Type = MemberType.NullMember; } else { tempMember.Type = MemberType.Beam; } RfemMemberList.Add(tempMember); currentNewMemberNo++; } #endregion //---- Writing information in RFEM ---- #region Writing info to RFEM try { // modification - set model in modification mode, new information can be written data.PrepareModification(); //set material, cross section and start&end hinges if (sectionIdInput != "-1") { data.SetMaterial(material); data.SetCrossSection(tempCrossSection); } if (rfemHingeStartInput.No != -1) { data.SetMemberHinge(rfemHingeStartInput); } if (rfemHingeEndInput.No != -1) { data.SetMemberHinge(rfemHingeEndMethodIn); } //This version writes members one-by-one because the data.SetNodes() for array appears not to be working //data.SetMembers(RfemMembers); foreach (Member currentRfemMember in RfemMemberList) { data.SetMember(currentRfemMember); } // finish modification - RFEM regenerates the data data.FinishModification(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error - Member Write", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion //---- Releases interface to RFEM model ----- #region Releasing interface to RFEM model = null; // Unlocks licence and releases interface to RFEM application. if (app != null) { app.UnlockLicense(); app = null; } // Cleans Garbage Collector and releases all cached COM interfaces. System.GC.Collect(); System.GC.WaitForPendingFinalizers(); #endregion //output 'success' as true and return member list writeSuccess = true; return(RfemMemberList); }