/***************************************************/ private IFAttribute CreateSurfraceProfile(ConstantThickness thickness, string lusasName) { IFGeometricSurface lusasGeometricSurface = d_LusasData.createGeometricSurface(lusasName); lusasGeometricSurface.setValue("t", thickness.Thickness); return(lusasGeometricSurface); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private bool CreateCollection(IEnumerable <ISurfaceProperty> srfProps) { foreach (ISurfaceProperty srfProp in srfProps) { RAMId RAMId = new RAMId(); if (srfProp is Ribbed) { Ribbed compProp = (Ribbed)srfProp; ICompDeckProp ramProp; //Validity check for ribbed properties thickness above flutes if (compProp.Thickness < 2.0.FromInch()) { Engine.Base.Compute.RecordError("Deck property " + srfProp.Name + " has an invalid thickness. Thickness was automatically changed to 2 inches in order to ensure required shear stud engagement per RAM."); compProp.Thickness = 2.0.FromInch(); } ICompDeckProps compDeckProps = m_Model.GetCompositeDeckProps(); try { ramProp = compDeckProps.Add2(compProp.Name, Engine.Base.Query.PropertyValue(compProp, "DeckProfileName").ToString(), compProp.Thickness.ToInch(), compProp.TotalDepth.ToInch() - 1.5); } catch { Engine.Base.Compute.RecordWarning("Deck label for surface property " + srfProp.Name + " not found or invalid for specified thickness. Using default deck profile. Please provide a valid deck name from the RAM Deck Table as a property on the SurfaceProperty named DeckProfileName."); ramProp = compDeckProps.Add2(compProp.Name, "ASC 3W", compProp.Thickness.ToInch(), 4.5); } RAMId.Id = ramProp.lUID; } else if (srfProp is ConstantThickness && !(srfProp.Material is Steel)) { ConstantThickness prop = (ConstantThickness)srfProp; if (prop.PanelType != PanelType.Wall) //Wall surface properties are created on a per wall element basis { IConcSlabProps concSlabProps = m_Model.GetConcreteSlabProps(); IConcSlabProp ramProp; ramProp = concSlabProps.Add(prop.Name, prop.Thickness.ToInch(), prop.Material.Density.ToPoundPerCubicFoot()); RAMId.Id = ramProp.lUID; } } else if (srfProp is ConstantThickness && srfProp.Material is Steel) { ConstantThickness prop = (ConstantThickness)srfProp; if (prop.PanelType != PanelType.Wall) //Wall surface properties are created on a per wall element basis { INonCompDeckProps nonCompDeckProps = m_Model.GetNonCompDeckProps(); INonCompDeckProp ramProp; ramProp = nonCompDeckProps.Add(prop.Name); ramProp.dEffectiveThickness = prop.Thickness.ToInch(); RAMId.Id = ramProp.lUID; } } srfProp.SetAdapterId(RAMId); } //Save file m_IDBIO.SaveDatabase(); return(true); }
public static string Description(this ConstantThickness property) { if (property == null) { return("null property"); } return($"THK {property.Thickness:G3} - {CheckGetMaterialName(property.Material)}"); }
/***************************************************/ private bool CreateObject(ISurfaceProperty property2d) { bool success = true; int retA = 0; string propertyName = property2d.Name;// property2d.CustomData[AdapterId].ToString(); ETABS2016.eShellType shellType = property2d.EtabsShellType(); if (property2d.GetType() == typeof(Waffle)) { Waffle waffleProperty = (Waffle)property2d; m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Waffle, shellType, property2d.Material.Name, waffleProperty.Thickness); retA = m_model.PropArea.SetSlabWaffle(propertyName, waffleProperty.TotalDepthX, waffleProperty.Thickness, waffleProperty.StemWidthX, waffleProperty.StemWidthX, waffleProperty.SpacingX, waffleProperty.SpacingY); } else if (property2d.GetType() == typeof(Ribbed)) { Ribbed ribbedProperty = (Ribbed)property2d; m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Ribbed, shellType, property2d.Material.Name, ribbedProperty.Thickness); retA = m_model.PropArea.SetSlabRibbed(propertyName, ribbedProperty.TotalDepth, ribbedProperty.Thickness, ribbedProperty.StemWidth, ribbedProperty.StemWidth, ribbedProperty.Spacing, (int)ribbedProperty.Direction); } else if (property2d.GetType() == typeof(LoadingPanelProperty)) { retA = m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Slab, shellType, property2d.Material.Name, 0); } else if (property2d.GetType() == typeof(ConstantThickness)) { ConstantThickness constantThickness = (ConstantThickness)property2d; if (constantThickness.PanelType == PanelType.Wall) { retA = m_model.PropArea.SetWall(propertyName, ETABS2016.eWallPropType.Specified, shellType, property2d.Material.Name, constantThickness.Thickness); } else { retA = m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Slab, shellType, property2d.Material.Name, constantThickness.Thickness); } } if (property2d.HasModifiers()) { double[] modifier = property2d.Modifiers();//(double[])property2d.CustomData["Modifiers"]; m_model.PropArea.SetModifiers(propertyName, ref modifier); } if (retA != 0) { success = false; } return(success); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static ISurfaceProperty ToSurfaceProperty(this IFAttribute lusasAttribute) { string attributeName = GetName(lusasAttribute); ISurfaceProperty surfaceProperty = new ConstantThickness { Name = attributeName, Thickness = lusasAttribute.getValue("t") }; int adapterNameId = lusasAttribute.getID(); surfaceProperty.SetAdapterId(typeof(LusasId), adapterNameId); return(surfaceProperty); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private bool CreateCollection(IEnumerable <Panel> bhomPanels) { //Code for creating a collection of floors and walls in the software List <Panel> panels = bhomPanels.ToList(); // Register Floor types IFloorType ramFloorType; IStories ramStories; IStory ramStory; //Create wall and floor lists with individual heights List <Panel> wallPanels = new List <Panel>(); List <Panel> floors = new List <Panel>(); List <double> panelHeights = new List <double>(); List <Point> panelPoints = new List <Point>(); // Split walls and floors and get all elevations foreach (Panel panel in panels) { double panelNormZ = panel.Normal().Z; //Split walls and floors if (Math.Abs(panelNormZ) < 0.707) // check normal against 45 degree slope { wallPanels.Add(panel); } else { floors.Add(panel); } } ramStories = m_Model.GetStories(); #region Create Floors // Cycle through floors and create on story foreach (Panel panel in floors) { RAMId RAMId = new RAMId(); string name = panel.Name; PolyCurve outlineExternal = panel.OutlineCurve(); ramStory = panel.GetStory(ramStories); ramFloorType = ramStory.GetFloorType(); try { // Set slab edges on FloorType in RAM for external edges ISlabEdges ramSlabEdges = ramFloorType.GetAllSlabEdges(); ISlabEdges ramOpeningEdges = ramFloorType.GetAllSlabOpenings(); // Get external and internal edges of floor panel List <PolyCurve> panelOutlines = new List <PolyCurve>(); List <PolyCurve> openingOutlines = new List <PolyCurve>(); Vector zDown = BH.Engine.Geometry.Create.Vector(0, 0, -1); // RAM requires edges clockwise, flip if counterclockwise PolyCurve cwOutline = (outlineExternal.IsClockwise(zDown) == false) ? outlineExternal.Flip() : outlineExternal; List <ICurve> edgeCrvs = cwOutline.Curves; foreach (ICurve crv in edgeCrvs) { Point startPt = crv.IStartPoint(); Point endPt = crv.IEndPoint(); ramSlabEdges.Add(startPt.X.ToInch(), startPt.Y.ToInch(), endPt.X.ToInch(), endPt.Y.ToInch(), 0); } List <Opening> panelOpenings = panel.Openings; foreach (Opening opening in panelOpenings) { PolyCurve outlineOpening = opening.OutlineCurve(); openingOutlines.Add(outlineOpening); } foreach (PolyCurve outline in openingOutlines) { // RAM requires edges clockwise, flip if counterclockwise PolyCurve cwOpenOutline = (outline.IsClockwise(zDown) == false) ? outline.Flip() : outline; if (!(outlineExternal.IsContaining(cwOpenOutline, false))) { cwOpenOutline = outlineExternal.BooleanIntersection(cwOpenOutline)[0]; Engine.Base.Compute.RecordWarning("Panel " + name + " opening intersects floor boundary. Boolean intersection was used to get opening extents on panel, confirm opening extents in RAM."); } List <ICurve> openEdgeCrvs = cwOpenOutline.Curves; foreach (ICurve crv in openEdgeCrvs) { Point startPt = crv.IStartPoint(); Point endPt = crv.IEndPoint(); ramOpeningEdges.Add(startPt.X.ToInch(), startPt.Y.ToInch(), endPt.X.ToInch(), endPt.Y.ToInch(), 0); } } // Create Deck List <Point> ctrlPoints = cwOutline.ControlPoints(); if (ctrlPoints.First() != ctrlPoints.Last()) { ctrlPoints.Add(ctrlPoints.Last().DeepClone()); } ISurfaceProperty srfProp = panel.Property; int deckProplUID = GetAdapterId <int>(srfProp); //Add decks, then set deck points per outline IDecks ramDecks = ramFloorType.GetDecks(); IDeck ramDeck = ramDecks.Add(deckProplUID, ctrlPoints.Count); IPoints ramPoints = ramDeck.GetPoints(); // Create list of SCoordinates for floor outlines List <SCoordinate> cornersExt = new List <SCoordinate>(); foreach (Point point in ctrlPoints) { SCoordinate cornerExt = point.ToRAM(); cornersExt.Add(cornerExt); } for (int k = 0; k < cornersExt.Count; k++) { ramPoints.Delete(k); ramPoints.InsertAt(k, cornersExt[k]); } ramDeck.SetPoints(ramPoints); // Add warning to report floors flattened to level as required for RAM if (Math.Abs(panel.Normal().Z) < 1) { Engine.Base.Compute.RecordWarning("Panel " + name + " snapped to level " + ramStory.strLabel + "."); } } catch { CreateElementError("panel", name); } } #endregion #region Create Walls //Cycle through walls; if wall crosses level place at level foreach (Panel wallPanel in wallPanels) { string name = wallPanel.Name; try { double thickness = 0.2; // default thickness if (wallPanel.Property is ConstantThickness) { ConstantThickness prop = (ConstantThickness)wallPanel.Property; thickness = prop.Thickness; } // Find outline of planar panel PolyCurve outline = BH.Engine.Spatial.Query.OutlineCurve(wallPanel); List <Point> wallPts = outline.DiscontinuityPoints(); List <Point> sortedWallPts = wallPts.OrderBy(p => p.X).ToList(); Point leftPt = sortedWallPts.First(); Point rtPt = sortedWallPts.Last(); bool downToRight = leftPt.Y > rtPt.Y; BoundingBox wallBounds = BH.Engine.Geometry.Query.Bounds(outline); Point wallMin = wallBounds.Min; Point wallMax = wallBounds.Max; double tempY = wallMin.Y; wallMin.Y = downToRight ? wallMax.Y : wallMin.Y; wallMax.Y = downToRight ? tempY : wallMax.Y; for (int i = 0; i < ramStories.GetCount(); i++) { ramStory = ramStories.GetAt(i); // If wall crosses level, add wall to ILayoutWalls for that level if (Math.Round(wallMax.Z.ToInch(), 0) >= ramStory.dElevation && Math.Round(wallMin.Z.ToInch(), 0) < ramStory.dElevation) { ramFloorType = ramStory.GetFloorType(); //Get ILayoutWalls of FloorType and add wall ILayoutWalls ramLayoutWalls = ramFloorType.GetLayoutWalls(); ILayoutWall ramLayoutWall = ramLayoutWalls.Add(EMATERIALTYPES.EWallPropConcreteMat, wallMin.X.ToInch(), wallMin.Y.ToInch(), 0, 0, wallMax.X.ToInch(), wallMax.Y.ToInch(), 0, 0, thickness.ToInch()); //Set lateral ramLayoutWall.eFramingType = EFRAMETYPE.MemberIsLateral; IWalls ramWalls = ramLayoutWall.GetAssociatedStoryWalls(); IWall ramWall = ramWalls.GetAt(0); // Find opening location, width, and height from outline and apply foreach (Opening open in wallPanel.Openings) { PolyCurve openOutline = open.OutlineCurve(); BoundingBox openBounds = BH.Engine.Geometry.Query.Bounds(openOutline); Point openMin = openBounds.Min; Point openMax = openBounds.Max; if ((openMin.Z.ToInch() >= ramStory.dElevation - ramStory.dFlrHeight) && (openMin.Z.ToInch() < ramStory.dElevation)) { IFinalWallOpenings ramWallOpenings = ramWall.GetFinalOpenings(); int openOverlapCount = 0; for (int j = 0; i < ramWallOpenings.GetCount(); j++) { IFinalWallOpening testOpen = ramWallOpenings.GetAt(j); IPoints openingPts = testOpen.GetOpeningVertices(); //Re-add first point to close Polygon IPoint firstOPt = openingPts.GetAt(0); SCoordinate firstOCoord = new SCoordinate(); firstOPt.GetCoordinate(ref firstOCoord); openingPts.Add(firstOCoord); Polyline wallOpeningOutline = openingPts.ToPolyline(); List <Point> intPts = wallOpeningOutline.ICurveIntersections(openOutline); if (wallOpeningOutline.IsContaining(openOutline) || openOutline.IsContaining(wallOpeningOutline) || intPts.Count > 0) { openOverlapCount += 1; } } if (openOverlapCount == 0) { //Get opening on wall extents if (!(outline.IsContaining(openOutline, false))) { openOutline = outline.BooleanIntersection(openOutline)[0]; Engine.Base.Compute.RecordWarning("Panel " + name + " opening intersects wall boundary. Boolean intersection was used to get opening extents on panel."); } Point closestOpenPt = BH.Engine.Geometry.Query.ClosestPoint(wallMin, openOutline.ControlPoints()); double distX = Math.Sqrt(Math.Pow(closestOpenPt.X - wallMin.X, 2) + Math.Pow(closestOpenPt.Y - wallMin.Y, 2)); double distZinch = openBounds.Min.Z.ToInch() - (ramStory.dElevation - ramStory.dFlrHeight); double openWidth = Math.Sqrt(Math.Pow(openBounds.Max.X - openBounds.Min.X, 2) + Math.Pow(openBounds.Max.Y - openBounds.Min.Y, 2)); double openHt = openBounds.Max.Z - openBounds.Min.Z; //Add opening to RAM IRawWallOpenings ramRawWallOpenings = ramWall.GetRawOpenings(); ramRawWallOpenings.Add(EDA_MEMBER_LOC.eBottomStart, distX.ToInch(), distZinch, openWidth.ToInch(), openHt.ToInch()); } } } } } } catch { CreateElementError("panel", name); } } #endregion //Save file m_IDBIO.SaveDatabase(); return(true); }
/***************************************************/ /**** 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); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private List <ISurfaceProperty> ReadSurfaceProperty(List <string> ids = null) { List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>(); Dictionary <string, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => GetAdapterId <string>(x)); int nameCount = 0; string[] nameArr = { }; m_model.PropArea.GetNameList(ref nameCount, ref nameArr); ids = FilterIds(ids, nameArr); foreach (string id in ids) { int shellType = 0; bool includeDrillingDOF = true; string materialName = ""; double matAng = 0; double thickness = 0; double bending = 0; int color = 0; string notes = ""; string guid = null; SAP2000Id sap2000id = new SAP2000Id(); sap2000id.Id = id; if (m_model.PropArea.GetShell_1(id, ref shellType, ref includeDrillingDOF, ref materialName, ref matAng, ref thickness, ref bending, ref color, ref notes, ref guid) != 0) { Engine.Base.Compute.RecordWarning($"Error while pulling Surface Property {id}. Check results carefully."); } ConstantThickness bhSurfProp = new ConstantThickness(); bhSurfProp.Name = id; bhSurfProp.Thickness = thickness; bhSurfProp.CustomData.Add("MaterialAngle", matAng); bhSurfProp.CustomData.Add("BendingThickness", bending); bhSurfProp.CustomData.Add("Color", color); bhSurfProp.CustomData.Add("Notes", notes); bhSurfProp.CustomData.Add("GUID", guid); IMaterialFragment bhMat = new GenericIsotropicMaterial(); bhomMaterials.TryGetValue(materialName, out bhMat); bhSurfProp.Material = bhMat; double[] modifiers = new double[6]; if (m_model.PropArea.GetModifiers(id, ref modifiers) == 0) { SurfacePropertyModifier modifier = new SurfacePropertyModifier { FXX = modifiers[0], FYY = modifiers[1], FXY = modifiers[2], MXX = modifiers[3], MYY = modifiers[4], MXY = modifiers[5], VXZ = modifiers[6], VYZ = modifiers[7], Mass = modifiers[8], Weight = modifiers[9] }; bhSurfProp.Fragments.Add(modifier); } bhSurfProp.SetAdapterId(sap2000id); propertyList.Add(bhSurfProp); } return(propertyList); }
/***************************************************/ /*** Create Methods ***/ /***************************************************/ private bool CreateObject(ISurfaceProperty property2d) { bool success = true; int retA = 0; string propertyName = property2d.DescriptionOrName(); SetAdapterId(property2d, propertyName); string materialName = ""; if (CheckPropertyWarning(property2d, p => p.Material)) { materialName = GetAdapterId <string>(property2d.Material) ?? ""; } eShellType shellType = ShellTypeToCSI(property2d); if (property2d.GetType() == typeof(Waffle)) { Waffle waffleProperty = (Waffle)property2d; m_model.PropArea.SetSlab(propertyName, eSlabType.Waffle, shellType, materialName, waffleProperty.Thickness); retA = m_model.PropArea.SetSlabWaffle(propertyName, waffleProperty.TotalDepthX, waffleProperty.Thickness, waffleProperty.StemWidthX, waffleProperty.StemWidthX, waffleProperty.SpacingX, waffleProperty.SpacingY); } else if (property2d.GetType() == typeof(Ribbed)) { Ribbed ribbedProperty = (Ribbed)property2d; m_model.PropArea.SetSlab(propertyName, eSlabType.Ribbed, shellType, materialName, ribbedProperty.Thickness); retA = m_model.PropArea.SetSlabRibbed(propertyName, ribbedProperty.TotalDepth, ribbedProperty.Thickness, ribbedProperty.StemWidth, ribbedProperty.StemWidth, ribbedProperty.Spacing, (int)ribbedProperty.Direction); } else if (property2d.GetType() == typeof(LoadingPanelProperty)) { retA = m_model.PropArea.SetSlab(propertyName, eSlabType.Slab, shellType, materialName, 0); } else if (property2d.GetType() == typeof(ConstantThickness)) { ConstantThickness constantThickness = (ConstantThickness)property2d; if (constantThickness.PanelType == PanelType.Wall) { retA = m_model.PropArea.SetWall(propertyName, eWallPropType.Specified, shellType, materialName, constantThickness.Thickness); } else { retA = m_model.PropArea.SetSlab(propertyName, eSlabType.Slab, shellType, materialName, constantThickness.Thickness); } } SurfacePropertyModifier modifier = property2d.FindFragment <SurfacePropertyModifier>(); if (modifier != null) { double[] modifiers = new double[] { modifier.FXX, modifier.FYY, modifier.FXY, modifier.MXX, modifier.MYY, modifier.MXY, modifier.VXZ, modifier.VYZ, modifier.Mass, modifier.Weight }; m_model.PropArea.SetModifiers(propertyName, ref modifiers); } if (retA != 0) { success = false; } return(success); }
/***************************************************/ /**** Public Methods - Surface Properties ****/ /***************************************************/ public static string Description(this ConstantThickness property) { return("THK " + property.Thickness + " - " + CheckGetMaterialName(property.Material)); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static ISurfaceProperty SurfacePropertyFromRevit(this HostObjAttributes hostObjAttributes, string materialGrade = null, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null) { Document document = hostObjAttributes.Document; settings = settings.DefaultIfNull(); string refId = hostObjAttributes.Id.ReferenceIdentifier(materialGrade); ConstantThickness property2D = refObjects.GetValue <ConstantThickness>(refId); if (property2D != null) { return(property2D); } IMaterialFragment materialFragment = null; double thickness = 0; IList <CompoundStructureLayer> compoundStructure = hostObjAttributes.GetCompoundStructure()?.GetLayers(); if (compoundStructure != null) { bool composite = false; bool nonStructuralLayers = false; foreach (CompoundStructureLayer csl in compoundStructure) { if (csl.Function == MaterialFunctionAssignment.Structure) { if (thickness != 0) { composite = true; thickness = 0; break; } thickness = csl.Width.ToSI(UnitType.UT_Section_Dimension); Material revitMaterial = document.GetElement(csl.MaterialId) as Material; if (revitMaterial == null) { revitMaterial = hostObjAttributes.Category.Material; } materialFragment = revitMaterial.MaterialFragmentFromRevit(materialGrade, settings, refObjects); if (materialFragment == null) { BH.Engine.Reflection.Compute.RecordWarning("There is a structural layer in wall/floor type without material assigned. A default empty material is returned. ElementId: " + hostObjAttributes.Id.IntegerValue.ToString()); materialFragment = Autodesk.Revit.DB.Structure.StructuralMaterialType.Undefined.EmptyMaterialFragment(materialGrade); } } else if (csl.Function == MaterialFunctionAssignment.StructuralDeck) { BH.Engine.Reflection.Compute.RecordWarning(String.Format("A structural deck layer has been found in the Revit compound structure, but was ignored on convert. Revit ElementId: {0}", hostObjAttributes.Id)); } else { nonStructuralLayers = true; } } if (nonStructuralLayers) { BH.Engine.Reflection.Compute.RecordWarning(String.Format("Layers marked as nonstructural have been found in the Revit compound structure and were ignored on convert. Revit ElementId: {0}", hostObjAttributes.Id)); } if (composite) { hostObjAttributes.CompositePanelWarning(); } else if (thickness == 0) { BH.Engine.Reflection.Compute.RecordWarning(string.Format("A zero thickness panel is created. Element type Id: {0}", hostObjAttributes.Id.IntegerValue)); } } else { BH.Engine.Reflection.Compute.RecordWarning(String.Format("Revit panel type does not contain any layers (possibly it is a curtain panel). A BHoM panel type with zero thickness and no material is returned. Revit ElementId: {0}", hostObjAttributes.Id)); } oM.Structure.SurfaceProperties.PanelType panelType = oM.Structure.SurfaceProperties.PanelType.Undefined; if (hostObjAttributes is WallType) { panelType = oM.Structure.SurfaceProperties.PanelType.Wall; } else if (hostObjAttributes is FloorType) { panelType = oM.Structure.SurfaceProperties.PanelType.Slab; } property2D = new ConstantThickness { PanelType = panelType, Thickness = thickness, Material = materialFragment, Name = hostObjAttributes.Name }; //Set identifiers, parameters & custom data property2D.SetIdentifiers(hostObjAttributes); property2D.CopyParameters(hostObjAttributes, settings.ParameterSettings); property2D.SetProperties(hostObjAttributes, settings.ParameterSettings); refObjects.AddOrReplace(refId, property2D); return(property2D); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private List <Panel> ReadPanels(List <string> ids = null) { //Get dictionary of surface properties with ids Dictionary <string, ISurfaceProperty> bhomProperties = ReadISurfaceProperties().ToDictionary(x => GetAdapterId(x).ToString()); //Implement code for reading panels List <Panel> bhomPanels = new List <Panel>(); //Get stories IStories IStories = m_Model.GetStories(); int numStories = IStories.GetCount(); // Get all elements on each story for (int i = 0; i < numStories; i++) { //Get Walls IWalls IWalls = IStories.GetAt(i).GetWalls(); int numWalls = IWalls.GetCount(); // Convert Walls for (int j = 0; j < numWalls; j++) { IWall IWall = IWalls.GetAt(j); Panel Panel = BH.Adapter.RAM.Convert.ToBHoMObject(IWall); bhomPanels.Add(Panel); } //Get Floors IStory IStory = IStories.GetAt(i); IFloorType IFloorType = IStory.GetFloorType(); IDecks IDecks = IFloorType.GetDecks(); int IStoryUID = IStory.lUID; int numDecks = IDecks.GetCount(); if (numDecks > 0) { // Convert Floors for (int j = 0; j < numDecks; j++) { IDeck IDeck = IDecks.GetAt(j); Panel panel = BH.Adapter.RAM.Convert.ToBHoMObject(IDeck, m_Model, IStoryUID); if (panel != null) { ISurfaceProperty bhProp = new ConstantThickness(); bhomProperties.TryGetValue(IDeck.lPropID.ToString(), out bhProp); if (bhProp != null) { panel.Property = bhProp; } else { Engine.Base.Compute.RecordWarning($"Could not get property for floor with RAM lUID = {IDeck.lUID}"); } bhomPanels.Add(panel); } } } else { BH.Engine.Base.Compute.RecordWarning("This story has no slab edges defined. IStoryUID: " + IStoryUID); break; } } return(bhomPanels); }
/***************************************************/ public static Panel ToBHoMObject(this IWall ramWall) { //Find corner points of wall in RAM model SCoordinate TopstartPt = new SCoordinate(); SCoordinate TopendPt = new SCoordinate(); SCoordinate BottomstartPt = new SCoordinate(); SCoordinate BottomendPt = new SCoordinate(); ramWall.GetEndCoordinates(ref TopstartPt, ref TopendPt, ref BottomstartPt, ref BottomendPt); // Create list of points List <Point> corners = new List <Point>(); corners.Add(TopstartPt.PointFromRAM()); corners.Add(TopendPt.PointFromRAM()); corners.Add(BottomendPt.PointFromRAM()); corners.Add(BottomstartPt.PointFromRAM()); corners.Add(TopstartPt.PointFromRAM()); // Create outline from corner points Polyline outline = new Polyline(); outline.ControlPoints = corners; //Create opening outlines List <ICurve> wallOpeningPLs = new List <ICurve>(); List <Opening> bhomWallOpenings = new List <Opening>(); // Create openings IFinalWallOpenings IFinalWallOpenings = ramWall.GetFinalOpenings(); IRawWallOpenings rawOpenings = ramWall.GetRawOpenings(); if (rawOpenings.GetCount() > 0) { IRawWallOpening check = rawOpenings.GetAt(0); } for (int i = 0; i < IFinalWallOpenings.GetCount(); i++) { IFinalWallOpening IFinalWallOpening = IFinalWallOpenings.GetAt(i); IPoints openingPts = IFinalWallOpening.GetOpeningVertices(); //Re-add first point to close Polygon IPoint firstOPt = openingPts.GetAt(0); SCoordinate firstOCoord = new SCoordinate(); firstOPt.GetCoordinate(ref firstOCoord); openingPts.Add(firstOCoord); ICurve wallOpeningOutline = ToPolyline(openingPts); Opening bhomOpening = Engine.Structure.Create.Opening(wallOpeningOutline); bhomWallOpenings.Add(bhomOpening); } // Create wall Panel bhomPanel = Engine.Structure.Create.Panel(outline, bhomWallOpenings); HashSet <String> tag = new HashSet <string>(); tag.Add("Wall"); //Get wall section property ConstantThickness wall2DProp = new ConstantThickness(); string wallLabel = ""; double wallThickness = ramWall.dThickness.FromInch(); IMaterialFragment Material = null; if (ramWall.eMaterial == EMATERIALTYPES.EWallPropConcreteMat) { wallLabel = "Concrete " + ramWall.dThickness.ToString() + " in"; Material = Engine.Structure.Create.Concrete("Concrete"); } else { wallLabel = "Other " + ramWall.dThickness.ToString() + " in"; Material = Engine.Structure.Create.Concrete("Other"); } wall2DProp.Name = wallLabel; wall2DProp.Thickness = wallThickness; wall2DProp.PanelType = PanelType.Wall; wall2DProp.Material = Material; bhomPanel.Property = wall2DProp; bhomPanel.Tags = tag; bhomPanel.Name = ramWall.lLabel.ToString(); // Add custom data RAMId RAMId = new RAMId(); RAMId.Id = ramWall.lUID; bhomPanel.SetAdapterId(RAMId); bhomPanel.Tags.Add("Wall"); return(bhomPanel); }
public static double AverageThickness(this ConstantThickness property) { return(property.IsNull() ? 0 : property.Thickness); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private List <Panel> ReadPanel(List <string> ids = null) { List <Panel> bhomPanels = new List <Panel>(); Dictionary <string, Node> bhomNodes = ReadNodes().ToDictionary(x => GetAdapterId <string>(x)); Dictionary <string, ISurfaceProperty> bhomProperties = ReadSurfaceProperty().ToDictionary(x => GetAdapterId <string>(x)); int nameCount = 0; string[] nameArr = { }; m_model.AreaObj.GetNameList(ref nameCount, ref nameArr); ids = FilterIds(ids, nameArr); foreach (string id in ids) { Panel bhomPanel = new Panel(); SAP2000Id sap2000id = new SAP2000Id(); string guid = null; //Set the Adapter ID sap2000id.Id = id; //Get outline of panel string[] pointNames = null; int pointCount = 0; if (m_model.AreaObj.GetPoints(id, ref pointCount, ref pointNames) == 0) { List <Point> pts = new List <Point>(); foreach (string name in pointNames) { pts.Add(bhomNodes[name].Position); } pts.Add(pts[0]); Polyline outline = new Polyline() { ControlPoints = pts }; List <Edge> outEdges = new List <Edge>() { new Edge { Curve = outline, Release = new oM.Structure.Constraints.Constraint4DOF() } }; bhomPanel.ExternalEdges = outEdges; } //There are no openings in SAP2000 bhomPanel.Openings = new List <Opening>(); //Get the section property string propertyName = ""; if (m_model.AreaObj.GetProperty(id, ref propertyName) == 0) { ISurfaceProperty bhProp = new ConstantThickness(); bhomProperties.TryGetValue(propertyName, out bhProp); bhomPanel.Property = bhProp; } //Get the groups the panel is assigned to int numGroups = 0; string[] groupNames = new string[0]; if (m_model.AreaObj.GetGroupAssign(id, ref numGroups, ref groupNames) == 0) { foreach (string grpName in groupNames) { bhomPanel.Tags.Add(grpName); } } if (m_model.AreaObj.GetGUID(id, ref guid) == 0) { sap2000id.PersistentId = guid; } bhomPanel.SetAdapterId(sap2000id); //Add the panel to the list bhomPanels.Add(bhomPanel); } return(bhomPanels); }
/***************************************************/ private List <ISurfaceProperty> ReadProperty2d(List <string> ids = null) { List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>(); int nameCount = 0; string[] nameArr = { }; if (ids == null) { m_model.PropArea.GetNameList(ref nameCount, ref nameArr); ids = nameArr.ToList(); } foreach (string id in ids) { ISurfaceProperty bhProperty = null; eSlabType slabType = eSlabType.Slab; eShellType shellType = eShellType.ShellThin; eWallPropType wallType = eWallPropType.Specified; string material = ""; double thickness = 0; int colour = 0; string notes = ""; string guid = ""; double depth = 0; double stemWidthTop = 0; double stemWidthBottom = 0;//not used double ribSpacing = 0; double ribSpacing2nd = 0; int direction = 0; double[] modifiers = new double[] { }; bool hasModifiers = false; int ret = m_model.PropArea.GetSlab(id, ref slabType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); if (ret != 0) { m_model.PropArea.GetWall(id, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); } if (m_model.PropArea.GetModifiers(id, ref modifiers) == 0) { hasModifiers = true; } if (wallType == eWallPropType.AutoSelectList) { string[] propList = null; string currentProperty = ""; m_model.PropArea.GetWallAutoSelectList(id, ref propList, ref currentProperty); m_model.PropArea.GetWall(currentProperty, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); ConstantThickness panelConstant = new ConstantThickness(); panelConstant.Name = currentProperty; panelConstant.CustomData[AdapterId] = id; panelConstant.Material = ReadMaterials(new List <string>() { material })[0]; panelConstant.Thickness = thickness; panelConstant.PanelType = PanelType.Wall; SetShellType(panelConstant, shellType); if (hasModifiers) { panelConstant.CustomData.Add("Modifiers", modifiers); } propertyList.Add(panelConstant); } else { switch (slabType) { case eSlabType.Ribbed: Ribbed panelRibbed = new Ribbed(); m_model.PropArea.GetSlabRibbed(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref direction); panelRibbed.Name = id; panelRibbed.CustomData[AdapterId] = id; panelRibbed.Material = ReadMaterials(new List <string>() { material })[0]; panelRibbed.Thickness = thickness; panelRibbed.PanelType = PanelType.Slab; panelRibbed.Direction = (PanelDirection)direction; panelRibbed.Spacing = ribSpacing; panelRibbed.StemWidth = stemWidthTop; panelRibbed.TotalDepth = depth; SetShellType(panelRibbed, shellType); if (hasModifiers) { panelRibbed.CustomData.Add("Modifiers", modifiers); } propertyList.Add(panelRibbed); break; case eSlabType.Waffle: Waffle panelWaffle = new Waffle(); m_model.PropArea.GetSlabWaffle(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref ribSpacing2nd); panelWaffle.Name = id; panelWaffle.CustomData[AdapterId] = id; panelWaffle.Material = ReadMaterials(new List <string>() { material })[0]; panelWaffle.SpacingX = ribSpacing; panelWaffle.SpacingY = ribSpacing2nd; panelWaffle.StemWidthX = stemWidthTop; panelWaffle.StemWidthY = stemWidthTop; //ETABS does not appear to support direction dependent stem width panelWaffle.Thickness = thickness; panelWaffle.TotalDepthX = depth; panelWaffle.TotalDepthY = depth; // ETABS does not appear to to support direction dependent depth panelWaffle.PanelType = PanelType.Slab; SetShellType(panelWaffle, shellType); if (hasModifiers) { panelWaffle.CustomData.Add("Modifiers", modifiers); } propertyList.Add(panelWaffle); break; case eSlabType.Slab: case eSlabType.Drop: case eSlabType.Stiff_DO_NOT_USE: default: ConstantThickness panelConstant = new ConstantThickness(); panelConstant.CustomData[AdapterId] = id; panelConstant.Name = id; panelConstant.Material = ReadMaterials(new List <string>() { material })[0]; panelConstant.Thickness = thickness; panelConstant.Name = id; panelConstant.PanelType = PanelType.Slab; SetShellType(panelConstant, shellType); if (hasModifiers) { panelConstant.CustomData.Add("Modifiers", modifiers); } propertyList.Add(panelConstant); break; } } } return(propertyList); }
public static double AverageThickness(ConstantThickness property) { return(property.Thickness); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private bool CreateObject(ISurfaceProperty surfaceProperty) { string propName = surfaceProperty.DescriptionOrName(); string matName = "Default"; if (surfaceProperty.Material != null) { matName = GetAdapterId <string>(surfaceProperty.Material); } else { Engine.Base.Compute.RecordWarning($"SurfaceProperty {propName} had no material defined. Using a default material."); } SAP2000Id sap2000id = new SAP2000Id(); if (surfaceProperty.GetType() == typeof(Waffle)) { // not implemented! CreatePropertyError("Waffle Not Implemented!", "Panel", propName); } else if (surfaceProperty.GetType() == typeof(Ribbed)) { // not implemented! CreatePropertyError("Ribbed Not Implemented!", "Panel", propName); } else if (surfaceProperty.GetType() == typeof(LoadingPanelProperty)) { // not implemented! CreatePropertyError("Loading Panel Not Implemented!", "Panel", propName); } else if (surfaceProperty.GetType() == typeof(ConstantThickness)) { ConstantThickness constantThickness = (ConstantThickness)surfaceProperty; int shellType = 1; bool includeDrillingDOF = true; if (m_model.PropArea.SetShell_1(propName, shellType, includeDrillingDOF, matName, 0, constantThickness.Thickness, constantThickness.Thickness) != 0) { CreatePropertyError("ConstantThickness", "SurfaceProperty", propName); } } sap2000id.Id = propName; surfaceProperty.SetAdapterId(sap2000id); SurfacePropertyModifier modifier = surfaceProperty.FindFragment <SurfacePropertyModifier>(); if (modifier != null) { double[] modifiers = new double[] { modifier.FXX, modifier.FYY, modifier.FXY, modifier.MXX, modifier.MYY, modifier.MXY, modifier.VXZ, modifier.VYZ, modifier.Mass, modifier.Weight }; if (m_model.PropArea.SetModifiers(propName, ref modifiers) != 0) { CreatePropertyError("Modifiers", "SurfaceProperty", propName); } } return(true); }
/***************************************************/ /*** Read Methods ***/ /***************************************************/ private List <ISurfaceProperty> ReadSurfaceProperty(List <string> ids = null) { List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>(); Dictionary <string, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => GetAdapterId <string>(x)); int nameCount = 0; string[] nameArr = { }; m_model.PropArea.GetNameList(ref nameCount, ref nameArr); ids = FilterIds(ids, nameArr); foreach (string id in ids) { eSlabType slabType = eSlabType.Slab; eShellType shellType = eShellType.ShellThin; eWallPropType wallType = eWallPropType.Specified; string material = ""; double thickness = 0; int colour = 0; string notes = ""; string guid = null; double depth = 0; double stemWidthTop = 0; double stemWidthBottom = 0;//not used double ribSpacing = 0; double ribSpacing2nd = 0; int direction = 0; double[] modifiers = new double[] { }; int ret = m_model.PropArea.GetSlab(id, ref slabType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); if (ret != 0) { m_model.PropArea.GetWall(id, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); } SurfacePropertyModifier modifier = null; if (m_model.PropArea.GetModifiers(id, ref modifiers) == 0 && modifiers != null && modifiers.Length == 10 && modifiers.Any(x => x != 1)) { modifier = new SurfacePropertyModifier { FXX = modifiers[0], FYY = modifiers[1], FXY = modifiers[2], MXX = modifiers[3], MYY = modifiers[4], MXY = modifiers[5], VXZ = modifiers[6], VYZ = modifiers[7], Mass = modifiers[8], Weight = modifiers[9] }; } IMaterialFragment bhMaterial = null; try { bhMaterial = bhomMaterials[material]; } catch (Exception) { Engine.Base.Compute.RecordNote("Could not get material from ETABS. Material for surface property " + id + " will be null"); } if (wallType == eWallPropType.AutoSelectList) { string[] propList = null; string currentProperty = ""; m_model.PropArea.GetWallAutoSelectList(id, ref propList, ref currentProperty); m_model.PropArea.GetWall(currentProperty, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); ConstantThickness panelConstant = new ConstantThickness(); panelConstant.Name = currentProperty; panelConstant.Material = bhMaterial; panelConstant.Thickness = thickness; panelConstant.PanelType = PanelType.Wall; SetShellType(panelConstant, shellType); if (modifier != null) { panelConstant.Fragments.Add(modifier); } SetAdapterId(panelConstant, id); propertyList.Add(panelConstant); } else { switch (slabType) { case eSlabType.Ribbed: Ribbed panelRibbed = new Ribbed(); m_model.PropArea.GetSlabRibbed(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref direction); panelRibbed.Name = id; panelRibbed.Material = bhMaterial; panelRibbed.Thickness = thickness; panelRibbed.PanelType = PanelType.Slab; panelRibbed.Direction = (PanelDirection)direction; panelRibbed.Spacing = ribSpacing; panelRibbed.StemWidth = stemWidthTop; panelRibbed.TotalDepth = depth; SetShellType(panelRibbed, shellType); if (modifier != null) { panelRibbed.Fragments.Add(modifier); } SetAdapterId(panelRibbed, id); propertyList.Add(panelRibbed); break; case eSlabType.Waffle: Waffle panelWaffle = new Waffle(); m_model.PropArea.GetSlabWaffle(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref ribSpacing2nd); panelWaffle.Name = id; panelWaffle.Material = bhMaterial; panelWaffle.SpacingX = ribSpacing; panelWaffle.SpacingY = ribSpacing2nd; panelWaffle.StemWidthX = stemWidthTop; panelWaffle.StemWidthY = stemWidthTop; //ETABS does not appear to support direction dependent stem width panelWaffle.Thickness = thickness; panelWaffle.TotalDepthX = depth; panelWaffle.TotalDepthY = depth; // ETABS does not appear to to support direction dependent depth panelWaffle.PanelType = PanelType.Slab; SetShellType(panelWaffle, shellType); if (modifier != null) { panelWaffle.Fragments.Add(modifier); } SetAdapterId(panelWaffle, id); propertyList.Add(panelWaffle); break; case eSlabType.Slab: case eSlabType.Drop: case eSlabType.Stiff_DO_NOT_USE: default: ConstantThickness panelConstant = new ConstantThickness(); panelConstant.Name = id; panelConstant.Material = bhMaterial; panelConstant.Thickness = thickness; panelConstant.Name = id; panelConstant.PanelType = PanelType.Slab; SetShellType(panelConstant, shellType); if (modifier != null) { panelConstant.Fragments.Add(modifier); } SetAdapterId(panelConstant, id); propertyList.Add(panelConstant); break; } } } return(propertyList); }
/***************************************************/ /**** 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); }
public static double MassPerArea(this ConstantThickness constantThickness) { return(constantThickness.Thickness * constantThickness.Material.Density); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private List <ISurfaceProperty> ReadISurfaceProperties(List <string> ids = null) { List <ISurfaceProperty> propList = new List <ISurfaceProperty>(); ISteelCriteria steelCriteria = m_Model.GetSteelCriteria(); IDeckTableEntries deckProfiles = steelCriteria.GetDeckTableEntries(); ICompDeckProps compDeckProps = m_Model.GetCompositeDeckProps(); for (int i = 0; i < compDeckProps.GetCount(); i++) { ICompDeckProp DeckProp = compDeckProps.GetAt(i); string deckLabel = DeckProp.strLabel; string deckProfileName = DeckProp.strDeckType; IDeckTableEntry profile = null; for (int j = 0; j < deckProfiles.GetCount(); j++) // find ram deck profile to get props { profile = deckProfiles.GetAt(j); if (profile.strDeckName == deckLabel) { break; } } double concThickness = DeckProp.dThickAboveFlutes.FromInch(); double deckProfileThickness = profile.dTD.FromInch(); double deckThickness = concThickness + deckProfileThickness; IMaterialFragment material = Engine.Structure.Create.Concrete("Concrete Over Deck"); Ribbed deck2DProp = new Ribbed(); deck2DProp.Name = deckLabel; deck2DProp.Thickness = concThickness; deck2DProp.PanelType = PanelType.Slab; deck2DProp.Material = material; deck2DProp.Spacing = profile.dRSpac; deck2DProp.StemWidth = profile.dWR; deck2DProp.TotalDepth = deckThickness; // Unique RAM ID RAMId RAMId = new RAMId(); RAMId.Id = DeckProp.lUID; deck2DProp.SetAdapterId(RAMId); RAMDeckData ramDeckData = new RAMDeckData(); ramDeckData.DeckProfileName = deckProfileName; deck2DProp.Fragments.Add(ramDeckData); propList.Add(deck2DProp); } IConcSlabProps concSlabProps = m_Model.GetConcreteSlabProps(); for (int i = 0; i < concSlabProps.GetCount(); i++) { IConcSlabProp DeckProp = concSlabProps.GetAt(i); double deckThickness = DeckProp.dThickness.FromInch(); string deckLabel = DeckProp.strLabel; IMaterialFragment material = Engine.Structure.Create.Concrete("Concrete"); ConstantThickness deck2DProp = new ConstantThickness(); deck2DProp.Name = deckLabel; deck2DProp.Material = material; deck2DProp.Thickness = deckThickness; deck2DProp.PanelType = PanelType.Slab; propList.Add(deck2DProp); // Unique RAM ID RAMId RAMId = new RAMId(); RAMId.Id = DeckProp.lUID; deck2DProp.SetAdapterId(RAMId); } INonCompDeckProps nonCompDeckProps = m_Model.GetNonCompDeckProps(); for (int i = 0; i < nonCompDeckProps.GetCount(); i++) { INonCompDeckProp DeckProp = nonCompDeckProps.GetAt(i); double deckThickness = DeckProp.dEffectiveThickness.FromInch(); string deckLabel = DeckProp.strLabel; IMaterialFragment material = Engine.Structure.Create.Steel("Metal Deck"); ConstantThickness deck2DProp = new ConstantThickness(); deck2DProp.Name = deckLabel; deck2DProp.Material = material; deck2DProp.Thickness = deckThickness; deck2DProp.PanelType = PanelType.Slab; propList.Add(deck2DProp); // Unique RAM ID RAMId RAMId = new RAMId(); RAMId.Id = DeckProp.lUID; deck2DProp.SetAdapterId(RAMId); } return(propList); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private List <ISurfaceProperty> ReadSurfaceProperty(List <int> ids = null) { int uID = 1; int err = 0; List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>(); int[] propCount = new int[St7.kMaxEntityTotals - 1]; int[] propLastNumbers = new int[St7.kMaxEntityTotals - 1]; err = St7.St7GetTotalProperties(uID, propCount, propLastNumbers); if (!St7Error(err)) { return(propertyList); } int numberOfPlateProps = propCount[St7.ipPlatePropTotal]; for (int pp = 0; pp < numberOfPlateProps; pp++) { int propNumber = 0; err = St7.St7GetPropertyNumByIndex(uID, St7.ptPLATEPROP, pp + 1, ref propNumber); if (!St7Error(err)) { return(propertyList); } int plateType = 0; int materialType = 0; err = St7.St7GetPlatePropertyType(uID, propNumber, ref plateType, ref materialType); if (!St7Error(err)) { return(propertyList); } StringBuilder propertyName = new StringBuilder(St7.kMaxStrLen); err = St7.St7GetPropertyName(uID, St7.ptPLATEPROP, propNumber, propertyName, St7.kMaxStrLen); if (!St7Error(err)) { return(propertyList); } IMaterialFragment material = GetPlateIsotropicMaterial(propNumber); if ((St7PlateType)plateType == St7PlateType.LoadPatch) { LoadingPanelProperty loadingPanelProperty = new LoadingPanelProperty(); loadingPanelProperty.Name = propertyName.ToString(); SetAdapterId(loadingPanelProperty, propNumber); loadingPanelProperty.CustomData["ShellType"] = (St7PlateType)plateType; propertyList.Add(loadingPanelProperty); } else { double[] plateThickness = new double[2]; err = St7.St7GetPlateThickness(uID, propNumber, plateThickness); if (!St7Error(err)) { return(propertyList); } ConstantThickness panelConstant = new ConstantThickness(); panelConstant.Name = propertyName.ToString(); SetAdapterId(panelConstant, propNumber); panelConstant.Material = material; panelConstant.Thickness = plateThickness[1]; // here is bending thickness panelConstant.PanelType = PanelType.Undefined; panelConstant.CustomData["ShellType"] = (St7PlateType)plateType; propertyList.Add(panelConstant); } } return(propertyList); }
/***************************************************/ /**** 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); }