diff --git a/SAP2000_Adapter/CRUD/Create/Panel.cs b/SAP2000_Adapter/CRUD/Create/Panel.cs index 20a98a0..4a02516 100644 --- a/SAP2000_Adapter/CRUD/Create/Panel.cs +++ b/SAP2000_Adapter/CRUD/Create/Panel.cs @@ -19,14 +19,17 @@ * You should have received a copy of the GNU Lesser General Public License * along with this code. If not, see . */ - using BH.Engine.Geometry; using BH.Engine.Spatial; using BH.oM.Structure.Elements; +using BH.Engine.Base; +using BH.oM.Base; using BH.oM.Geometry; using System.Collections.Generic; using System.Linq; +using System; using BH.oM.Adapters.SAP2000; +using BH.oM.Adapters.SAP2000.Fragments; using BH.Engine.Adapter; using System.Reflection; @@ -37,16 +40,13 @@ public partial class SAP2000Adapter /***************************************************/ /**** Private Methods ****/ /***************************************************/ - private bool CreateObject(Panel bhPanel) { double mergeTol = 1E-6; - List boundaryPoints = null; - //Check for dealbreaking BHoM invalidity try - { + { boundaryPoints = bhPanel.ControlPoints(true).CullDuplicates(mergeTol); } catch @@ -56,13 +56,10 @@ private bool CreateObject(Panel bhPanel) } int segmentCount = boundaryPoints.Count(); - double[] x = boundaryPoints.Select(item => item.X).ToArray(); double[] y = boundaryPoints.Select(item => item.Y).ToArray(); double[] z = boundaryPoints.Select(item => item.Z).ToArray(); - string name = ""; - // Create Geometry in SAP if (m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref name, "None", bhPanel.Name.ToString()) != 0) { @@ -72,26 +69,21 @@ private bool CreateObject(Panel bhPanel) // Set AdapterID if (name != bhPanel.Name & bhPanel.Name != "") - Engine.Base.Compute.RecordNote($"Panel {bhPanel.Name} was assigned SAP2000_id of {name}"); + Engine.Base.Compute.RecordNote($"Panel {bhPanel.Name} was assigned SAP2000_id of {name}."); string guid = null; m_model.AreaObj.GetGUID(name, ref guid); - - SAP2000Id sap2000IdFragment = new SAP2000Id { Id = name, PersistentId = guid }; + SAP2000Id sap2000IdFragment = new SAP2000Id{Id = name, PersistentId = guid}; bhPanel.SetAdapterId(sap2000IdFragment); - // Set Properties SetObject(bhPanel); - return true; } /***************************************************/ - private bool SetObject(Panel bhPanel) { string name = GetAdapterId(bhPanel); - if (bhPanel.Property != null) { if (m_model.AreaObj.SetProperty(name, GetAdapterId(bhPanel.Property), 0) != 0) @@ -111,10 +103,99 @@ private bool SetObject(Panel bhPanel) } } + //Set AutoMesh + foreach (IFragment fragment in bhPanel.GetAllFragments()) + { + if (SetPanelFragment(fragment as dynamic, name) == false) + { + CreatePropertyError(fragment.GetType().ToString(), "Panel", name); + } + } + return true; } - } -} + /***************************************************/ + private bool SetPanelFragment(SAP2000Id fragment, string name) + { + return true; + } + + /***************************************************/ + private bool SetPanelFragment(IFragment fragment, string name) + { + return false; + } + + /***************************************************/ + private bool SetPanelFragment(IPanelAutoMesh fragment, string name) + { + return false; + } + /***************************************************/ + private bool SetPanelFragment(PanelAutoMeshByNumberOfObjects fragment, string name) + { + return m_model.AreaObj.SetAutoMesh(name, 1, fragment.N1, fragment.N2, 0, 0, false, false, false, 0, 0, fragment.LocalAxesOnEdge, fragment.LocalAxesOnFace, fragment.RestraintsOnEdge, fragment.RestraintsOnFace, fragment.Group, fragment.SubMesh, fragment.SubMeshSize) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(PanelAutoMeshByMaximumSize fragment, string name) + { + return m_model.AreaObj.SetAutoMesh(name, 2, 2, 2, fragment.MaxSize1, fragment.MaxSize2, false, false, false, 0, 0, fragment.LocalAxesOnEdge, fragment.LocalAxesOnFace, fragment.RestraintsOnEdge, fragment.RestraintsOnFace, fragment.Group, fragment.SubMesh, fragment.SubMeshSize) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(PanelAutoMeshByPointsOnEdges fragment, string name) + { + return m_model.AreaObj.SetAutoMesh(name, 3, 2, 2, 0, 0, fragment.PointOnEdgeFromLine, fragment.PointOnEdgeFromPoint, false, 0, 0, fragment.LocalAxesOnEdge, fragment.LocalAxesOnFace, fragment.RestraintsOnEdge, fragment.RestraintsOnFace, fragment.Group, fragment.SubMesh, fragment.SubMeshSize) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(PanelAutoMeshByCookieCutLines fragment, string name) + { + return m_model.AreaObj.SetAutoMesh(name, 4, 2, 2, 0, 0, false, false, fragment.ExtendCookieCutLines, 0, 0, fragment.LocalAxesOnEdge, fragment.LocalAxesOnFace, fragment.RestraintsOnEdge, fragment.RestraintsOnFace, fragment.Group, fragment.SubMesh, fragment.SubMeshSize) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(PanelAutoMeshByCookieCutPoints fragment, string name) + { + return m_model.AreaObj.SetAutoMesh(name, 5, 2, 2, 0, 0, false, false, false, fragment.Rotation * 180 / Math.PI, 0, fragment.LocalAxesOnEdge, fragment.LocalAxesOnFace, fragment.RestraintsOnEdge, fragment.RestraintsOnFace, fragment.Group, fragment.SubMesh, fragment.SubMeshSize) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(PanelAutoMeshByGeneralDivide fragment, string name) + { + return m_model.AreaObj.SetAutoMesh(name, 6, 2, 2, 0, 0, false, false, false, 0, fragment.MaxSizeGeneral, fragment.LocalAxesOnEdge, fragment.LocalAxesOnFace, fragment.RestraintsOnEdge, fragment.RestraintsOnFace, fragment.Group, fragment.SubMesh, fragment.SubMeshSize) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(PanelEdgeConstraint fragment, string name) + { + return m_model.AreaObj.SetEdgeConstraint(name, fragment.EdgeConstraint) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(IPanelOffset fragment, string name) + { + return false; + } + + /***************************************************/ + private bool SetPanelFragment(PanelOffsetByJointPattern fragment, string name) + { + double[] offsets = new double[4]; + return m_model.AreaObj.SetOffsets(name, 1, fragment.OffsetPattern, fragment.OffsetPatternSF, ref offsets) == 0; + } + + /***************************************************/ + private bool SetPanelFragment(PanelOffsetByPoint fragment, string name) + { + double[] offsets = fragment.Offset; + bool success = m_model.AreaObj.SetOffsets(name, 2, "", 0, ref offsets) == 0; + return success && offsets.SequenceEqual(fragment.Offset); + } + /***************************************************/ + } +} \ No newline at end of file diff --git a/SAP2000_Adapter/CRUD/Read/Panel.cs b/SAP2000_Adapter/CRUD/Read/Panel.cs index 198ebec..7ec16f9 100644 --- a/SAP2000_Adapter/CRUD/Read/Panel.cs +++ b/SAP2000_Adapter/CRUD/Read/Panel.cs @@ -19,7 +19,6 @@ * You should have received a copy of the GNU Lesser General Public License * along with this code. If not, see . */ - using BH.oM.Geometry; using BH.oM.Structure.Elements; using BH.oM.Structure.SurfaceProperties; @@ -28,8 +27,12 @@ using System.Collections.Generic; using System.Linq; using BH.oM.Adapters.SAP2000; +using BH.oM.Adapters.SAP2000.Fragments; +using BH.Engine.Adapters.SAP2000; using BH.Engine.Adapter; +using BH.Engine.Base; using System; +using SAP2000v1; namespace BH.Adapter.SAP2000 { @@ -38,48 +41,41 @@ public partial class SAP2000Adapter /***************************************************/ /**** Private Methods ****/ /***************************************************/ - private List ReadPanel(List ids = null) { List bhomPanels = new List(); - Dictionary bhomNodes = ReadNodes().ToDictionary(x => GetAdapterId(x)); Dictionary bhomProperties = ReadSurfaceProperty().ToDictionary(x => GetAdapterId(x)); - int nameCount = 0; - string[] nameArr = { }; + 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 pts = new List(); foreach (string name in pointNames) pts.Add(bhomNodes[name].Position); pts.Add(pts[0]); - Polyline outline = new Polyline() { ControlPoints = pts }; - List outEdges = new List() { new Edge { Curve = outline, Release = new oM.Structure.Constraints.Constraint4DOF() } }; + Polyline outline = new Polyline() + {ControlPoints = pts}; + List outEdges = new List() + { new Edge { Curve = outline, Release = new oM.Structure.Constraints.Constraint4DOF() } }; bhomPanel.ExternalEdges = outEdges; } //There are no openings in SAP2000 bhomPanel.Openings = new List(); - //Get the section property string propertyName = ""; if (m_model.AreaObj.GetProperty(id, ref propertyName) == 0) @@ -100,18 +96,104 @@ private List ReadPanel(List ids = null) if (m_model.AreaObj.GetGUID(id, ref guid) == 0) sap2000id.PersistentId = guid; - bhomPanel.SetAdapterId(sap2000id); + /***************************************************/ + /* SAP Fragments */ + /***************************************************/ + // Automesh + int meshType = 0; + int n1 = 0; + int n2 = 0; + double maxSize1 = 0; + double maxSize2 = 0; + bool pointOnEdgeFromLine = false; + bool pointOnEdgeFromPoint = false; + bool extendCookieCutLines = false; + double rotation = 0; + double maxSizeGeneral = 0; + bool localAxesOnEdge = false; + bool localAxesOnFace = false; + bool restraintsOnEdge = false; + bool restraintsOnFace = false; + string group = null; + bool subMesh = false; + double subMeshSize = 0; + m_model.AreaObj.GetAutoMesh(id, ref meshType, ref n1, ref n2, ref maxSize1, ref maxSize2, ref pointOnEdgeFromLine, ref pointOnEdgeFromPoint, ref extendCookieCutLines, ref rotation, ref maxSizeGeneral, ref localAxesOnEdge, ref localAxesOnFace, ref restraintsOnEdge, ref restraintsOnFace, ref group, ref subMesh, ref subMeshSize); + switch (meshType) + { + case 1: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByNumberOfObjects() + {N1 = n1, N2 = n2, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, RestraintsOnFace = restraintsOnFace, Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize}); + break; + case 2: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByMaximumSize() + {MaxSize1 = maxSize1, MaxSize2 = maxSize2, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, RestraintsOnFace = restraintsOnFace, Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize}); + break; + case 3: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByPointsOnEdges() + {PointOnEdgeFromLine = pointOnEdgeFromLine, PointOnEdgeFromPoint = pointOnEdgeFromPoint, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, RestraintsOnFace = restraintsOnFace, Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize}); + ; + break; + case 4: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByCookieCutLines() + {ExtendCookieCutLines = extendCookieCutLines, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, RestraintsOnFace = restraintsOnFace, Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize}); + break; + case 5: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByCookieCutPoints() + {Rotation = rotation * Math.PI / 180, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, RestraintsOnFace = restraintsOnFace, Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize}); + break; + case 6: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByGeneralDivide() + {MaxSizeGeneral = maxSizeGeneral, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, RestraintsOnFace = restraintsOnFace, Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize}); + break; + case 0: + default: + break; + } + + // Edge Constraint + bool constraintExists = false; + m_model.AreaObj.GetEdgeConstraint(id, ref constraintExists); + if (constraintExists) + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelEdgeConstraint() + {EdgeConstraint = true}); + // Material Overwrite + string matName = ""; + m_model.AreaObj.GetMaterialOverwrite(id, ref matName); + if (matName != "None") + { + ISurfaceProperty property = Engine.Base.Query.ShallowClone(bhomPanel.Property); + property.Material = ReadMaterial(new List{matName}).FirstOrDefault(); + property.Name = property.Name + "-" + matName; + bhomPanel.Property = property; + } + + // Offsets + int offsetType = 0; + string offsetPattern = ""; + double offsetPatternSF = 0; + double[] offset = null; + m_model.AreaObj.GetOffsets(id, ref offsetType, ref offsetPattern, ref offsetPatternSF, ref offset); + switch (offsetType) + { + case 1: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelOffsetByJointPattern() + {OffsetPattern = offsetPattern, OffsetPatternSF = offsetPatternSF}); + break; + case 2: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelOffsetByPoint() + {Offset = offset, }); + break; + default: + break; + } + //Add the panel to the list bhomPanels.Add(bhomPanel); } return bhomPanels; } - - /***************************************************/ + /***************************************************/ } -} - - - +} \ No newline at end of file diff --git a/SAP2000_Adapter/CRUD/Read/Section.cs b/SAP2000_Adapter/CRUD/Read/Section.cs index 5e5b553..3b38a82 100644 --- a/SAP2000_Adapter/CRUD/Read/Section.cs +++ b/SAP2000_Adapter/CRUD/Read/Section.cs @@ -77,7 +77,6 @@ private List ReadSectionProperties(List ids = null) double tw = 0; double tfb = 0; double t2b = 0; - double dis = 0; double radius = 0; double angle = 0; int color = 0; diff --git a/SAP2000_Adapter/SAP2000_Adapter.csproj b/SAP2000_Adapter/SAP2000_Adapter.csproj index b01373d..6b3b8b5 100644 --- a/SAP2000_Adapter/SAP2000_Adapter.csproj +++ b/SAP2000_Adapter/SAP2000_Adapter.csproj @@ -126,6 +126,11 @@ False False + + C:\ProgramData\BHoM\Assemblies\Quantities_oM.dll + False + False + C:\ProgramData\BHoM\Assemblies\Results_Engine.dll False diff --git a/SAP2000_Engine/Query/Bar.cs b/SAP2000_Engine/Query/Bar.cs index 95a2358..7c7361a 100644 --- a/SAP2000_Engine/Query/Bar.cs +++ b/SAP2000_Engine/Query/Bar.cs @@ -29,27 +29,41 @@ using BH.oM.Adapters.SAP2000.Elements; using BH.oM.Adapters.SAP2000; using BH.Engine.Base; +using System.ComponentModel; +using BH.oM.Base.Attributes; namespace BH.Engine.Adapters.SAP2000 { public static partial class Query { + [Description("Returns the SAP2000 BarAutoMesh settings for a bar. You can also use the method FindFragment() with the type BarAutoMesh as an argument.")] + [Input("bar", "A Bar which was either pulled from SAP2000 or which has had SAP2000 settings added.")] + [Output("BarAutoMesh", "A fragment containing SAP2000 BarAutoMesh settings.")] public static BarAutoMesh BarAutoMesh(this Bar bar) { - return bar.FindFragment(); + return bar?.FindFragment(); } + [Description("Returns the SAP2000 BarDesignProcedure settings for a bar. You can also use the method FindFragment() with the type BarDesignProcedure as an argument.")] + [Input("bar", "A Bar which was either pulled from SAP2000 or which has had SAP2000 settings added.")] + [Output("BarDesignProcedure", "A fragment containing SAP2000 BarDesignProcedure settings.")] public static BarDesignProcedure BarDesignProcedure(this Bar bar) { - return bar.FindFragment(); + return bar?.FindFragment(); } + [Description("Returns the SAP2000 BarInsertionPointLocation settings for a bar. You can also use the method FindFragment() with the type BarInsertionPoint as an argument.")] + [Input("bar", "A Bar which was either pulled from SAP2000 or which has had SAP2000 settings added.")] + [Output("BarInsertionPoint", "The insertion point in SAP2000 for the bar.")] public static BarInsertionPointLocation BarInsertionPoint(this Bar bar) { BarInsertionPoint o = bar?.FindFragment(); return o == null ? BarInsertionPointLocation.Centroid : o.InsertionPoint; } + [Description("Checks if SAP2000 is set to modify the stiffness of a bar based on its insertion point. You can also use the method FindFragment() with the type BarInsertionPoint as an argument, and check the ModifyStiffness property of that fragment.")] + [Input("bar", "A Bar which was either pulled from SAP2000 or which has had SAP2000 settings added.")] + [Output("BarModifyStiffnessInsertionPoint", "Whether SAP2000 is set to transform frame stiffness for offsets from centroid.")] public static bool BarModifyStiffnessInsertionPoint(this Bar bar) { BarInsertionPoint o = bar?.FindFragment(); diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs new file mode 100644 index 0000000..87d34e5 --- /dev/null +++ b/SAP2000_Engine/Query/Panel.cs @@ -0,0 +1,79 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BH.oM.Structure.Elements; +using BH.oM.Adapters.SAP2000.Fragments; +using BH.oM.Adapters.SAP2000; +using System.ComponentModel; +using BH.oM.Base.Attributes; +using BH.Engine.Base; +using BH.oM.Base; + +namespace BH.Engine.Adapters.SAP2000 +{ + public static partial class Query + { + [Description("Returns the SAP2000 PanelAutoMesh settings for a panel. You can also use the method FindFragment() with the type IPanelAutoMesh as an argument.")] + [Input("panel", "A panel which was either pulled from SAP2000 or which has had SAP2000 settings added.")] + [Output("PanelAutoMesh", "A fragment containing SAP2000 PanelAutoMesh settings.")] + public static IPanelAutoMesh PanelAutoMesh(this Panel panel) + { + List fragments = panel?.GetAllFragments(typeof(IPanelAutoMesh)); + + if (fragments == null || fragments.Count == 0) + return null; + + if (fragments.Count > 1) + Compute.RecordWarning($"the panel {panel.Name} has more than one PanelAutoMesh defined, which is not allowed. Only the first has been returned. Use GetAllFragments() to extract others."); + + return fragments.Select(x => x as IPanelAutoMesh).FirstOrDefault(); + } + + [Description("Returns the SAP2000 PanelEdgeConstraint settings for a panel. You can also use the method FindFragment() with the type PanelEdgeConstraint as an argument.")] + [Input("panel", "A panel which was either pulled from SAP2000 or which has had SAP2000 settings added.")] + [Output("PanelEdgeConstraint", "A fragment containing SAP2000 PanelEdgeConstraint settings.")] + public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) + { + return panel?.FindFragment(); + } + + [Description("Returns the SAP2000 PanelOffset settings for a panel. You can also use the method FindFragment() with the type IPanelOffset as an argument.")] + [Input("panel", "A panel which was either pulled from SAP2000 or which has had SAP2000 settings added.")] + [Output("PanelOffset", "A fragment containing SAP2000 PanelOffset settings.")] + public static IPanelOffset PanelOffset(this Panel panel) + { + List fragments = panel?.GetAllFragments(typeof(IPanelOffset)); + + if (fragments == null || fragments.Count == 0) + return null; + + if (fragments.Count > 1) + Compute.RecordWarning($"the panel {panel.Name} has more than one PanelOffset defined, which is not allowed. Only the first has been returned. Use GetAllFragments() to extract others."); + + return fragments.Select(x => x as IPanelOffset).FirstOrDefault(); + } + } +} diff --git a/SAP2000_Engine/Query/SplitRigidLink.cs b/SAP2000_Engine/Query/SplitRigidLink.cs index 492f9e4..6b4f8d3 100644 --- a/SAP2000_Engine/Query/SplitRigidLink.cs +++ b/SAP2000_Engine/Query/SplitRigidLink.cs @@ -21,7 +21,8 @@ */ using BH.oM.Structure.Elements; -using System; +using BH.oM.Base.Attributes; +using System.ComponentModel; using System.Collections.Generic; using System.Linq; using BH.oM.Structure.Constraints; @@ -34,8 +35,17 @@ public static partial class Query /**** Public Methods ****/ /***************************************************/ - public static List SplitRigidLink(RigidLink link) + [Description("Splits a RigidLink into one or more RigidLinks, each of which has exactly one SecondaryNode.")] + [Input("link", "The RigidLink to be split; generally a link with one PrimaryNode and several SecondaryNodes.")] + [Output("SingleLinks", "A list of RigidLinks, each with only one SecondaryNode. The name of each link will have ':::' appended, where i is sequential for the list of links.")] + public static List SplitRigidLink(this RigidLink link) { + if (link == null || link.PrimaryNode == null || link.SecondaryNodes == null) + { + Base.Compute.RecordError("Could not split the RigidLink because it is null."); + return null; + } + List singleLinks = new List(); if (link.SecondaryNodes.Count() <= 1) diff --git a/SAP2000_Engine/SAP2000_Engine.csproj b/SAP2000_Engine/SAP2000_Engine.csproj index 6e12406..b98651f 100644 --- a/SAP2000_Engine/SAP2000_Engine.csproj +++ b/SAP2000_Engine/SAP2000_Engine.csproj @@ -143,6 +143,7 @@ + diff --git a/SAP2000_oM/Fragments/IPanelAutoMesh.cs b/SAP2000_oM/Fragments/IPanelAutoMesh.cs new file mode 100644 index 0000000..8450c8c --- /dev/null +++ b/SAP2000_oM/Fragments/IPanelAutoMesh.cs @@ -0,0 +1,53 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using BH.oM.Base.Attributes; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Base interface for panel auto mesh settings in SAP2000. Contains the type of auto mesh and the properties common to all types.")] + [Unique] + public interface IPanelAutoMesh : IFragment + { + [Description("If this item is True, and if both points along an edge of the original area " + "object have the same local axes, the program makes the local axes for added points " + "along the edge the same as the edge end points.")] + bool LocalAxesOnEdge { get; set; } + + [Description("If this item is True, and if all points around the perimeter of the original " + "area object have the same local axes, the program makes the local axes for all added " + "points the same as the perimeter points.")] + bool LocalAxesOnFace { get; set; } + + [Description("If this item is True, and if both points along an edge of the original area " + "object have the same restraint/constraint, then, if the added point and the adjacent " + "corner points have the same local axes definition, the program includes the " + "restraint/constraint for added points along the edge.")] + bool RestraintsOnEdge { get; set; } + + [Description("If this item is True, and if all points around the perimeter of the original " + "area object have the same restraint/constraint, then, if an added point and the " + "perimeter points have the same local axes definition, the program includes the " + "restraint/constraint for the added point.")] + bool RestraintsOnFace { get; set; } + + [Description("The name of a defined group. Some of the meshing options make use of point " + "and line objects included in this group.")] + string Group { get; set; } + + [Description("If this item is True, after initial meshing, the program further meshes any area " + "objects that have an edge longer than the length specified by the SubMeshSize item.")] + bool SubMesh { get; set; } + + [Description("This item applies when the SubMesh item is True. It is the maximum size of area " + "objects to remain when the auto meshing is complete.")] + double SubMeshSize { get; set; } + } +} diff --git a/SAP2000_oM/Fragments/IPanelOffset.cs b/SAP2000_oM/Fragments/IPanelOffset.cs new file mode 100644 index 0000000..9dc935e --- /dev/null +++ b/SAP2000_oM/Fragments/IPanelOffset.cs @@ -0,0 +1,33 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using System.ComponentModel; +using BH.oM.Base; +using BH.oM.Base.Attributes; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Base interface for panel offsets in SAP. Contains only the type of offset.")] + [Unique] + public partial interface IPanelOffset : IFragment + { + } +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs new file mode 100644 index 0000000..0e6528e --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs @@ -0,0 +1,40 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Divide the panel based on lines in the meshing group.")] + public class PanelAutoMeshByCookieCutLines : IPanelAutoMesh, IFragment + { + [Description("If this item is True, " + "all straight line objects included in the group specified by the Group item " + "are extended to intersect the area object edges for the purpose of meshing the area object.")] + public virtual bool ExtendCookieCutLines { get; set; } + public virtual bool LocalAxesOnEdge { get; set; } = false; + public virtual bool LocalAxesOnFace { get; set; } = false; + public virtual bool RestraintsOnEdge { get; set; } = false; + public virtual bool RestraintsOnFace { get; set; } = false; + public virtual string Group { get; set; } = "ALL"; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs new file mode 100644 index 0000000..b96a6f3 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs @@ -0,0 +1,42 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using BH.oM.Quantities.Attributes; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Divide the panel based on points in the meshing group.")] + public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh, IFragment + { + [Angle] + [Description("This is an angle in radians that the meshing lines are rotated from their default orientation." + "By default these lines align with the area object local 1 and 2 axes.")] + public virtual double Rotation { get; set; } + public virtual bool LocalAxesOnEdge { get; set; } = false; + public virtual bool LocalAxesOnFace { get; set; } = false; + public virtual bool RestraintsOnEdge { get; set; } = false; + public virtual bool RestraintsOnFace { get; set; } = false; + public virtual string Group { get; set; } = "ALL"; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs new file mode 100644 index 0000000..cbceb1b --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs @@ -0,0 +1,42 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using BH.oM.Quantities.Attributes; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Divide the panel based on points and lines in the meshing group and a maximum size.")] + public class PanelAutoMeshByGeneralDivide : IPanelAutoMesh, IFragment + { + [Length] + [Description("This is the maximum size of objects created by " + "the General Divide Tool.")] + public virtual double MaxSizeGeneral { get; set; } + public virtual bool LocalAxesOnEdge { get; set; } = false; + public virtual bool LocalAxesOnFace { get; set; } = false; + public virtual bool RestraintsOnEdge { get; set; } = false; + public virtual bool RestraintsOnFace { get; set; } = false; + public virtual string Group { get; set; } = "ALL"; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs new file mode 100644 index 0000000..63fdf3b --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs @@ -0,0 +1,47 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using BH.oM.Quantities.Attributes; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Divide the panel so that elements do not exceed a maximum size.")] + public class PanelAutoMeshByMaximumSize : IPanelAutoMesh, IFragment + { + [Length] + [Description("This is the maximum size of objects " + "created along the edge of the meshed area object that runs from point 1 to point 2.")] + public virtual double MaxSize1 { get; set; } + + [Length] + [Description("This is the maximum size of objects " + "created along the edge of the meshed area object that runs from point 1 to point 3.")] + public virtual double MaxSize2 { get; set; } + + public virtual bool LocalAxesOnEdge { get; set; } = false; + public virtual bool LocalAxesOnFace { get; set; } = false; + public virtual bool RestraintsOnEdge { get; set; } = false; + public virtual bool RestraintsOnFace { get; set; } = false; + public virtual string Group { get; set; } = "ALL"; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs new file mode 100644 index 0000000..487bfd4 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs @@ -0,0 +1,43 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Divide the panel into a given number of elements in each direction.")] + public class PanelAutoMeshByNumberOfObjects : IPanelAutoMesh, IFragment + { + [Description("This is the number of objects " + "created along the edge of the meshed area object that runs from point 1 to point 2.")] + public virtual int N1 { get; set; } + + [Description("This is the number of objects " + "created along the edge of the meshed area object that runs from point 1 to point 3.")] + public virtual int N2 { get; set; } + public virtual bool LocalAxesOnEdge { get; set; } = false; + public virtual bool LocalAxesOnFace { get; set; } = false; + public virtual bool RestraintsOnEdge { get; set; } = false; + public virtual bool RestraintsOnFace { get; set; } = false; + public virtual string Group { get; set; } = "ALL"; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs new file mode 100644 index 0000000..c818400 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs @@ -0,0 +1,43 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + [Description("Divide the panel based on points coincident with the panel edges.")] + public class PanelAutoMeshByPointsOnEdges : IPanelAutoMesh, IFragment + { + [Description("If this is True, points on the area " + "object edges are determined from intersections of straight line objects included in " + "the group specified by the Group item with the area object edges.")] + public virtual bool PointOnEdgeFromLine { get; set; } + + [Description("If this is True, points on the area " + "object edges are determined from point objects included in the group specified by" + " the Group item that lie on the area object edges.")] + public virtual bool PointOnEdgeFromPoint { get; set; } + public virtual bool LocalAxesOnEdge { get; set; } = false; + public virtual bool LocalAxesOnFace { get; set; } = false; + public virtual bool RestraintsOnEdge { get; set; } = false; + public virtual bool RestraintsOnFace { get; set; } = false; + public virtual string Group { get; set; } = "ALL"; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } +} diff --git a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs new file mode 100644 index 0000000..295a2d1 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs @@ -0,0 +1,32 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Base; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + public class PanelEdgeConstraint : IFragment + { + [Description("This item is True if an automatic edge constraint is generated by the program for the area object in the analysis model.")] + public virtual bool EdgeConstraint { get; set; } = false; + } +} diff --git a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs new file mode 100644 index 0000000..8853b1e --- /dev/null +++ b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs @@ -0,0 +1,35 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Quantities.Attributes; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + public class PanelOffsetByJointPattern : IPanelOffset + { + [Description("This is the name of the defined joint pattern that is used to calculate the joint offsets.")] + public virtual string OffsetPattern { get; set; } = ""; + [Length] + [Description("This is the scale factor applied to the joint pattern when calculating the joint offsets.")] + public virtual double OffsetPatternSF { get; set; } = 0; + } +} diff --git a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs new file mode 100644 index 0000000..5426aa5 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs @@ -0,0 +1,33 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2022, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ +using BH.oM.Quantities.Attributes; +using System.ComponentModel; + +namespace BH.oM.Adapters.SAP2000.Fragments +{ + public class PanelOffsetByPoint : IPanelOffset + { + [Length] + [Description("This is an array of joint offsets for each of the points that define the area object.")] + public virtual double[] Offset { get; set; } = null; + } +} diff --git a/SAP2000_oM/SAP2000_oM.csproj b/SAP2000_oM/SAP2000_oM.csproj index 9687808..4889741 100644 --- a/SAP2000_oM/SAP2000_oM.csproj +++ b/SAP2000_oM/SAP2000_oM.csproj @@ -46,6 +46,11 @@ False False + + C:\ProgramData\BHoM\Assemblies\Quantities_oM.dll + False + False + C:\ProgramData\BHoM\Assemblies\Structure_oM.dll False @@ -67,9 +72,20 @@ + + + + + + + + + + +