From 773ad9a73c8fce287a56a5e183e5d15e9805d943 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Thu, 26 Aug 2021 11:01:26 -0400 Subject: [PATCH 01/24] add panel fragments to read --- SAP2000_Adapter/CRUD/Read/Panel.cs | 76 +++++++++++++ SAP2000_Adapter/SAP2000_Adapter.csproj | 3 + SAP2000_Engine/Modify/SetPanel.cs | 87 +++++++++++++++ SAP2000_Engine/Query/Panel.cs | 51 +++++++++ SAP2000_Engine/SAP2000_Engine.csproj | 2 + SAP2000_oM/Enums/PanelAutoMeshType.cs | 41 +++++++ SAP2000_oM/Enums/PanelOffsetType.cs | 37 +++++++ SAP2000_oM/Fragments/PanelAutoMesh.cs | 115 ++++++++++++++++++++ SAP2000_oM/Fragments/PanelEdgeConstraint.cs | 38 +++++++ SAP2000_oM/Fragments/PanelOffset.cs | 45 ++++++++ SAP2000_oM/SAP2000_oM.csproj | 5 + 11 files changed, 500 insertions(+) create mode 100644 SAP2000_Engine/Modify/SetPanel.cs create mode 100644 SAP2000_Engine/Query/Panel.cs create mode 100644 SAP2000_oM/Enums/PanelAutoMeshType.cs create mode 100644 SAP2000_oM/Enums/PanelOffsetType.cs create mode 100644 SAP2000_oM/Fragments/PanelAutoMesh.cs create mode 100644 SAP2000_oM/Fragments/PanelEdgeConstraint.cs create mode 100644 SAP2000_oM/Fragments/PanelOffset.cs diff --git a/SAP2000_Adapter/CRUD/Read/Panel.cs b/SAP2000_Adapter/CRUD/Read/Panel.cs index 198ebec..efc85ea 100644 --- a/SAP2000_Adapter/CRUD/Read/Panel.cs +++ b/SAP2000_Adapter/CRUD/Read/Panel.cs @@ -28,8 +28,11 @@ using System.Collections.Generic; using System.Linq; using BH.oM.Adapters.SAP2000; +using BH.Engine.Adapters.SAP2000; using BH.Engine.Adapter; +using BH.Engine.Units; using System; +using SAP2000v1; namespace BH.Adapter.SAP2000 { @@ -102,6 +105,77 @@ private List ReadPanel(List ids = null) sap2000id.PersistentId = guid; bhomPanel.SetAdapterId(sap2000id); + + /***************************************************/ + /* SAP Fragments */ + /***************************************************/ + + // Automesh + + int meshType = (int)PanelAutoMeshType.None; + 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); + + if (meshType != (int)PanelAutoMeshType.None) + { + bhomPanel = bhomPanel.SetPanelAutoMesh((PanelAutoMeshType)meshType, n1, n2, maxSize1, maxSize2, + pointOnEdgeFromLine, pointOnEdgeFromPoint, extendCookieCutLines, Engine.Units.Convert.FromDegree(rotation), + maxSizeGeneral, localAxesOnEdge, localAxesOnFace, restraintsOnEdge, + restraintsOnFace, group, subMesh, subMeshSize); + } + + // Edge Constraint + + bool constraintExists = false; + + m_model.AreaObj.GetEdgeConstraint(id, ref constraintExists); + if (constraintExists) + bhomPanel = bhomPanel.SetPanelEdgeConstraint(constraintExists); + + // Material Overwrite + + string propName = ""; + + m_model.AreaObj.GetMaterialOverwrite(id, ref propName); + + if (propName != "None") + { + ISurfaceProperty property = Engine.Base.Query.ShallowClone(bhomPanel.Property); + property.Material = ReadMaterial(new List { propName }).FirstOrDefault(); + bhomPanel.Property = property; + } + + // Offsets + + int offsetType = (int)PanelOffsetType.None; + string offsetPattern = ""; + double offsetPatternSF = 0; + double[] offset = null; + + m_model.AreaObj.GetOffsets(id, ref offsetType, ref offsetPattern, ref offsetPatternSF, ref offset); + + if (offsetType > 0) + bhomPanel = bhomPanel.SetPanelOffset((PanelOffsetType)offsetType, offsetPattern, offsetPatternSF, offset); + //Add the panel to the list bhomPanels.Add(bhomPanel); } @@ -111,6 +185,8 @@ private List ReadPanel(List ids = null) /***************************************************/ } + + } diff --git a/SAP2000_Adapter/SAP2000_Adapter.csproj b/SAP2000_Adapter/SAP2000_Adapter.csproj index b01373d..36f0635 100644 --- a/SAP2000_Adapter/SAP2000_Adapter.csproj +++ b/SAP2000_Adapter/SAP2000_Adapter.csproj @@ -172,6 +172,9 @@ + + ..\..\..\..\..\..\ProgramData\BHoM\Assemblies\Units_Engine.dll + diff --git a/SAP2000_Engine/Modify/SetPanel.cs b/SAP2000_Engine/Modify/SetPanel.cs new file mode 100644 index 0000000..675e2ff --- /dev/null +++ b/SAP2000_Engine/Modify/SetPanel.cs @@ -0,0 +1,87 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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.Elements; +using BH.oM.Adapters.SAP2000; +using BH.Engine.Base; + +namespace BH.Engine.Adapters.SAP2000 +{ + public static partial class Modify + { + public static Panel SetPanelAutoMesh(this Panel panel, PanelAutoMeshType meshType, int n1, int n2, double maxSize1, double maxSize2, bool + pointOnEdgeFromLine, bool pointOnEdgeFromPoint, bool extendCookieCutLines, double rotation, + double maxSizeGeneral, bool localAxesOnEdge, bool localAxesOnFace, bool restraintsOnEdge, + bool restraintsOnFace, string group, bool subMesh, double subMeshSize) + { + + PanelAutoMesh fragment = new PanelAutoMesh() + { + MeshType = meshType, + N1 = n1, + N2 = n2, + MaxSize1 = maxSize1, + MaxSize2 = maxSize2, + PointOnEdgeFromLine = pointOnEdgeFromLine, + PointOnEdgeFromPoint = pointOnEdgeFromPoint, + ExtendCookieCutLines = extendCookieCutLines, + Rotation = rotation, + MaxSizeGeneral = maxSizeGeneral, + LocalAxesOnEdge = localAxesOnEdge, + LocalAxesOnFace = localAxesOnFace, + RestraintsOnEdge = restraintsOnEdge, + RestraintsOnFace = restraintsOnFace, + Group = group, + SubMesh = subMesh, + SubMeshSize = subMeshSize, + }; + return (Panel)panel.AddFragment(fragment); + } + public static Panel SetPanelEdgeConstraint(this Panel panel, bool edgeConstraint) + { + + PanelEdgeConstraint fragment = new PanelEdgeConstraint() + { + EdgeConstraint = edgeConstraint + }; + return (Panel)panel.AddFragment(fragment); + } + + public static Panel SetPanelOffset(this Panel panel, PanelOffsetType offsetType, string offsetPattern, double offsetPatternSF, double[] offset) + { + PanelOffset fragment = new PanelOffset() + { + OffsetType = offsetType, + OffsetPattern = offsetPattern, + OffsetPatternSF = offsetPatternSF, + Offset = offset + }; + return (Panel)panel.AddFragment(fragment); + } + } +} diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs new file mode 100644 index 0000000..e3cc3ee --- /dev/null +++ b/SAP2000_Engine/Query/Panel.cs @@ -0,0 +1,51 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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.Elements; +using BH.oM.Adapters.SAP2000; +using BH.Engine.Base; + +namespace BH.Engine.Adapters.SAP2000 +{ + public static partial class Query + { + public static PanelAutoMesh PanelAutoMesh(this Panel panel) + { + return panel.FindFragment(); + } + public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) + { + return panel.FindFragment(); + } + public static PanelOffset PanelOffset(this Panel panel) + { + return panel.FindFragment(); + } + + } +} diff --git a/SAP2000_Engine/SAP2000_Engine.csproj b/SAP2000_Engine/SAP2000_Engine.csproj index 6e12406..370a293 100644 --- a/SAP2000_Engine/SAP2000_Engine.csproj +++ b/SAP2000_Engine/SAP2000_Engine.csproj @@ -142,7 +142,9 @@ + + diff --git a/SAP2000_oM/Enums/PanelAutoMeshType.cs b/SAP2000_oM/Enums/PanelAutoMeshType.cs new file mode 100644 index 0000000..e041d30 --- /dev/null +++ b/SAP2000_oM/Enums/PanelAutoMeshType.cs @@ -0,0 +1,41 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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; + +namespace BH.oM.Adapters.SAP2000 +{ + public enum PanelAutoMeshType : int + { + None = 0, + NumberOfObjects = 1, + MaximumSize = 2, + PointsOnEdges = 3, + CookieCutLines = 4, + CookieCutPoints = 5, + GeneralDivide = 6 + } +} diff --git a/SAP2000_oM/Enums/PanelOffsetType.cs b/SAP2000_oM/Enums/PanelOffsetType.cs new file mode 100644 index 0000000..5e6252a --- /dev/null +++ b/SAP2000_oM/Enums/PanelOffsetType.cs @@ -0,0 +1,37 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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; + +namespace BH.oM.Adapters.SAP2000 +{ + public enum PanelOffsetType : int + { + None = 0, + ByJointPattern = 1, + ByPoint = 2, + } +} diff --git a/SAP2000_oM/Fragments/PanelAutoMesh.cs b/SAP2000_oM/Fragments/PanelAutoMesh.cs new file mode 100644 index 0000000..fc21a3b --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMesh.cs @@ -0,0 +1,115 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 System.ComponentModel; +using BH.oM.Base; + +namespace BH.oM.Adapters.SAP2000.Elements +{ + public class PanelAutoMesh : IFragment + { + [Description("This item is 0, 1, 2, 3, 4, 5 or 6, indicating the automatic mesh type for the area object.")] + public virtual PanelAutoMeshType MeshType { get; set; } = PanelAutoMeshType.None; + + [Description("This item applies when MeshType = 1. It 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; } = 0; + + [Description("This item applies when MeshType = 1. It 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; } = 0; + + [Description("This item applies when MeshType = 2. It 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; } = 0; + + [Description("This item applies when MeshType = 2. It 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; } = 0; + + [Description("This item applies when MeshType = 3. If it 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; } = false; + + [Description("This item applies when MeshType = 3. If it 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; } = false; + + [Description("This item applies when MeshType = 4. MeshType = 4 provides cookie cut " + + "meshing based on straight line objects included in the group specified by the Group " + + "item that intersect the area object edges. If the ExtendCookieCutLines 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; } = false; + + [Description("This item applies when MeshType = 5. MeshType = 5 provides cookie cut meshing based " + + "on two perpendicular lines passing through point objects included in the group specified by " + + "the Group item. By default these lines align with the area object local 1 and 2 axes. The " + + "Rotation item is an angle in degrees that the meshing lines are rotated from their default orientation. [deg]")] //CONVERT TO RADIANS + public virtual double Rotation { get; set; } = 0; + + [Description("This item applies when MeshType = 6. It is the maximum size of objects created by " + + "the General Divide Tool.")] + public virtual double MaxSizeGeneral { get; set; } = 0; + + [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.")] + public virtual bool LocalAxesOnEdge { get; set; } = false; + + [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.")] + public virtual bool LocalAxesOnFace { get; set; } = false; + + [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.")] + public virtual bool RestraintsOnEdge { get; set; } = false; + + [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.")] + public virtual bool RestraintsOnFace { get; set; } = false; + + [Description("The name of a defined group. Some of the meshing options make use of point " + + "and line objects included in this group.")] + public virtual string Group { get; set; } = null; + + [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.")] + public virtual bool SubMesh { get; set; } = false; + + [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.")] + 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..a0ce346 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs @@ -0,0 +1,38 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 System.ComponentModel; +using BH.oM.Base; + +namespace BH.oM.Adapters.SAP2000.Elements +{ + 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/PanelOffset.cs b/SAP2000_oM/Fragments/PanelOffset.cs new file mode 100644 index 0000000..941e12f --- /dev/null +++ b/SAP2000_oM/Fragments/PanelOffset.cs @@ -0,0 +1,45 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 System.ComponentModel; +using BH.oM.Base; + +namespace BH.oM.Adapters.SAP2000.Elements +{ + public class PanelOffset : IFragment + { + [Description("This is 0, 1 or 2, indicating the joint offset type.")] + public virtual PanelOffsetType OffsetType { get; set; } = PanelOffsetType.None; + + [Description("This item applies only when OffsetType = 1. It is the name of the defined joint pattern that is used to calculate the joint offsets.")] + public virtual string OffsetPattern { get; set; } = ""; + [Description("This item applies only when OffsetType = 1. It is the scale factor applied to the joint pattern when calculating the joint offsets.")] + public virtual double OffsetPatternSF { get; set; } = 0; + [Description("This item applies only when OffsetType = 2. It 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..28540e4 100644 --- a/SAP2000_oM/SAP2000_oM.csproj +++ b/SAP2000_oM/SAP2000_oM.csproj @@ -63,10 +63,15 @@ + + + + + From cdd92aba0890851eca08472f8e5adf1f4d5502fd Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Thu, 26 Aug 2021 17:35:08 -0400 Subject: [PATCH 02/24] Moving fragment setting into the adapter nothing was gained having it in Engine, if we have public methods to set these fragments they should be more sophisticated. --- SAP2000_Adapter/CRUD/Read/Panel.cs | 42 +++++++++++--- SAP2000_Engine/Modify/SetPanel.cs | 87 ---------------------------- SAP2000_Engine/SAP2000_Engine.csproj | 1 - 3 files changed, 35 insertions(+), 95 deletions(-) delete mode 100644 SAP2000_Engine/Modify/SetPanel.cs diff --git a/SAP2000_Adapter/CRUD/Read/Panel.cs b/SAP2000_Adapter/CRUD/Read/Panel.cs index efc85ea..07359b6 100644 --- a/SAP2000_Adapter/CRUD/Read/Panel.cs +++ b/SAP2000_Adapter/CRUD/Read/Panel.cs @@ -28,9 +28,11 @@ using System.Collections.Generic; using System.Linq; using BH.oM.Adapters.SAP2000; +using BH.oM.Adapters.SAP2000.Elements; using BH.Engine.Adapters.SAP2000; using BH.Engine.Adapter; using BH.Engine.Units; +using BH.Engine.Base; using System; using SAP2000v1; @@ -137,10 +139,27 @@ private List ReadPanel(List ids = null) if (meshType != (int)PanelAutoMeshType.None) { - bhomPanel = bhomPanel.SetPanelAutoMesh((PanelAutoMeshType)meshType, n1, n2, maxSize1, maxSize2, - pointOnEdgeFromLine, pointOnEdgeFromPoint, extendCookieCutLines, Engine.Units.Convert.FromDegree(rotation), - maxSizeGeneral, localAxesOnEdge, localAxesOnFace, restraintsOnEdge, - restraintsOnFace, group, subMesh, subMeshSize); + PanelAutoMesh fragment = new PanelAutoMesh() + { + MeshType = (PanelAutoMeshType)meshType, + N1 = n1, + N2 = n2, + MaxSize1 = maxSize1, + MaxSize2 = maxSize2, + PointOnEdgeFromLine = pointOnEdgeFromLine, + PointOnEdgeFromPoint = pointOnEdgeFromPoint, + ExtendCookieCutLines = extendCookieCutLines, + Rotation = rotation.FromDegree(), + MaxSizeGeneral = maxSizeGeneral, + LocalAxesOnEdge = localAxesOnEdge, + LocalAxesOnFace = localAxesOnFace, + RestraintsOnEdge = restraintsOnEdge, + RestraintsOnFace = restraintsOnFace, + Group = group, + SubMesh = subMesh, + SubMeshSize = subMeshSize, + }; + bhomPanel.AddFragment(fragment); } // Edge Constraint @@ -149,7 +168,7 @@ private List ReadPanel(List ids = null) m_model.AreaObj.GetEdgeConstraint(id, ref constraintExists); if (constraintExists) - bhomPanel = bhomPanel.SetPanelEdgeConstraint(constraintExists); + bhomPanel.AddFragment(new PanelEdgeConstraint() { EdgeConstraint = true}); // Material Overwrite @@ -173,8 +192,17 @@ private List ReadPanel(List ids = null) m_model.AreaObj.GetOffsets(id, ref offsetType, ref offsetPattern, ref offsetPatternSF, ref offset); - if (offsetType > 0) - bhomPanel = bhomPanel.SetPanelOffset((PanelOffsetType)offsetType, offsetPattern, offsetPatternSF, offset); + if (offsetType != (int)PanelOffsetType.None) + { + PanelOffset fragment = new PanelOffset() + { + OffsetType = (PanelOffsetType)offsetType, + OffsetPattern = offsetPattern, + OffsetPatternSF = offsetPatternSF, + Offset = offset + }; + bhomPanel.AddFragment(fragment); + } //Add the panel to the list bhomPanels.Add(bhomPanel); diff --git a/SAP2000_Engine/Modify/SetPanel.cs b/SAP2000_Engine/Modify/SetPanel.cs deleted file mode 100644 index 675e2ff..0000000 --- a/SAP2000_Engine/Modify/SetPanel.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, 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.Elements; -using BH.oM.Adapters.SAP2000; -using BH.Engine.Base; - -namespace BH.Engine.Adapters.SAP2000 -{ - public static partial class Modify - { - public static Panel SetPanelAutoMesh(this Panel panel, PanelAutoMeshType meshType, int n1, int n2, double maxSize1, double maxSize2, bool - pointOnEdgeFromLine, bool pointOnEdgeFromPoint, bool extendCookieCutLines, double rotation, - double maxSizeGeneral, bool localAxesOnEdge, bool localAxesOnFace, bool restraintsOnEdge, - bool restraintsOnFace, string group, bool subMesh, double subMeshSize) - { - - PanelAutoMesh fragment = new PanelAutoMesh() - { - MeshType = meshType, - N1 = n1, - N2 = n2, - MaxSize1 = maxSize1, - MaxSize2 = maxSize2, - PointOnEdgeFromLine = pointOnEdgeFromLine, - PointOnEdgeFromPoint = pointOnEdgeFromPoint, - ExtendCookieCutLines = extendCookieCutLines, - Rotation = rotation, - MaxSizeGeneral = maxSizeGeneral, - LocalAxesOnEdge = localAxesOnEdge, - LocalAxesOnFace = localAxesOnFace, - RestraintsOnEdge = restraintsOnEdge, - RestraintsOnFace = restraintsOnFace, - Group = group, - SubMesh = subMesh, - SubMeshSize = subMeshSize, - }; - return (Panel)panel.AddFragment(fragment); - } - public static Panel SetPanelEdgeConstraint(this Panel panel, bool edgeConstraint) - { - - PanelEdgeConstraint fragment = new PanelEdgeConstraint() - { - EdgeConstraint = edgeConstraint - }; - return (Panel)panel.AddFragment(fragment); - } - - public static Panel SetPanelOffset(this Panel panel, PanelOffsetType offsetType, string offsetPattern, double offsetPatternSF, double[] offset) - { - PanelOffset fragment = new PanelOffset() - { - OffsetType = offsetType, - OffsetPattern = offsetPattern, - OffsetPatternSF = offsetPatternSF, - Offset = offset - }; - return (Panel)panel.AddFragment(fragment); - } - } -} diff --git a/SAP2000_Engine/SAP2000_Engine.csproj b/SAP2000_Engine/SAP2000_Engine.csproj index 370a293..b98651f 100644 --- a/SAP2000_Engine/SAP2000_Engine.csproj +++ b/SAP2000_Engine/SAP2000_Engine.csproj @@ -142,7 +142,6 @@ - From 5d447fe127cd65bf6de149d6667b97e650220dec Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Tue, 7 Sep 2021 13:22:20 -0400 Subject: [PATCH 03/24] PanelAutoMesh and PanelOffset as Interfaces --- SAP2000_Adapter/CRUD/Read/Panel.cs | 134 +++++++++++++++++------ SAP2000_Engine/Query/Panel.cs | 8 +- SAP2000_oM/Fragments/PanelAutoMesh.cs | 151 +++++++++++++++++--------- SAP2000_oM/Fragments/PanelOffset.cs | 20 ++-- 4 files changed, 218 insertions(+), 95 deletions(-) diff --git a/SAP2000_Adapter/CRUD/Read/Panel.cs b/SAP2000_Adapter/CRUD/Read/Panel.cs index 07359b6..6460b0b 100644 --- a/SAP2000_Adapter/CRUD/Read/Panel.cs +++ b/SAP2000_Adapter/CRUD/Read/Panel.cs @@ -137,29 +137,91 @@ private List ReadPanel(List ids = null) ref rotation, ref maxSizeGeneral, ref localAxesOnEdge, ref localAxesOnFace, ref restraintsOnEdge, ref restraintsOnFace, ref group, ref subMesh, ref subMeshSize); - if (meshType != (int)PanelAutoMeshType.None) + switch ((PanelAutoMeshType)meshType) { - PanelAutoMesh fragment = new PanelAutoMesh() - { - MeshType = (PanelAutoMeshType)meshType, - N1 = n1, - N2 = n2, - MaxSize1 = maxSize1, - MaxSize2 = maxSize2, - PointOnEdgeFromLine = pointOnEdgeFromLine, - PointOnEdgeFromPoint = pointOnEdgeFromPoint, - ExtendCookieCutLines = extendCookieCutLines, - Rotation = rotation.FromDegree(), - MaxSizeGeneral = maxSizeGeneral, - LocalAxesOnEdge = localAxesOnEdge, - LocalAxesOnFace = localAxesOnFace, - RestraintsOnEdge = restraintsOnEdge, - RestraintsOnFace = restraintsOnFace, - Group = group, - SubMesh = subMesh, - SubMeshSize = subMeshSize, - }; - bhomPanel.AddFragment(fragment); + case PanelAutoMeshType.NumberOfObjects: + 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 PanelAutoMeshType.MaximumSize: + 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 PanelAutoMeshType.PointsOnEdges: + 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 PanelAutoMeshType.CookieCutLines: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByCookieCutLines() + { + ExtendCookieCutLines = extendCookieCutLines, + LocalAxesOnEdge = localAxesOnEdge, + LocalAxesOnFace = localAxesOnFace, + RestraintsOnEdge = restraintsOnEdge, + RestraintsOnFace = restraintsOnFace, + Group = group, + SubMesh = subMesh, + SubMeshSize = subMeshSize + }) ; + break; + case PanelAutoMeshType.CookieCutPoints: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByCookieCutPoints() + { + Rotation = rotation.FromDegree(), + LocalAxesOnEdge = localAxesOnEdge, + LocalAxesOnFace = localAxesOnFace, + RestraintsOnEdge = restraintsOnEdge, + RestraintsOnFace = restraintsOnFace, + Group = group, + SubMesh = subMesh, + SubMeshSize = subMeshSize + }) ; + break; + case PanelAutoMeshType.GeneralDivide: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByGeneralDivide() + { + MaxSizeGeneral = maxSizeGeneral, + LocalAxesOnEdge = localAxesOnEdge, + LocalAxesOnFace = localAxesOnFace, + RestraintsOnEdge = restraintsOnEdge, + RestraintsOnFace = restraintsOnFace, + Group = group, + SubMesh = subMesh, + SubMeshSize = subMeshSize + }); + break; + case PanelAutoMeshType.None: + default: + break; } // Edge Constraint @@ -168,7 +230,7 @@ private List ReadPanel(List ids = null) m_model.AreaObj.GetEdgeConstraint(id, ref constraintExists); if (constraintExists) - bhomPanel.AddFragment(new PanelEdgeConstraint() { EdgeConstraint = true}); + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelEdgeConstraint() { EdgeConstraint = true}); // Material Overwrite @@ -192,16 +254,24 @@ private List ReadPanel(List ids = null) m_model.AreaObj.GetOffsets(id, ref offsetType, ref offsetPattern, ref offsetPatternSF, ref offset); - if (offsetType != (int)PanelOffsetType.None) + switch ((PanelOffsetType)offsetType) { - PanelOffset fragment = new PanelOffset() - { - OffsetType = (PanelOffsetType)offsetType, - OffsetPattern = offsetPattern, - OffsetPatternSF = offsetPatternSF, - Offset = offset - }; - bhomPanel.AddFragment(fragment); + case PanelOffsetType.ByJointPattern: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelOffsetByJointPattern() + { + OffsetPattern = offsetPattern, + OffsetPatternSF = offsetPatternSF + }); + break; + case PanelOffsetType.ByPoint: + bhomPanel = (Panel)bhomPanel.AddFragment(new PanelOffsetByPoint() + { + Offset = offset, + }) ; + break; + case PanelOffsetType.None: + default: + break; } //Add the panel to the list diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index e3cc3ee..05ed9ac 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -34,17 +34,17 @@ namespace BH.Engine.Adapters.SAP2000 { public static partial class Query { - public static PanelAutoMesh PanelAutoMesh(this Panel panel) + public static IPanelAutoMesh PanelAutoMesh(this Panel panel) { - return panel.FindFragment(); + return panel.FindFragment(); } public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) { return panel.FindFragment(); } - public static PanelOffset PanelOffset(this Panel panel) + public static IPanelOffset PanelOffset(this Panel panel) { - return panel.FindFragment(); + return panel.FindFragment(); } } diff --git a/SAP2000_oM/Fragments/PanelAutoMesh.cs b/SAP2000_oM/Fragments/PanelAutoMesh.cs index fc21a3b..b5109d8 100644 --- a/SAP2000_oM/Fragments/PanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/PanelAutoMesh.cs @@ -30,86 +30,133 @@ namespace BH.oM.Adapters.SAP2000.Elements { - public class PanelAutoMesh : IFragment + public partial interface IPanelAutoMesh : IFragment { - [Description("This item is 0, 1, 2, 3, 4, 5 or 6, indicating the automatic mesh type for the area object.")] - public virtual PanelAutoMeshType MeshType { get; set; } = PanelAutoMeshType.None; + [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("This item applies when MeshType = 1. It is the number of objects " + - "created along the edge of the meshed area object that runs from point 1 to point 2.")] + [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; } + } + public class PanelAutoMeshByNumberOfObjects : IPanelAutoMesh + { + [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; } = 0; - [Description("This item applies when MeshType = 1. It is the number of objects " + + [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; } = 0; - - [Description("This item applies when MeshType = 2. It 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 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; } = null; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } + public class PanelAutoMeshByMaximumSize: IPanelAutoMesh + { + [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; } = 0; - [Description("This item applies when MeshType = 2. It is the maximum size of objects " + + [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; } = 0; - - [Description("This item applies when MeshType = 3. If it is True, points on the area " + + 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; } = null; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } + public class PanelAutoMeshByPointsOnEdges : IPanelAutoMesh + { + [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; } = false; - [Description("This item applies when MeshType = 3. If it is True, points on the area " + + [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; } = false; - - [Description("This item applies when MeshType = 4. MeshType = 4 provides cookie cut " + - "meshing based on straight line objects included in the group specified by the Group " + - "item that intersect the area object edges. If the ExtendCookieCutLines item is True, " + + 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; } = null; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } + public class PanelAutoMeshByCookieCutLines : IPanelAutoMesh + { + [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; } = false; - - [Description("This item applies when MeshType = 5. MeshType = 5 provides cookie cut meshing based " + - "on two perpendicular lines passing through point objects included in the group specified by " + - "the Group item. By default these lines align with the area object local 1 and 2 axes. The " + - "Rotation item is an angle in degrees that the meshing lines are rotated from their default orientation. [deg]")] //CONVERT TO RADIANS + 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; } = null; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } + public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh + { + [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; } = 0; - - [Description("This item applies when MeshType = 6. It is the maximum size of objects created by " + - "the General Divide Tool.")] + 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; } = null; + public virtual bool SubMesh { get; set; } = false; + public virtual double SubMeshSize { get; set; } = 0; + } + public class PanelAutoMeshByGeneralDivide : IPanelAutoMesh + { + [Description("This It is the maximum size of objects created by " + +"the General Divide Tool.")] public virtual double MaxSizeGeneral { get; set; } = 0; - - [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.")] public virtual bool LocalAxesOnEdge { get; set; } = false; - - [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.")] public virtual bool LocalAxesOnFace { get; set; } = false; - - [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.")] public virtual bool RestraintsOnEdge { get; set; } = false; - - [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.")] public virtual bool RestraintsOnFace { get; set; } = false; - - [Description("The name of a defined group. Some of the meshing options make use of point " + - "and line objects included in this group.")] public virtual string Group { get; set; } = null; - - [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.")] public virtual bool SubMesh { get; set; } = false; - - [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.")] public virtual double SubMeshSize { get; set; } = 0; } } diff --git a/SAP2000_oM/Fragments/PanelOffset.cs b/SAP2000_oM/Fragments/PanelOffset.cs index 941e12f..a10fac2 100644 --- a/SAP2000_oM/Fragments/PanelOffset.cs +++ b/SAP2000_oM/Fragments/PanelOffset.cs @@ -30,16 +30,22 @@ namespace BH.oM.Adapters.SAP2000.Elements { - public class PanelOffset : IFragment - { - [Description("This is 0, 1 or 2, indicating the joint offset type.")] - public virtual PanelOffsetType OffsetType { get; set; } = PanelOffsetType.None; + public partial interface IPanelOffset : IFragment + { - [Description("This item applies only when OffsetType = 1. It is the name of the defined joint pattern that is used to calculate the joint offsets.")] + } + + 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; } = ""; - [Description("This item applies only when OffsetType = 1. It is the scale factor applied to the joint pattern when calculating the joint offsets.")] + [Description("This is the scale factor applied to the joint pattern when calculating the joint offsets.")] public virtual double OffsetPatternSF { get; set; } = 0; - [Description("This item applies only when OffsetType = 2. It is an array of joint offsets for each of the points that define the area object.")] + } + + public class PanelOffsetByPoint : IPanelOffset + { + [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; } } From 3dbd80896bbb88ebfad72be7ff69ce9fbf5b68bc Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Tue, 7 Sep 2021 13:30:16 -0400 Subject: [PATCH 04/24] Units Engine Path --- SAP2000_Adapter/SAP2000_Adapter.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SAP2000_Adapter/SAP2000_Adapter.csproj b/SAP2000_Adapter/SAP2000_Adapter.csproj index 36f0635..3117209 100644 --- a/SAP2000_Adapter/SAP2000_Adapter.csproj +++ b/SAP2000_Adapter/SAP2000_Adapter.csproj @@ -173,7 +173,8 @@ - ..\..\..\..\..\..\ProgramData\BHoM\Assemblies\Units_Engine.dll + C:\ProgramData\BHoM\Assemblies\Units_Engine.dll + False From e55796b301afd4edced638ff154febfb10a8a123 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Tue, 7 Sep 2021 13:51:02 -0400 Subject: [PATCH 05/24] messin' with units. --- SAP2000_Adapter/SAP2000_Adapter.csproj | 6 ++++++ SAP2000_oM/Fragments/PanelAutoMesh.cs | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/SAP2000_Adapter/SAP2000_Adapter.csproj b/SAP2000_Adapter/SAP2000_Adapter.csproj index 3117209..6c9937c 100644 --- a/SAP2000_Adapter/SAP2000_Adapter.csproj +++ b/SAP2000_Adapter/SAP2000_Adapter.csproj @@ -126,6 +126,12 @@ False False + + C:\ProgramData\BHoM\Assemblies\Quantities_oM.dll + False + False + + C:\ProgramData\BHoM\Assemblies\Results_Engine.dll False diff --git a/SAP2000_oM/Fragments/PanelAutoMesh.cs b/SAP2000_oM/Fragments/PanelAutoMesh.cs index b5109d8..56a4f95 100644 --- a/SAP2000_oM/Fragments/PanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/PanelAutoMesh.cs @@ -25,6 +25,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using BH.oM.Reflection.Attributes; +using BH.oM.Quantities.Attributes; using System.ComponentModel; using BH.oM.Base; @@ -85,10 +87,12 @@ public class PanelAutoMeshByNumberOfObjects : IPanelAutoMesh } public class PanelAutoMeshByMaximumSize: IPanelAutoMesh { + [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; } = 0; + [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; } = 0; @@ -135,6 +139,7 @@ public class PanelAutoMeshByCookieCutLines : IPanelAutoMesh } public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh { + [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; } = 0; @@ -148,7 +153,8 @@ public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh } public class PanelAutoMeshByGeneralDivide : IPanelAutoMesh { - [Description("This It is the maximum size of objects created by " + + [Length] + [Description("This is the maximum size of objects created by " + "the General Divide Tool.")] public virtual double MaxSizeGeneral { get; set; } = 0; public virtual bool LocalAxesOnEdge { get; set; } = false; From 15fefd4d124b77fe16b9cb31838087854dc68dbc Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Tue, 7 Sep 2021 15:27:02 -0400 Subject: [PATCH 06/24] Adding support for creating panels with fragments --- SAP2000_Adapter/CRUD/Create/Panel.cs | 204 +++++++++++++++++++++++++ SAP2000_Adapter/SAP2000_Adapter.csproj | 1 - SAP2000_oM/Fragments/PanelAutoMesh.cs | 15 ++ SAP2000_oM/Fragments/PanelOffset.cs | 6 +- SAP2000_oM/SAP2000_oM.csproj | 5 + 5 files changed, 229 insertions(+), 2 deletions(-) diff --git a/SAP2000_Adapter/CRUD/Create/Panel.cs b/SAP2000_Adapter/CRUD/Create/Panel.cs index 20a98a0..ad829df 100644 --- a/SAP2000_Adapter/CRUD/Create/Panel.cs +++ b/SAP2000_Adapter/CRUD/Create/Panel.cs @@ -23,10 +23,14 @@ 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 BH.Engine.Units; using System.Collections.Generic; using System.Linq; using BH.oM.Adapters.SAP2000; +using BH.oM.Adapters.SAP2000.Elements; using BH.Engine.Adapter; using System.Reflection; @@ -111,8 +115,208 @@ 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(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, + (int)fragment.MeshType, + 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, + (int)fragment.MeshType, + 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, + (int)fragment.MeshType, + 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, + (int)fragment.MeshType, + 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, + (int)fragment.MeshType, + 2, + 2, + 0, + 0, + false, + false, + false, + fragment.Rotation.ToDegree(), + 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, + (int)fragment.MeshType, + 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, (int)fragment.OffsetType, 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, (int)fragment.OffsetType, "", 0, ref offsets) == 0; + return success && offsets == fragment.Offset; + } + + /***************************************************/ } } diff --git a/SAP2000_Adapter/SAP2000_Adapter.csproj b/SAP2000_Adapter/SAP2000_Adapter.csproj index 6c9937c..b10a445 100644 --- a/SAP2000_Adapter/SAP2000_Adapter.csproj +++ b/SAP2000_Adapter/SAP2000_Adapter.csproj @@ -131,7 +131,6 @@ False False - C:\ProgramData\BHoM\Assemblies\Results_Engine.dll False diff --git a/SAP2000_oM/Fragments/PanelAutoMesh.cs b/SAP2000_oM/Fragments/PanelAutoMesh.cs index 56a4f95..d9a7e79 100644 --- a/SAP2000_oM/Fragments/PanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/PanelAutoMesh.cs @@ -34,6 +34,9 @@ namespace BH.oM.Adapters.SAP2000.Elements { public partial interface IPanelAutoMesh : IFragment { + [Description("meshType")] + PanelAutoMeshType MeshType { get; } + [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.")] @@ -70,6 +73,8 @@ public partial interface IPanelAutoMesh : IFragment } public class PanelAutoMeshByNumberOfObjects : IPanelAutoMesh { + public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.NumberOfObjects; + [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; } = 0; @@ -87,6 +92,8 @@ public class PanelAutoMeshByNumberOfObjects : IPanelAutoMesh } public class PanelAutoMeshByMaximumSize: IPanelAutoMesh { + public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.MaximumSize; + [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.")] @@ -106,6 +113,8 @@ public class PanelAutoMeshByMaximumSize: IPanelAutoMesh } public class PanelAutoMeshByPointsOnEdges : IPanelAutoMesh { + public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.PointsOnEdges; + [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.")] @@ -125,6 +134,8 @@ public class PanelAutoMeshByPointsOnEdges : IPanelAutoMesh } public class PanelAutoMeshByCookieCutLines : IPanelAutoMesh { + public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.CookieCutLines; + [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.")] @@ -139,6 +150,8 @@ public class PanelAutoMeshByCookieCutLines : IPanelAutoMesh } public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh { + public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.CookieCutPoints; + [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.")] @@ -153,6 +166,8 @@ public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh } public class PanelAutoMeshByGeneralDivide : IPanelAutoMesh { + public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.GeneralDivide; + [Length] [Description("This is the maximum size of objects created by " + "the General Divide Tool.")] diff --git a/SAP2000_oM/Fragments/PanelOffset.cs b/SAP2000_oM/Fragments/PanelOffset.cs index a10fac2..678502f 100644 --- a/SAP2000_oM/Fragments/PanelOffset.cs +++ b/SAP2000_oM/Fragments/PanelOffset.cs @@ -32,11 +32,13 @@ namespace BH.oM.Adapters.SAP2000.Elements { public partial interface IPanelOffset : IFragment { - + PanelOffsetType OffsetType { get; } } public class PanelOffsetByJointPattern : IPanelOffset { + public virtual PanelOffsetType OffsetType { get; } = PanelOffsetType.ByJointPattern; + [Description("This is the name of the defined joint pattern that is used to calculate the joint offsets.")] public virtual string OffsetPattern { get; set; } = ""; [Description("This is the scale factor applied to the joint pattern when calculating the joint offsets.")] @@ -45,6 +47,8 @@ public class PanelOffsetByJointPattern : IPanelOffset public class PanelOffsetByPoint : IPanelOffset { + public virtual PanelOffsetType OffsetType { get; } = PanelOffsetType.ByPoint; + [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 28540e4..4bc21ab 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 From 8f47bb12f5fc341eb3ecfaac70374b10ee8c58a8 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Wed, 8 Sep 2021 13:55:12 -0400 Subject: [PATCH 07/24] Fixed fragments and default values, deleted enums --- SAP2000_Adapter/CRUD/Create/Panel.cs | 27 ++++--- SAP2000_Adapter/CRUD/Read/Panel.cs | 38 +++++----- SAP2000_Engine/Query/Panel.cs | 2 +- SAP2000_oM/Enums/PanelAutoMeshType.cs | 41 ---------- SAP2000_oM/Enums/PanelOffsetType.cs | 37 --------- SAP2000_oM/Fragments/PanelAutoMesh.cs | 84 ++++++++++----------- SAP2000_oM/Fragments/PanelEdgeConstraint.cs | 11 +-- SAP2000_oM/Fragments/PanelOffset.cs | 12 +-- SAP2000_oM/SAP2000_oM.csproj | 2 - 9 files changed, 84 insertions(+), 170 deletions(-) delete mode 100644 SAP2000_oM/Enums/PanelAutoMeshType.cs delete mode 100644 SAP2000_oM/Enums/PanelOffsetType.cs diff --git a/SAP2000_Adapter/CRUD/Create/Panel.cs b/SAP2000_Adapter/CRUD/Create/Panel.cs index ad829df..f1e66c6 100644 --- a/SAP2000_Adapter/CRUD/Create/Panel.cs +++ b/SAP2000_Adapter/CRUD/Create/Panel.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Linq; using BH.oM.Adapters.SAP2000; -using BH.oM.Adapters.SAP2000.Elements; +using BH.oM.Adapters.SAP2000.Fragments; using BH.Engine.Adapter; using System.Reflection; @@ -129,6 +129,13 @@ private bool SetObject(Panel bhPanel) /***************************************************/ + private bool SetPanelFragment(SAP2000Id fragment, string name) + { + return true; + } + + /***************************************************/ + private bool SetPanelFragment(IFragment fragment, string name) { return false; @@ -146,7 +153,7 @@ private bool SetPanelFragment(IPanelAutoMesh fragment, string name) private bool SetPanelFragment(PanelAutoMeshByNumberOfObjects fragment, string name) { return m_model.AreaObj.SetAutoMesh(name, - (int)fragment.MeshType, + 1, fragment.N1, fragment.N2, 0, @@ -170,7 +177,7 @@ private bool SetPanelFragment(PanelAutoMeshByNumberOfObjects fragment, string na private bool SetPanelFragment(PanelAutoMeshByMaximumSize fragment, string name) { return m_model.AreaObj.SetAutoMesh(name, - (int)fragment.MeshType, + 2, 2, 2, fragment.MaxSize1, @@ -194,7 +201,7 @@ private bool SetPanelFragment(PanelAutoMeshByMaximumSize fragment, string name) private bool SetPanelFragment(PanelAutoMeshByPointsOnEdges fragment, string name) { return m_model.AreaObj.SetAutoMesh(name, - (int)fragment.MeshType, + 3, 2, 2, 0, @@ -218,7 +225,7 @@ private bool SetPanelFragment(PanelAutoMeshByPointsOnEdges fragment, string name private bool SetPanelFragment(PanelAutoMeshByCookieCutLines fragment, string name) { return m_model.AreaObj.SetAutoMesh(name, - (int)fragment.MeshType, + 4, 2, 2, 0, @@ -242,7 +249,7 @@ private bool SetPanelFragment(PanelAutoMeshByCookieCutLines fragment, string nam private bool SetPanelFragment(PanelAutoMeshByCookieCutPoints fragment, string name) { return m_model.AreaObj.SetAutoMesh(name, - (int)fragment.MeshType, + 5, 2, 2, 0, @@ -266,7 +273,7 @@ private bool SetPanelFragment(PanelAutoMeshByCookieCutPoints fragment, string na private bool SetPanelFragment(PanelAutoMeshByGeneralDivide fragment, string name) { return m_model.AreaObj.SetAutoMesh(name, - (int)fragment.MeshType, + 6, 2, 2, 0, @@ -304,7 +311,7 @@ private bool SetPanelFragment(IPanelOffset fragment, string name) private bool SetPanelFragment(PanelOffsetByJointPattern fragment, string name) { double[] offsets = new double[4]; - return m_model.AreaObj.SetOffsets(name, (int)fragment.OffsetType, fragment.OffsetPattern, fragment.OffsetPatternSF, ref offsets) == 0; + return m_model.AreaObj.SetOffsets(name, 1, fragment.OffsetPattern, fragment.OffsetPatternSF, ref offsets) == 0; } /***************************************************/ @@ -312,8 +319,8 @@ private bool SetPanelFragment(PanelOffsetByJointPattern fragment, string name) private bool SetPanelFragment(PanelOffsetByPoint fragment, string name) { double[] offsets = fragment.Offset; - bool success = m_model.AreaObj.SetOffsets(name, (int)fragment.OffsetType, "", 0, ref offsets) == 0; - return success && offsets == fragment.Offset; + bool success = m_model.AreaObj.SetOffsets(name, 2, "", 0, ref offsets) == 0; + return success && offsets.SequenceEqual(fragment.Offset); } /***************************************************/ diff --git a/SAP2000_Adapter/CRUD/Read/Panel.cs b/SAP2000_Adapter/CRUD/Read/Panel.cs index 6460b0b..46d5881 100644 --- a/SAP2000_Adapter/CRUD/Read/Panel.cs +++ b/SAP2000_Adapter/CRUD/Read/Panel.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; using System.Linq; using BH.oM.Adapters.SAP2000; -using BH.oM.Adapters.SAP2000.Elements; +using BH.oM.Adapters.SAP2000.Fragments; using BH.Engine.Adapters.SAP2000; using BH.Engine.Adapter; using BH.Engine.Units; @@ -114,7 +114,7 @@ private List ReadPanel(List ids = null) // Automesh - int meshType = (int)PanelAutoMeshType.None; + int meshType = 0; int n1 = 0; int n2 = 0; double maxSize1 = 0; @@ -137,9 +137,9 @@ private List ReadPanel(List ids = null) ref rotation, ref maxSizeGeneral, ref localAxesOnEdge, ref localAxesOnFace, ref restraintsOnEdge, ref restraintsOnFace, ref group, ref subMesh, ref subMeshSize); - switch ((PanelAutoMeshType)meshType) + switch (meshType) { - case PanelAutoMeshType.NumberOfObjects: + case 1: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByNumberOfObjects() { N1 = n1, N2 = n2, @@ -152,7 +152,7 @@ private List ReadPanel(List ids = null) SubMeshSize = subMeshSize }); break; - case PanelAutoMeshType.MaximumSize: + case 2: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByMaximumSize() { MaxSize1 = maxSize1, @@ -166,7 +166,7 @@ private List ReadPanel(List ids = null) SubMeshSize = subMeshSize }); break; - case PanelAutoMeshType.PointsOnEdges: + case 3: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByPointsOnEdges() { PointOnEdgeFromLine = pointOnEdgeFromLine, @@ -180,7 +180,7 @@ private List ReadPanel(List ids = null) SubMeshSize = subMeshSize }); ; break; - case PanelAutoMeshType.CookieCutLines: + case 4: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByCookieCutLines() { ExtendCookieCutLines = extendCookieCutLines, @@ -193,7 +193,7 @@ private List ReadPanel(List ids = null) SubMeshSize = subMeshSize }) ; break; - case PanelAutoMeshType.CookieCutPoints: + case 5: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByCookieCutPoints() { Rotation = rotation.FromDegree(), @@ -206,7 +206,7 @@ private List ReadPanel(List ids = null) SubMeshSize = subMeshSize }) ; break; - case PanelAutoMeshType.GeneralDivide: + case 6: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByGeneralDivide() { MaxSizeGeneral = maxSizeGeneral, @@ -219,7 +219,7 @@ private List ReadPanel(List ids = null) SubMeshSize = subMeshSize }); break; - case PanelAutoMeshType.None: + case 0: default: break; } @@ -234,42 +234,42 @@ private List ReadPanel(List ids = null) // Material Overwrite - string propName = ""; + string matName = ""; - m_model.AreaObj.GetMaterialOverwrite(id, ref propName); + m_model.AreaObj.GetMaterialOverwrite(id, ref matName); - if (propName != "None") + if (matName != "None") { ISurfaceProperty property = Engine.Base.Query.ShallowClone(bhomPanel.Property); - property.Material = ReadMaterial(new List { propName }).FirstOrDefault(); + property.Material = ReadMaterial(new List { matName }).FirstOrDefault(); + property.Name = property.Name + "-" + matName; bhomPanel.Property = property; } // Offsets - int offsetType = (int)PanelOffsetType.None; + 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 ((PanelOffsetType)offsetType) + switch (offsetType) { - case PanelOffsetType.ByJointPattern: + case 1: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelOffsetByJointPattern() { OffsetPattern = offsetPattern, OffsetPatternSF = offsetPatternSF }); break; - case PanelOffsetType.ByPoint: + case 2: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelOffsetByPoint() { Offset = offset, }) ; break; - case PanelOffsetType.None: default: break; } diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index 05ed9ac..913e2ae 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -26,7 +26,7 @@ using System.Text; using System.Threading.Tasks; using BH.oM.Structure.Elements; -using BH.oM.Adapters.SAP2000.Elements; +using BH.oM.Adapters.SAP2000.Fragments; using BH.oM.Adapters.SAP2000; using BH.Engine.Base; diff --git a/SAP2000_oM/Enums/PanelAutoMeshType.cs b/SAP2000_oM/Enums/PanelAutoMeshType.cs deleted file mode 100644 index e041d30..0000000 --- a/SAP2000_oM/Enums/PanelAutoMeshType.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, 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; - -namespace BH.oM.Adapters.SAP2000 -{ - public enum PanelAutoMeshType : int - { - None = 0, - NumberOfObjects = 1, - MaximumSize = 2, - PointsOnEdges = 3, - CookieCutLines = 4, - CookieCutPoints = 5, - GeneralDivide = 6 - } -} diff --git a/SAP2000_oM/Enums/PanelOffsetType.cs b/SAP2000_oM/Enums/PanelOffsetType.cs deleted file mode 100644 index 5e6252a..0000000 --- a/SAP2000_oM/Enums/PanelOffsetType.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, 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; - -namespace BH.oM.Adapters.SAP2000 -{ - public enum PanelOffsetType : int - { - None = 0, - ByJointPattern = 1, - ByPoint = 2, - } -} diff --git a/SAP2000_oM/Fragments/PanelAutoMesh.cs b/SAP2000_oM/Fragments/PanelAutoMesh.cs index d9a7e79..58568a3 100644 --- a/SAP2000_oM/Fragments/PanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/PanelAutoMesh.cs @@ -20,27 +20,19 @@ * 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.Reflection.Attributes; +using BH.oM.Base; using BH.oM.Quantities.Attributes; using System.ComponentModel; -using BH.oM.Base; -namespace BH.oM.Adapters.SAP2000.Elements +namespace BH.oM.Adapters.SAP2000.Fragments { - public partial interface IPanelAutoMesh : IFragment + [Description("Base interface for panel auto mesh settings in SAP2000. Contains the type of auto mesh and the properties common to all types.")] + public interface IPanelAutoMesh : IFragment { - [Description("meshType")] - PanelAutoMeshType MeshType { get; } - [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; } + 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 " + @@ -71,112 +63,112 @@ public partial interface IPanelAutoMesh : IFragment "objects to remain when the auto meshing is complete.")] double SubMeshSize { get; set; } } - public class PanelAutoMeshByNumberOfObjects : IPanelAutoMesh - { - public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.NumberOfObjects; + [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; } = 0; + 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; } = 0; + 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; } = null; + public virtual string Group { get; set; } = "ALL"; public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } - public class PanelAutoMeshByMaximumSize: IPanelAutoMesh - { - public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.MaximumSize; + [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; } = 0; + 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; } = 0; + 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; } = null; + public virtual string Group { get; set; } = "ALL"; public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } - public class PanelAutoMeshByPointsOnEdges : IPanelAutoMesh - { - public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.PointsOnEdges; + [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; } = false; + 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; } = false; + 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; } = null; + public virtual string Group { get; set; } = "ALL"; public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } - public class PanelAutoMeshByCookieCutLines : IPanelAutoMesh - { - public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.CookieCutLines; + [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; } = false; + 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; } = null; + public virtual string Group { get; set; } = "ALL"; public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } - public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh - { - public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.CookieCutPoints; + [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; } = 0; + 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; } = null; + public virtual string Group { get; set; } = "ALL"; public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } - public class PanelAutoMeshByGeneralDivide : IPanelAutoMesh - { - public virtual PanelAutoMeshType MeshType { get; } = PanelAutoMeshType.GeneralDivide; + [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; } = 0; + 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; } = null; + 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 index a0ce346..17c827d 100644 --- a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs +++ b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs @@ -20,18 +20,13 @@ * along with this code. If not, see . */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.ComponentModel; using BH.oM.Base; +using System.ComponentModel; -namespace BH.oM.Adapters.SAP2000.Elements +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/PanelOffset.cs b/SAP2000_oM/Fragments/PanelOffset.cs index 678502f..fcee1d0 100644 --- a/SAP2000_oM/Fragments/PanelOffset.cs +++ b/SAP2000_oM/Fragments/PanelOffset.cs @@ -25,30 +25,30 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using BH.oM.Quantities.Attributes; using System.ComponentModel; using BH.oM.Base; -namespace BH.oM.Adapters.SAP2000.Elements +namespace BH.oM.Adapters.SAP2000.Fragments { + [Description("Base interface for panel offsets in SAP. Contains only the type of offset.")] public partial interface IPanelOffset : IFragment { - PanelOffsetType OffsetType { get; } } public class PanelOffsetByJointPattern : IPanelOffset { - public virtual PanelOffsetType OffsetType { get; } = PanelOffsetType.ByJointPattern; - [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; } public class PanelOffsetByPoint : IPanelOffset { - public virtual PanelOffsetType OffsetType { get; } = PanelOffsetType.ByPoint; - + [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 4bc21ab..f01f009 100644 --- a/SAP2000_oM/SAP2000_oM.csproj +++ b/SAP2000_oM/SAP2000_oM.csproj @@ -68,8 +68,6 @@ - - From 4f918d36b2b4a68eabc3c37c8b4d95e8a4fcf76c Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Thu, 9 Sep 2021 10:34:56 -0400 Subject: [PATCH 08/24] Separate files for each class --- SAP2000_oM/Fragments/IPanelAutoMesh.cs | 65 +++++++ .../{PanelOffset.cs => IPanelOffset.cs} | 23 --- SAP2000_oM/Fragments/PanelAutoMesh.cs | 175 ------------------ .../PanelAutoMeshByCookieCutLines.cs | 22 +++ .../PanelAutoMeshByCookieCutPoints.cs | 23 +++ .../Fragments/PanelAutoMeshByGeneralDivide.cs | 23 +++ .../Fragments/PanelAutoMeshByMaximumSize.cs | 28 +++ .../PanelAutoMeshByNumberOfObjects.cs | 25 +++ .../Fragments/PanelAutoMeshByPointsOnEdges.cs | 27 +++ .../Fragments/PanelOffsetByJointPattern.cs | 16 ++ SAP2000_oM/Fragments/PanelOffsetByPoint.cs | 13 ++ SAP2000_oM/SAP2000_oM.csproj | 12 +- 12 files changed, 252 insertions(+), 200 deletions(-) create mode 100644 SAP2000_oM/Fragments/IPanelAutoMesh.cs rename SAP2000_oM/Fragments/{PanelOffset.cs => IPanelOffset.cs} (66%) delete mode 100644 SAP2000_oM/Fragments/PanelAutoMesh.cs create mode 100644 SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs create mode 100644 SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs create mode 100644 SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs create mode 100644 SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs create mode 100644 SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs create mode 100644 SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs create mode 100644 SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs create mode 100644 SAP2000_oM/Fragments/PanelOffsetByPoint.cs diff --git a/SAP2000_oM/Fragments/IPanelAutoMesh.cs b/SAP2000_oM/Fragments/IPanelAutoMesh.cs new file mode 100644 index 0000000..4b28a88 --- /dev/null +++ b/SAP2000_oM/Fragments/IPanelAutoMesh.cs @@ -0,0 +1,65 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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("Base interface for panel auto mesh settings in SAP2000. Contains the type of auto mesh and the properties common to all types.")] + 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/PanelOffset.cs b/SAP2000_oM/Fragments/IPanelOffset.cs similarity index 66% rename from SAP2000_oM/Fragments/PanelOffset.cs rename to SAP2000_oM/Fragments/IPanelOffset.cs index fcee1d0..aaa9dca 100644 --- a/SAP2000_oM/Fragments/PanelOffset.cs +++ b/SAP2000_oM/Fragments/IPanelOffset.cs @@ -20,12 +20,6 @@ * 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.Quantities.Attributes; using System.ComponentModel; using BH.oM.Base; @@ -35,21 +29,4 @@ namespace BH.oM.Adapters.SAP2000.Fragments public partial interface IPanelOffset : IFragment { } - - 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; - } - - 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/Fragments/PanelAutoMesh.cs b/SAP2000_oM/Fragments/PanelAutoMesh.cs deleted file mode 100644 index 58568a3..0000000 --- a/SAP2000_oM/Fragments/PanelAutoMesh.cs +++ /dev/null @@ -1,175 +0,0 @@ -/* - * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, 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("Base interface for panel auto mesh settings in SAP2000. Contains the type of auto mesh and the properties common to all types.")] - 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; } - } - - [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; - } - - [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; - } - - [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; - } - - [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; - } - - [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; - } - - [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/PanelAutoMeshByCookieCutLines.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs new file mode 100644 index 0000000..e8fca51 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs @@ -0,0 +1,22 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs new file mode 100644 index 0000000..659178a --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs @@ -0,0 +1,23 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs new file mode 100644 index 0000000..207f237 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs @@ -0,0 +1,23 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs new file mode 100644 index 0000000..90035d4 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs @@ -0,0 +1,28 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs new file mode 100644 index 0000000..06ce97d --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs @@ -0,0 +1,25 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs new file mode 100644 index 0000000..9994630 --- /dev/null +++ b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs @@ -0,0 +1,27 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs new file mode 100644 index 0000000..3ba08ab --- /dev/null +++ b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs @@ -0,0 +1,16 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs new file mode 100644 index 0000000..ca5c79d --- /dev/null +++ b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs @@ -0,0 +1,13 @@ +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; + } +} \ No newline at end of file diff --git a/SAP2000_oM/SAP2000_oM.csproj b/SAP2000_oM/SAP2000_oM.csproj index f01f009..4889741 100644 --- a/SAP2000_oM/SAP2000_oM.csproj +++ b/SAP2000_oM/SAP2000_oM.csproj @@ -72,12 +72,20 @@ - + + + + + + + - + + + From a3bc6b628ed4be53de4586085c965ebb268da473 Mon Sep 17 00:00:00 2001 From: BHoMBot Date: Thu, 9 Sep 2021 15:43:54 +0100 Subject: [PATCH 09/24] Resolve copyright compliance --- .../PanelAutoMeshByCookieCutLines.cs | 24 ++++++++++++++++++- .../PanelAutoMeshByCookieCutPoints.cs | 24 ++++++++++++++++++- .../Fragments/PanelAutoMeshByGeneralDivide.cs | 24 ++++++++++++++++++- .../Fragments/PanelAutoMeshByMaximumSize.cs | 24 ++++++++++++++++++- .../PanelAutoMeshByNumberOfObjects.cs | 24 ++++++++++++++++++- .../Fragments/PanelAutoMeshByPointsOnEdges.cs | 24 ++++++++++++++++++- .../Fragments/PanelOffsetByJointPattern.cs | 24 ++++++++++++++++++- SAP2000_oM/Fragments/PanelOffsetByPoint.cs | 24 ++++++++++++++++++- 8 files changed, 184 insertions(+), 8 deletions(-) diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs index e8fca51..1c9a805 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs @@ -1,4 +1,26 @@ -using BH.oM.Base; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs index 659178a..a959019 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs @@ -1,4 +1,26 @@ -using BH.oM.Base; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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; diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs index 207f237..1f87e9c 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs @@ -1,4 +1,26 @@ -using BH.oM.Base; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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; diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs index 90035d4..767c0e4 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs @@ -1,4 +1,26 @@ -using BH.oM.Base; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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; diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs index 06ce97d..85e2b91 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs @@ -1,4 +1,26 @@ -using BH.oM.Base; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs index 9994630..6050525 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs @@ -1,4 +1,26 @@ -using BH.oM.Base; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 diff --git a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs index 3ba08ab..c7cf17b 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs @@ -1,4 +1,26 @@ -using BH.oM.Quantities.Attributes; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 diff --git a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs index ca5c79d..b40e9f9 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs @@ -1,4 +1,26 @@ -using BH.oM.Quantities.Attributes; +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2021, 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 From d1c8150d65280f2d04cd047768f1c0350d2a91fb Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Thu, 9 Sep 2021 11:02:51 -0400 Subject: [PATCH 10/24] Adding Units to Dependencies --- dependencies.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dependencies.txt b/dependencies.txt index c859174..f9af9c0 100644 --- a/dependencies.txt +++ b/dependencies.txt @@ -1,3 +1,4 @@ BHoM/BHoM BHoM/BHoM_Engine -BHoM/BHoM_Adapter \ No newline at end of file +BHoM/BHoM_Adapter +BHoM/Localisation_Toolkit \ No newline at end of file From 20fd596ab24885543816ce1a86dd6a1c91d324a0 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Thu, 9 Sep 2021 12:07:36 -0400 Subject: [PATCH 11/24] removing units_engine dependency Only needed for radians to degree conversion, hard-coded instead. --- SAP2000_Adapter/CRUD/Create/Panel.cs | 4 ++-- SAP2000_Adapter/CRUD/Read/Panel.cs | 5 ++--- SAP2000_Adapter/SAP2000_Adapter.csproj | 4 ---- dependencies.txt | 3 +-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/SAP2000_Adapter/CRUD/Create/Panel.cs b/SAP2000_Adapter/CRUD/Create/Panel.cs index f1e66c6..18e2dac 100644 --- a/SAP2000_Adapter/CRUD/Create/Panel.cs +++ b/SAP2000_Adapter/CRUD/Create/Panel.cs @@ -26,9 +26,9 @@ using BH.Engine.Base; using BH.oM.Base; using BH.oM.Geometry; -using BH.Engine.Units; using System.Collections.Generic; using System.Linq; +using System; using BH.oM.Adapters.SAP2000; using BH.oM.Adapters.SAP2000.Fragments; using BH.Engine.Adapter; @@ -257,7 +257,7 @@ private bool SetPanelFragment(PanelAutoMeshByCookieCutPoints fragment, string na false, false, false, - fragment.Rotation.ToDegree(), + fragment.Rotation * 180 / Math.PI, 0, fragment.LocalAxesOnEdge, fragment.LocalAxesOnFace, diff --git a/SAP2000_Adapter/CRUD/Read/Panel.cs b/SAP2000_Adapter/CRUD/Read/Panel.cs index 46d5881..79ef0eb 100644 --- a/SAP2000_Adapter/CRUD/Read/Panel.cs +++ b/SAP2000_Adapter/CRUD/Read/Panel.cs @@ -31,7 +31,6 @@ using BH.oM.Adapters.SAP2000.Fragments; using BH.Engine.Adapters.SAP2000; using BH.Engine.Adapter; -using BH.Engine.Units; using BH.Engine.Base; using System; using SAP2000v1; @@ -196,7 +195,7 @@ private List ReadPanel(List ids = null) case 5: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByCookieCutPoints() { - Rotation = rotation.FromDegree(), + Rotation = rotation * Math.PI / 180, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, @@ -204,7 +203,7 @@ private List ReadPanel(List ids = null) Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize - }) ; + }); break; case 6: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelAutoMeshByGeneralDivide() diff --git a/SAP2000_Adapter/SAP2000_Adapter.csproj b/SAP2000_Adapter/SAP2000_Adapter.csproj index b10a445..6b3b8b5 100644 --- a/SAP2000_Adapter/SAP2000_Adapter.csproj +++ b/SAP2000_Adapter/SAP2000_Adapter.csproj @@ -177,10 +177,6 @@ - - C:\ProgramData\BHoM\Assemblies\Units_Engine.dll - False - diff --git a/dependencies.txt b/dependencies.txt index f9af9c0..c859174 100644 --- a/dependencies.txt +++ b/dependencies.txt @@ -1,4 +1,3 @@ BHoM/BHoM BHoM/BHoM_Engine -BHoM/BHoM_Adapter -BHoM/Localisation_Toolkit \ No newline at end of file +BHoM/BHoM_Adapter \ No newline at end of file From 016f99d11d3147bba015bff0f1f6e5474e9569b7 Mon Sep 17 00:00:00 2001 From: BHoMBot Date: Wed, 24 Nov 2021 16:03:50 +0000 Subject: [PATCH 12/24] Add documentation punctuation --- SAP2000_Adapter/CRUD/Create/Panel.cs | 154 ++---------------- SAP2000_Adapter/CRUD/Read/Panel.cs | 133 +++------------ SAP2000_Engine/Query/Panel.cs | 8 +- SAP2000_oM/Fragments/IPanelAutoMesh.cs | 74 +++++---- SAP2000_oM/Fragments/IPanelOffset.cs | 5 +- .../PanelAutoMeshByCookieCutLines.cs | 69 ++++++-- .../PanelAutoMeshByCookieCutPoints.cs | 68 ++++++-- .../Fragments/PanelAutoMeshByGeneralDivide.cs | 68 ++++++-- .../Fragments/PanelAutoMeshByMaximumSize.cs | 77 +++++++-- .../PanelAutoMeshByNumberOfObjects.cs | 79 +++++++-- .../Fragments/PanelAutoMeshByPointsOnEdges.cs | 81 +++++++-- SAP2000_oM/Fragments/PanelEdgeConstraint.cs | 13 +- .../Fragments/PanelOffsetByJointPattern.cs | 17 +- SAP2000_oM/Fragments/PanelOffsetByPoint.cs | 10 +- 14 files changed, 468 insertions(+), 388 deletions(-) diff --git a/SAP2000_Adapter/CRUD/Create/Panel.cs b/SAP2000_Adapter/CRUD/Create/Panel.cs index 18e2dac..4a02516 100644 --- a/SAP2000_Adapter/CRUD/Create/Panel.cs +++ b/SAP2000_Adapter/CRUD/Create/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.Engine.Geometry; using BH.Engine.Spatial; using BH.oM.Structure.Elements; @@ -41,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 @@ -60,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) { @@ -76,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) @@ -128,186 +116,72 @@ private bool SetObject(Panel bhPanel) } /***************************************************/ - 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; + 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; + 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; + 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; + 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; + 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; + 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]; @@ -315,17 +189,13 @@ private bool SetPanelFragment(PanelOffsetByJointPattern fragment, string name) } /***************************************************/ - private bool SetPanelFragment(PanelOffsetByPoint fragment, string name) { double[] offsets = fragment.Offset; - bool success = m_model.AreaObj.SetOffsets(name, 2, "", 0, ref offsets) == 0; + 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 79ef0eb..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; @@ -42,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) @@ -104,15 +96,11 @@ 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; @@ -130,93 +118,33 @@ private List ReadPanel(List ids = null) 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); - + 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 - }); + 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 - }); + {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 - }); ; + {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 - }) ; + {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 - }); + {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 - }); + {MaxSizeGeneral = maxSizeGeneral, LocalAxesOnEdge = localAxesOnEdge, LocalAxesOnFace = localAxesOnFace, RestraintsOnEdge = restraintsOnEdge, RestraintsOnFace = restraintsOnFace, Group = group, SubMesh = subMesh, SubMeshSize = subMeshSize}); break; case 0: default: @@ -224,50 +152,37 @@ private List ReadPanel(List ids = null) } // Edge Constraint - bool constraintExists = false; - m_model.AreaObj.GetEdgeConstraint(id, ref constraintExists); if (constraintExists) - bhomPanel = (Panel)bhomPanel.AddFragment(new PanelEdgeConstraint() { EdgeConstraint = true}); - + 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.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 - }); + {OffsetPattern = offsetPattern, OffsetPatternSF = offsetPatternSF}); break; case 2: bhomPanel = (Panel)bhomPanel.AddFragment(new PanelOffsetByPoint() - { - Offset = offset, - }) ; + {Offset = offset, }); break; default: break; @@ -279,12 +194,6 @@ private List ReadPanel(List ids = null) return bhomPanels; } - - /***************************************************/ + /***************************************************/ } - - -} - - - +} \ No newline at end of file diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index 913e2ae..a3a7f49 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -1,4 +1,4 @@ -/* +/* * This file is part of the Buildings and Habitats object Model (BHoM) * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. * @@ -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 System; using System.Collections.Generic; using System.Linq; @@ -38,14 +37,15 @@ public static IPanelAutoMesh PanelAutoMesh(this Panel panel) { return panel.FindFragment(); } + public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) { return panel.FindFragment(); } + public static IPanelOffset PanelOffset(this Panel panel) { return panel.FindFragment(); } - } -} +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/IPanelAutoMesh.cs b/SAP2000_oM/Fragments/IPanelAutoMesh.cs index 4b28a88..6a247b5 100644 --- a/SAP2000_oM/Fragments/IPanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/IPanelAutoMesh.cs @@ -1,4 +1,4 @@ -/* +/* * This file is part of the Buildings and Habitats object Model (BHoM) * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. * @@ -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.Base; using System.ComponentModel; @@ -28,38 +27,53 @@ 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.")] 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 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 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 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("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("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("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; } + [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; + } } -} +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/IPanelOffset.cs b/SAP2000_oM/Fragments/IPanelOffset.cs index aaa9dca..b1c0432 100644 --- a/SAP2000_oM/Fragments/IPanelOffset.cs +++ b/SAP2000_oM/Fragments/IPanelOffset.cs @@ -1,4 +1,4 @@ -/* +/* * This file is part of the Buildings and Habitats object Model (BHoM) * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. * @@ -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 System.ComponentModel; using BH.oM.Base; @@ -29,4 +28,4 @@ namespace BH.oM.Adapters.SAP2000.Fragments public partial interface IPanelOffset : IFragment { } -} +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs index 1c9a805..a0217ca 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs @@ -19,26 +19,69 @@ * 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; + [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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs index a959019..b6249bb 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs @@ -19,27 +19,71 @@ * 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; + [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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs index 1f87e9c..c90064f 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs @@ -19,27 +19,71 @@ * 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; + [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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs index 767c0e4..5179548 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs @@ -19,32 +19,79 @@ * 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; } + [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; + [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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs index 85e2b91..51104c0 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs @@ -19,29 +19,76 @@ * 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; + [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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs index 6050525..aad7a0c 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs @@ -19,31 +19,76 @@ * 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; + [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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs index 17c827d..f4b2dc6 100644 --- a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs +++ b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs @@ -1,4 +1,4 @@ -/* +/* * This file is part of the Buildings and Habitats object Model (BHoM) * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. * @@ -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.Base; using System.ComponentModel; @@ -28,6 +27,12 @@ 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; + public virtual bool EdgeConstraint + { + get; + set; + } + + = false; } -} +} \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs index c7cf17b..fb4b7b9 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs @@ -19,20 +19,29 @@ * 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; } = ""; + 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; + public virtual double OffsetPatternSF + { + get; + set; + } + + = 0; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs index b40e9f9..8a81dff 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs @@ -19,17 +19,21 @@ * 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; + public virtual double[] Offset + { + get; + set; + } + + = null; } } \ No newline at end of file From 614c66f54f1156aa5ce74888bb1168cc70970fc3 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Wed, 24 Nov 2021 15:04:45 -0500 Subject: [PATCH 13/24] Adding descriptions for Bar and Panel fragment queries --- SAP2000_Engine/Query/Bar.cs | 14 ++++++++++++++ SAP2000_Engine/Query/Panel.cs | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/SAP2000_Engine/Query/Bar.cs b/SAP2000_Engine/Query/Bar.cs index 95a2358..3cc3e27 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.Reflection.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(); } + [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(); } + [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 index a3a7f49..7a33d88 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -27,22 +27,33 @@ using BH.oM.Structure.Elements; using BH.oM.Adapters.SAP2000.Fragments; using BH.oM.Adapters.SAP2000; +using System.ComponentModel; +using BH.oM.Reflection.Attributes; using BH.Engine.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) { return panel.FindFragment(); } + [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) { return panel.FindFragment(); From 3e4a1617c9e8f06eac0525cb7e7f0be71612e178 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Mon, 29 Nov 2021 10:35:27 -0500 Subject: [PATCH 14/24] Adding null checks and punctuation --- SAP2000_Engine/Query/Bar.cs | 8 ++++---- SAP2000_Engine/Query/Panel.cs | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SAP2000_Engine/Query/Bar.cs b/SAP2000_Engine/Query/Bar.cs index 3cc3e27..79917eb 100644 --- a/SAP2000_Engine/Query/Bar.cs +++ b/SAP2000_Engine/Query/Bar.cs @@ -38,18 +38,18 @@ 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")] + [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")] + [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.")] diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index 7a33d88..86b9d1f 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -37,26 +37,26 @@ 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")] + [Output("PanelAutoMesh", "A fragment containing SAP2000 PanelAutoMesh settings.")] public static IPanelAutoMesh PanelAutoMesh(this Panel panel) { - return panel.FindFragment(); + return panel?.FindFragment(); } [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")] + [Output("PanelEdgeConstraint", "A fragment containing SAP2000 PanelEdgeConstraint settings.")] public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) { - return panel.FindFragment(); + 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")] + [Output("PanelOffset", "A fragment containing SAP2000 PanelOffset settings.")] public static IPanelOffset PanelOffset(this Panel panel) { - return panel.FindFragment(); + return panel?.FindFragment(); } } } \ No newline at end of file From 296b2ae69b66c1f897859d818a5422934ff829c8 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Mon, 29 Nov 2021 14:00:47 -0500 Subject: [PATCH 15/24] Making interface fragments unique --- SAP2000_Adapter/CRUD/Read/Section.cs | 1 - SAP2000_oM/Fragments/IPanelAutoMesh.cs | 2 ++ SAP2000_oM/Fragments/IPanelOffset.cs | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) 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_oM/Fragments/IPanelAutoMesh.cs b/SAP2000_oM/Fragments/IPanelAutoMesh.cs index 6a247b5..f5748fb 100644 --- a/SAP2000_oM/Fragments/IPanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/IPanelAutoMesh.cs @@ -21,10 +21,12 @@ */ using BH.oM.Base; using System.ComponentModel; +using BH.oM.Reflection.Attributes; 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.")] diff --git a/SAP2000_oM/Fragments/IPanelOffset.cs b/SAP2000_oM/Fragments/IPanelOffset.cs index b1c0432..f7f3406 100644 --- a/SAP2000_oM/Fragments/IPanelOffset.cs +++ b/SAP2000_oM/Fragments/IPanelOffset.cs @@ -21,10 +21,12 @@ */ using System.ComponentModel; using BH.oM.Base; +using BH.oM.Reflection.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 { } From 7c36bf1ac9e53ab0d909f43fb53ff8d455519cd7 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Mon, 29 Nov 2021 15:06:08 -0500 Subject: [PATCH 16/24] improve null handling --- SAP2000_Engine/Query/Panel.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index 86b9d1f..75ab4c1 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -30,6 +30,7 @@ using System.ComponentModel; using BH.oM.Reflection.Attributes; using BH.Engine.Base; +using BH.oM.Base; namespace BH.Engine.Adapters.SAP2000 { @@ -40,7 +41,9 @@ public static partial class Query [Output("PanelAutoMesh", "A fragment containing SAP2000 PanelAutoMesh settings.")] public static IPanelAutoMesh PanelAutoMesh(this Panel panel) { - return panel?.FindFragment(); + List fragments = panel?.GetAllFragments(typeof(IPanelAutoMesh)); + if (fragments.Count > 1) Reflection.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 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.")] @@ -56,7 +59,9 @@ public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) [Output("PanelOffset", "A fragment containing SAP2000 PanelOffset settings.")] public static IPanelOffset PanelOffset(this Panel panel) { - return panel?.FindFragment(); + List fragments = panel?.GetAllFragments(typeof(IPanelOffset)); + if (fragments.Count > 1) Reflection.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(); } } } \ No newline at end of file From fd171325ae81d6861eda98cdfde27dd2b14cc16f Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Wed, 29 Dec 2021 15:19:04 -0500 Subject: [PATCH 17/24] Getting fragment properties on one line each --- SAP2000_oM/Fragments/IPanelAutoMesh.cs | 42 ++--------- .../PanelAutoMeshByCookieCutLines.cs | 63 +++-------------- .../PanelAutoMeshByCookieCutPoints.cs | 63 +++-------------- .../Fragments/PanelAutoMeshByGeneralDivide.cs | 63 +++-------------- .../Fragments/PanelAutoMeshByMaximumSize.cs | 70 +++---------------- .../PanelAutoMeshByNumberOfObjects.cs | 69 +++--------------- .../Fragments/PanelAutoMeshByPointsOnEdges.cs | 69 +++--------------- SAP2000_oM/Fragments/PanelEdgeConstraint.cs | 8 +-- .../Fragments/PanelOffsetByJointPattern.cs | 16 +---- SAP2000_oM/Fragments/PanelOffsetByPoint.cs | 8 +-- 10 files changed, 63 insertions(+), 408 deletions(-) diff --git a/SAP2000_oM/Fragments/IPanelAutoMesh.cs b/SAP2000_oM/Fragments/IPanelAutoMesh.cs index f5748fb..22b9dc5 100644 --- a/SAP2000_oM/Fragments/IPanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/IPanelAutoMesh.cs @@ -30,52 +30,24 @@ namespace BH.oM.Adapters.SAP2000.Fragments 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; - } + 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; - } + 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; - } + 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; - } + 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; - } + 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; - } + 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; - } + double SubMeshSize { get; set; } } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs index a0217ca..a6486c7 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs @@ -28,60 +28,13 @@ namespace BH.oM.Adapters.SAP2000.Fragments 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; + 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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs index b6249bb..c1f4549 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs @@ -30,60 +30,13 @@ 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; + 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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs index c90064f..420f66c 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs @@ -30,60 +30,13 @@ 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; + 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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs index 5179548..6051173 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs @@ -30,68 +30,18 @@ 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; - } + 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; + 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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs index 51104c0..0f12288 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs @@ -28,67 +28,16 @@ namespace BH.oM.Adapters.SAP2000.Fragments 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; - } + 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; + 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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs index aad7a0c..c359f63 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs @@ -28,67 +28,16 @@ namespace BH.oM.Adapters.SAP2000.Fragments 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; - } + 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; + 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; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs index f4b2dc6..8aec0ac 100644 --- a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs +++ b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs @@ -27,12 +27,6 @@ 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; + public virtual bool EdgeConstraint { get; set; } = false; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs index fb4b7b9..6ce8237 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs @@ -27,21 +27,9 @@ 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; - } - - = ""; + 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; + public virtual double OffsetPatternSF { get; set; } = 0; } } \ No newline at end of file diff --git a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs index 8a81dff..47a01e7 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs @@ -28,12 +28,6 @@ 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; + public virtual double[] Offset { get; set; } = null; } } \ No newline at end of file From a3bf13a47f77ba6d3bae2d9f5679cb98eadc2a97 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Wed, 19 Jan 2022 18:39:43 -0500 Subject: [PATCH 18/24] Fixing Reflection/Base references --- SAP2000_Engine/Query/Bar.cs | 2 +- SAP2000_Engine/Query/Panel.cs | 6 +++--- SAP2000_oM/Fragments/IPanelAutoMesh.cs | 2 +- SAP2000_oM/Fragments/IPanelOffset.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SAP2000_Engine/Query/Bar.cs b/SAP2000_Engine/Query/Bar.cs index 79917eb..7c7361a 100644 --- a/SAP2000_Engine/Query/Bar.cs +++ b/SAP2000_Engine/Query/Bar.cs @@ -30,7 +30,7 @@ using BH.oM.Adapters.SAP2000; using BH.Engine.Base; using System.ComponentModel; -using BH.oM.Reflection.Attributes; +using BH.oM.Base.Attributes; namespace BH.Engine.Adapters.SAP2000 { diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index 75ab4c1..94349f8 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -28,7 +28,7 @@ using BH.oM.Adapters.SAP2000.Fragments; using BH.oM.Adapters.SAP2000; using System.ComponentModel; -using BH.oM.Reflection.Attributes; +using BH.oM.Base.Attributes; using BH.Engine.Base; using BH.oM.Base; @@ -42,7 +42,7 @@ public static partial class Query public static IPanelAutoMesh PanelAutoMesh(this Panel panel) { List fragments = panel?.GetAllFragments(typeof(IPanelAutoMesh)); - if (fragments.Count > 1) Reflection.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."); + 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 IPanelAutoMesh).FirstOrDefault(); } @@ -60,7 +60,7 @@ public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) public static IPanelOffset PanelOffset(this Panel panel) { List fragments = panel?.GetAllFragments(typeof(IPanelOffset)); - if (fragments.Count > 1) Reflection.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."); + 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_oM/Fragments/IPanelAutoMesh.cs b/SAP2000_oM/Fragments/IPanelAutoMesh.cs index 22b9dc5..421a589 100644 --- a/SAP2000_oM/Fragments/IPanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/IPanelAutoMesh.cs @@ -20,8 +20,8 @@ * along with this code. If not, see . */ using BH.oM.Base; +using BH.oM.Base.Attributes; using System.ComponentModel; -using BH.oM.Reflection.Attributes; namespace BH.oM.Adapters.SAP2000.Fragments { diff --git a/SAP2000_oM/Fragments/IPanelOffset.cs b/SAP2000_oM/Fragments/IPanelOffset.cs index f7f3406..020d88e 100644 --- a/SAP2000_oM/Fragments/IPanelOffset.cs +++ b/SAP2000_oM/Fragments/IPanelOffset.cs @@ -21,7 +21,7 @@ */ using System.ComponentModel; using BH.oM.Base; -using BH.oM.Reflection.Attributes; +using BH.oM.Base.Attributes; namespace BH.oM.Adapters.SAP2000.Fragments { From ef2c000dec61268a907e3d9b9a56a158db95b10c Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Thu, 20 Jan 2022 14:07:26 -0500 Subject: [PATCH 19/24] fix null handling in SplitRigidLink --- SAP2000_Engine/Query/SplitRigidLink.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SAP2000_Engine/Query/SplitRigidLink.cs b/SAP2000_Engine/Query/SplitRigidLink.cs index 492f9e4..7c3a9ce 100644 --- a/SAP2000_Engine/Query/SplitRigidLink.cs +++ b/SAP2000_Engine/Query/SplitRigidLink.cs @@ -36,6 +36,12 @@ public static partial class Query public static List SplitRigidLink(RigidLink link) { + if (link == null) + { + Base.Compute.RecordError("Could not split the RigidLink because it is null."); + return null; + } + List singleLinks = new List(); if (link.SecondaryNodes.Count() <= 1) From 9f8a21cd150b589e5a701c8a1588185652227e3d Mon Sep 17 00:00:00 2001 From: BHoMBot Date: Thu, 20 Jan 2022 16:00:48 +0000 Subject: [PATCH 20/24] Resolve copyright compliance --- SAP2000_Engine/Query/Panel.cs | 4 ++-- SAP2000_oM/Fragments/IPanelAutoMesh.cs | 4 ++-- SAP2000_oM/Fragments/IPanelOffset.cs | 4 ++-- SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs | 4 ++-- SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs | 4 ++-- SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs | 4 ++-- SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs | 4 ++-- SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs | 4 ++-- SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs | 4 ++-- SAP2000_oM/Fragments/PanelEdgeConstraint.cs | 4 ++-- SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs | 4 ++-- SAP2000_oM/Fragments/PanelOffsetByPoint.cs | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index 94349f8..eb32de8 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -64,4 +64,4 @@ public static IPanelOffset PanelOffset(this Panel panel) return fragments.Select(x => x as IPanelOffset).FirstOrDefault(); } } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/IPanelAutoMesh.cs b/SAP2000_oM/Fragments/IPanelAutoMesh.cs index 421a589..8450c8c 100644 --- a/SAP2000_oM/Fragments/IPanelAutoMesh.cs +++ b/SAP2000_oM/Fragments/IPanelAutoMesh.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -50,4 +50,4 @@ public interface IPanelAutoMesh : IFragment [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; } } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/IPanelOffset.cs b/SAP2000_oM/Fragments/IPanelOffset.cs index 020d88e..9dc935e 100644 --- a/SAP2000_oM/Fragments/IPanelOffset.cs +++ b/SAP2000_oM/Fragments/IPanelOffset.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -30,4 +30,4 @@ namespace BH.oM.Adapters.SAP2000.Fragments public partial interface IPanelOffset : IFragment { } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs index a6486c7..0e6528e 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutLines.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -37,4 +37,4 @@ public class PanelAutoMeshByCookieCutLines : IPanelAutoMesh, IFragment public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs index c1f4549..b96a6f3 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByCookieCutPoints.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -39,4 +39,4 @@ public class PanelAutoMeshByCookieCutPoints : IPanelAutoMesh, IFragment public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs index 420f66c..cbceb1b 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByGeneralDivide.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -39,4 +39,4 @@ public class PanelAutoMeshByGeneralDivide : IPanelAutoMesh, IFragment public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs index 6051173..63fdf3b 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByMaximumSize.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -44,4 +44,4 @@ public class PanelAutoMeshByMaximumSize : IPanelAutoMesh, IFragment public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs index 0f12288..487bfd4 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByNumberOfObjects.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -40,4 +40,4 @@ public class PanelAutoMeshByNumberOfObjects : IPanelAutoMesh, IFragment public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs index c359f63..c818400 100644 --- a/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs +++ b/SAP2000_oM/Fragments/PanelAutoMeshByPointsOnEdges.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -40,4 +40,4 @@ public class PanelAutoMeshByPointsOnEdges : IPanelAutoMesh, IFragment public virtual bool SubMesh { get; set; } = false; public virtual double SubMeshSize { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs index 8aec0ac..295a2d1 100644 --- a/SAP2000_oM/Fragments/PanelEdgeConstraint.cs +++ b/SAP2000_oM/Fragments/PanelEdgeConstraint.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -29,4 +29,4 @@ 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; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs index 6ce8237..8853b1e 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByJointPattern.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -32,4 +32,4 @@ public class PanelOffsetByJointPattern : IPanelOffset [Description("This is the scale factor applied to the joint pattern when calculating the joint offsets.")] public virtual double OffsetPatternSF { get; set; } = 0; } -} \ No newline at end of file +} diff --git a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs index 47a01e7..5426aa5 100644 --- a/SAP2000_oM/Fragments/PanelOffsetByPoint.cs +++ b/SAP2000_oM/Fragments/PanelOffsetByPoint.cs @@ -1,6 +1,6 @@ /* * This file is part of the Buildings and Habitats object Model (BHoM) - * Copyright (c) 2015 - 2021, the respective contributors. All rights reserved. + * 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. @@ -30,4 +30,4 @@ public class PanelOffsetByPoint : IPanelOffset [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; } -} \ No newline at end of file +} From b27b594ff925a907c352e3ba74ef9a5718e1272f Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Thu, 20 Jan 2022 15:15:49 -0500 Subject: [PATCH 21/24] adding more null checks to SplitRigidLink --- SAP2000_Engine/Query/SplitRigidLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SAP2000_Engine/Query/SplitRigidLink.cs b/SAP2000_Engine/Query/SplitRigidLink.cs index 7c3a9ce..6b61079 100644 --- a/SAP2000_Engine/Query/SplitRigidLink.cs +++ b/SAP2000_Engine/Query/SplitRigidLink.cs @@ -36,7 +36,7 @@ public static partial class Query public static List SplitRigidLink(RigidLink link) { - if (link == null) + if (link == null || link.PrimaryNode == null || link.SecondaryNodes == null) { Base.Compute.RecordError("Could not split the RigidLink because it is null."); return null; From af6ff8dedb885d18749a2f9cd748b86af27c114c Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Mon, 24 Jan 2022 16:46:55 -0500 Subject: [PATCH 22/24] adding null handling for Query Panel Fragment --- SAP2000_Engine/Query/Panel.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/SAP2000_Engine/Query/Panel.cs b/SAP2000_Engine/Query/Panel.cs index eb32de8..87d34e5 100644 --- a/SAP2000_Engine/Query/Panel.cs +++ b/SAP2000_Engine/Query/Panel.cs @@ -42,7 +42,13 @@ public static partial class Query public static IPanelAutoMesh PanelAutoMesh(this Panel panel) { List fragments = panel?.GetAllFragments(typeof(IPanelAutoMesh)); - 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."); + + 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(); } @@ -60,7 +66,13 @@ public static PanelEdgeConstraint PanelEdgeConstraint(this Panel panel) public static IPanelOffset PanelOffset(this Panel panel) { List fragments = panel?.GetAllFragments(typeof(IPanelOffset)); - 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."); + + 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(); } } From aa8653b0d6bb181306189d91783cbad6fcc07c85 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Mon, 24 Jan 2022 18:04:09 -0500 Subject: [PATCH 23/24] extension methodizing splitrigidlink --- SAP2000_Engine/Query/SplitRigidLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SAP2000_Engine/Query/SplitRigidLink.cs b/SAP2000_Engine/Query/SplitRigidLink.cs index 6b61079..72b14ff 100644 --- a/SAP2000_Engine/Query/SplitRigidLink.cs +++ b/SAP2000_Engine/Query/SplitRigidLink.cs @@ -34,7 +34,7 @@ public static partial class Query /**** Public Methods ****/ /***************************************************/ - public static List SplitRigidLink(RigidLink link) + public static List SplitRigidLink(this RigidLink link) { if (link == null || link.PrimaryNode == null || link.SecondaryNodes == null) { From 3a0fc3e89444dfd10252d3042d69c9cceb8b9ca7 Mon Sep 17 00:00:00 2001 From: Josef Taylor Date: Wed, 26 Jan 2022 10:15:52 -0500 Subject: [PATCH 24/24] Update SplitRigidLink.cs --- SAP2000_Engine/Query/SplitRigidLink.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SAP2000_Engine/Query/SplitRigidLink.cs b/SAP2000_Engine/Query/SplitRigidLink.cs index 72b14ff..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,6 +35,9 @@ public static partial class Query /**** Public Methods ****/ /***************************************************/ + [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)