/***************************************************/ /**** Private methods ****/ /***************************************************/ private List <ISurfaceProperty> ReadSurfaceProperties(List <string> ids = null) { List <ISurfaceProperty> surfacePropList = new List <ISurfaceProperty>(); if (ids == null) { foreach (rf.Surface surface in modelData.GetSurfaces()) { IMaterialFragment material = modelData.GetMaterial(surface.MaterialNo, rf.ItemAt.AtNo).GetData().FromRFEM(); rf.ISurface s = modelData.GetSurface(surface.No, rf.ItemAt.AtNo); rf.IOrthotropicThickness ortho = s.GetOrthotropicThickness(); rf.SurfaceStiffness stiffness = ortho.GetData(); ISurfaceProperty surfaceProperty = stiffness.FromRFEM(material); surfacePropList.Add(surfaceProperty); /* * int srfThickId = srfThickness.No; * if (!m_sectionDict.ContainsKey(srfThickId)) * { * m_sectionDict.Add(srfThickId, srfProp); * } */ } } else { foreach (string id in ids) { } } return(surfacePropList); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static ISurfaceProperty FromRFEM(this rf.SurfaceStiffness rfStiffness, IMaterialFragment material) { ISurfaceProperty surfaceProperty = null; switch (rfStiffness.Type) { case rf.OrthotropyType.ConstantThickness: surfaceProperty = new ConstantThickness { Thickness = rfStiffness.Thickness, Material = material }; break; case rf.OrthotropyType.UnidirectionalRibbedPlate: surfaceProperty = new Ribbed { Thickness = rfStiffness.Thickness, TotalDepth = rfStiffness.GeometricProperties.Height, Spacing = rfStiffness.GeometricProperties.Spacing, StemWidth = rfStiffness.GeometricProperties.Width, Material = material }; break; case rf.OrthotropyType.BidirectionalRibbedPlate: surfaceProperty = new Waffle { Thickness = rfStiffness.Thickness, TotalDepthX = rfStiffness.GeometricProperties.HeightX, TotalDepthY = rfStiffness.GeometricProperties.HeightY, SpacingX = rfStiffness.GeometricProperties.SpacingX, SpacingY = rfStiffness.GeometricProperties.SpacingY, StemWidthX = rfStiffness.GeometricProperties.WidthX, StemWidthY = rfStiffness.GeometricProperties.WidthY }; break; case rf.OrthotropyType.UnknownOrthotropyType: case rf.OrthotropyType.EffectiveThickness: case rf.OrthotropyType.DefinedByStiffnessMatrix: case rf.OrthotropyType.Coupling: case rf.OrthotropyType.TrapezoidalSheet: case rf.OrthotropyType.HollowCoreSlab: case rf.OrthotropyType.Grillage: case rf.OrthotropyType.UnidirectionalBoxFloor: case rf.OrthotropyType.Glass: case rf.OrthotropyType.Laminate: surfaceProperty = new ConstantThickness { Thickness = rfStiffness.Thickness, Material = material }; Engine.Base.Compute.RecordError("could not create surface property for " + rfStiffness.ID); break; default: surfaceProperty = new ConstantThickness { Thickness = rfStiffness.Thickness, Material = material }; Engine.Base.Compute.RecordError("could not create surface property for " + rfStiffness.ID); break; } surfaceProperty.SetAdapterId(typeof(RFEMId), rfStiffness.No); return(surfaceProperty); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static rf.SurfaceStiffness ToRFEM(this ISurfaceProperty surfaceProperty) { rf.SurfaceStiffness stiffness = new rf.SurfaceStiffness(); if (surfaceProperty is LoadingPanelProperty) { Engine.Base.Compute.RecordWarning("sorry, Can't do loding panels"); } else { if (surfaceProperty is ConstantThickness) { ConstantThickness constantThickness = surfaceProperty as ConstantThickness; stiffness.Type = rf.OrthotropyType.ConstantThickness; stiffness.Thickness = constantThickness.Thickness; stiffness.MultiplicationFactors.K = 1.0; stiffness.MultiplicationFactors.K33 = 1.0; stiffness.MultiplicationFactors.K44 = 1.0; stiffness.MultiplicationFactors.K55 = 1.0; stiffness.MultiplicationFactors.Kb = 1.0; stiffness.MultiplicationFactors.Ke = 1.0; stiffness.MultiplicationFactors.Km = 1.0; stiffness.MultiplicationFactors.Ks = 1.0; } else if (surfaceProperty is Ribbed) { Ribbed prop = surfaceProperty as Ribbed; stiffness.Type = rf.OrthotropyType.UnidirectionalRibbedPlate; stiffness.Thickness = prop.Thickness; stiffness.GeometricProperties.Height = prop.TotalDepth; stiffness.GeometricProperties.Spacing = prop.Spacing; stiffness.GeometricProperties.Width = prop.StemWidth; stiffness.GeometricProperties.Thickness = prop.Thickness; stiffness.MultiplicationFactors.K = 1.0; stiffness.MultiplicationFactors.K33 = 1.0; stiffness.MultiplicationFactors.K44 = 1.0; stiffness.MultiplicationFactors.K55 = 1.0; stiffness.MultiplicationFactors.Kb = 1.0; stiffness.MultiplicationFactors.Ke = 1.0; stiffness.MultiplicationFactors.Km = 1.0; stiffness.MultiplicationFactors.Ks = 1.0; } else if (surfaceProperty is Waffle) { Waffle prop = surfaceProperty as Waffle; stiffness.Type = rf.OrthotropyType.BidirectionalRibbedPlate; stiffness.Thickness = prop.Thickness; stiffness.GeometricProperties.HeightX = prop.TotalDepthX; stiffness.GeometricProperties.HeightY = prop.TotalDepthY; stiffness.GeometricProperties.SpacingX = prop.SpacingX; stiffness.GeometricProperties.SpacingY = prop.SpacingY; stiffness.GeometricProperties.WidthX = prop.StemWidthX; stiffness.GeometricProperties.WidthY = prop.StemWidthY; stiffness.GeometricProperties.Thickness = prop.Thickness; stiffness.MultiplicationFactors.K = 1.0; stiffness.MultiplicationFactors.K33 = 1.0; stiffness.MultiplicationFactors.K44 = 1.0; stiffness.MultiplicationFactors.K55 = 1.0; stiffness.MultiplicationFactors.Kb = 1.0; stiffness.MultiplicationFactors.Ke = 1.0; stiffness.MultiplicationFactors.Km = 1.0; stiffness.MultiplicationFactors.Ks = 1.0; } else { Engine.Base.Compute.RecordWarning("my responses are limited. I don't know: " + surfaceProperty.Name); } } return(stiffness); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private bool CreateCollection(IEnumerable <Panel> panels) { if (panels.Count() > 0) { int panelIdNum = 0; List <Panel> panelList = panels.ToList(); rf.Surface[] rfSurfaces = new rf.Surface[panelList.Count()]; for (int i = 0; i < panels.Count(); i++) { panelIdNum = GetAdapterId <int>(panelList[i]); //get ids outside of BHoM process - might need to be changed int lastLineId = modelData.GetLastObjectNo(rf.ModelObjectType.LineObject); int[] boundaryIdArr = new int[panelList[i].ExternalEdges.Count()]; //create outline List <string> outlineNodeList = new List <string>(); foreach (Edge e in panelList[i].ExternalEdges) { //create rfem nodes, i.e. bhom points - NOTE: RFEM will remove the coincident points itself leaving jumps in node numbering ! 1,2,4,6,8,10,... Line edgeAsLine = e.Curve as Line; rf.Node rfNode1 = new rf.Node { No = (int)this.NextFreeId(typeof(Node)), X = edgeAsLine.Start.X, Y = edgeAsLine.Start.Y, Z = edgeAsLine.Start.Z }; modelData.SetNode(rfNode1); outlineNodeList.Add(rfNode1.No.ToString()); } outlineNodeList.Add(outlineNodeList[0]); rf.Line outline = new rf.Line() { No = lastLineId + 1, Type = rf.LineType.PolylineType, NodeList = String.Join(",", outlineNodeList) }; modelData.SetLine(outline); rfSurfaces[i] = panelList[i].ToRFEM(panelIdNum, new int[] { outline.No }); if (rfSurfaces[i].StiffnessType == rf.SurfaceStiffnessType.StandardStiffnessType) { modelData.SetSurface(rfSurfaces[i]); } else { rf.SurfaceStiffness stiffness = panelList[i].Property.ToRFEM(); rfSurfaces[i].Thickness.Constant = stiffness.Thickness; rf.ISurface srf = modelData.SetSurface(rfSurfaces[i]); rf.IOrthotropicThickness ortho = srf.GetOrthotropicThickness(); ortho.SetData(stiffness); } } } return(true); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private List <Panel> ReadPanels(List <string> ids = null) { List <Panel> panelList = new List <Panel>(); ISurfaceProperty surfaceProperty; if (ids == null) { foreach (rf.Surface surface in modelData.GetSurfaces()) { if (surface.GeometryType != rf.SurfaceGeometryType.PlaneSurfaceType) { Engine.Base.Compute.RecordError("Only plane surface types are supported at the moment"); } List <Edge> edgeList = GetEdgesFromRFEMSurface(surface); IMaterialFragment material = modelData.GetMaterial(surface.MaterialNo, rf.ItemAt.AtNo).GetData().FromRFEM(); if (surface.StiffnessType == rf.SurfaceStiffnessType.StandardStiffnessType) { surfaceProperty = new ConstantThickness { Thickness = surface.Thickness.Constant, Material = material }; } else if (surface.StiffnessType == rf.SurfaceStiffnessType.OrthotropicStiffnessType) { rf.ISurface s = modelData.GetSurface(surface.No, rf.ItemAt.AtNo); rf.IOrthotropicThickness ortho = s.GetOrthotropicThickness(); rf.SurfaceStiffness stiffness = ortho.GetData(); surfaceProperty = stiffness.FromRFEM(material); } else { surfaceProperty = null; Engine.Base.Compute.RecordError("could not create surface property of type " + surface.StiffnessType.ToString()); } List <Opening> openings = null; Panel panel = Engine.Structure.Create.Panel(edgeList, openings, surfaceProperty); panelList.Add(panel); } } else { foreach (string id in ids) { rf.Surface surface = modelData.GetSurface(Int32.Parse(id), rf.ItemAt.AtNo).GetData(); if (surface.GeometryType != rf.SurfaceGeometryType.PlaneSurfaceType) { Engine.Base.Compute.RecordError("Only plane surface types are supported at the moment"); } List <Edge> edgeList = GetEdgesFromRFEMSurface(surface); IMaterialFragment material = modelData.GetMaterial(surface.MaterialNo, rf.ItemAt.AtNo).GetData().FromRFEM(); rf.ISurface s = modelData.GetSurface(surface.No, rf.ItemAt.AtNo); rf.IOrthotropicThickness ortho = s.GetOrthotropicThickness(); rf.SurfaceStiffness stiffness = ortho.GetData(); surfaceProperty = stiffness.FromRFEM(material); List <Opening> openings = null; Panel panel = Engine.Structure.Create.Panel(edgeList, openings, surfaceProperty); panelList.Add(panel); } } return(panelList); }