From 7d24e4b6ca317a038366c70a5ac4a9c0eda75343 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 27 May 2023 14:07:46 +0900 Subject: [PATCH 01/13] Add Rhino8 launch.jso file --- .vscode/launch.json | 19 ++++++++++++------- .vscode/tasks.json | 27 +-------------------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index bf07d24f..60958a3c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,21 +5,26 @@ "version": "0.2.0", "configurations": [ { - "name": ".NET Core Launch (console)", + "name": "Run Rhino8 WIP", "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "C:/Program Files/Rhino 6/System/Rhino.exe", - "args": [], + "program": "C:/Program Files/Rhino 8 WIP/System/Rhino.exe", + "args": ["/nosplash"], "cwd": "${workspaceFolder}", "console": "internalConsole", "stopAtEntry": true }, { - "name": ".NET Core Attach", + "name": "Run Rhino7", "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}" - } + "request": "launch", + "preLaunchTask": "build", + "program": "C:/Program Files/Rhino 7/System/Rhino.exe", + "args": ["/nosplash"], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "stopAtEntry": true + }, ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d96f354e..0e4358c6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,36 +7,11 @@ "type": "process", "args": [ "build", - "${workspaceFolder}/HoaryFox/HoaryFox.csproj", + "${workspaceFolder}/HoaryFox/RH7/HoaryFoxRH7.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" }, - { - "label": "publish", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/HoaryFox/HoaryFox.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "watch", - "command": "dotnet", - "type": "process", - "args": [ - "watch", - "run", - "${workspaceFolder}/HoaryFox/HoaryFox.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - } ] } \ No newline at end of file From 2ee6f84247a03d4f5467072e111ec81a1ec9cafe Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 27 May 2023 15:31:56 +0900 Subject: [PATCH 02/13] Update S2L to support Pile --- HoaryFox/RH7/Component/Geometry/Stb2Line.cs | 65 +++--- .../Utils/Geometry/CreateLineFromStb.cs | 194 +++++++++++++++++- HoaryFox/RH7/Component/Utils/TagUtils.cs | 6 +- 3 files changed, 225 insertions(+), 40 deletions(-) diff --git a/HoaryFox/RH7/Component/Geometry/Stb2Line.cs b/HoaryFox/RH7/Component/Geometry/Stb2Line.cs index 51a8784b..7349d9e8 100644 --- a/HoaryFox/RH7/Component/Geometry/Stb2Line.cs +++ b/HoaryFox/RH7/Component/Geometry/Stb2Line.cs @@ -23,7 +23,7 @@ public class Stb2Line : GH_Component { private ST_BRIDGE _stBridge; private List _nodes = new List(); - private readonly GH_Structure[] _lineList = new GH_Structure[5]; + private readonly GH_Structure[] _lineList = new GH_Structure[8]; public override GH_Exposure Exposure => GH_Exposure.primary; @@ -37,6 +37,7 @@ public Stb2Line() protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddGenericParameter("Data", "D", "input ST-Bridge Data", GH_ParamAccess.item); + pManager.AddBooleanParameter("OffsetNode", "OfNd", "If it true, offset geometry.", GH_ParamAccess.item, false); pManager.AddBooleanParameter("Bake", "Bake", "If it true, bake geometry.", GH_ParamAccess.item, false); } @@ -48,15 +49,18 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) pManager.AddLineParameter("Posts", "Pst", "output StbPosts to Line", GH_ParamAccess.tree); pManager.AddLineParameter("Beams", "Beam", "output StbBeams to Line", GH_ParamAccess.tree); pManager.AddLineParameter("Braces", "Brc", "output StbBraces to Line", GH_ParamAccess.tree); + pManager.AddLineParameter("Piles", "Pile", "output StbPiles to Line", GH_ParamAccess.tree); } protected override void SolveInstance(IGH_DataAccess dataAccess) { var isBake = false; + var isOffset = false; if (!dataAccess.GetData("Data", ref _stBridge)) { return; } + if (!dataAccess.GetData("OffsetNode", ref isOffset)) { return; } if (!dataAccess.GetData("Bake", ref isBake)) { return; } - CreateLine(); + CreateLine(isOffset); if (isBake) { BakeLine(); @@ -65,21 +69,36 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, _nodes); foreach ((GH_Structure geometry, int i) in _lineList.Select((geo, index) => (geo, index + 1))) { - dataAccess.SetDataTree(i, geometry); + if (i == 8) + { + dataAccess.SetDataTree(6, geometry); + } + else if (i == 6 || i == 7) + { + continue; + } + else + { + dataAccess.SetDataTree(i, geometry); + } } } private void BakeLine() { RhinoDoc activeDoc = RhinoDoc.ActiveDoc; - var parentLayerNames = new[] { "Column", "Girder", "Post", "Beam", "Brace", "Slab", "Wall" }; - Color[] layerColors = { Color.Red, Color.Green, Color.Aquamarine, Color.LightCoral, Color.MediumPurple, Color.DarkGray, Color.CornflowerBlue }; + var parentLayerNames = new[] { "Column", "Girder", "Post", "Beam", "Brace", "Slab", "Wall", "Pile" }; + Color[] layerColors = { Color.Red, Color.Green, Color.Aquamarine, Color.LightCoral, Color.MediumPurple, Color.DarkGray, Color.CornflowerBlue, Color.DarkOrange }; GeometryBaker.MakeParentLayers(activeDoc, parentLayerNames, layerColors); Dictionary[][] infoArray = Utils.TagUtils.GetAllSectionInfoArray(_stBridge.StbModel.StbMembers, _stBridge.StbModel.StbSections); foreach ((GH_Structure lines, int i) in _lineList.Select((frameBrep, index) => (frameBrep, index))) { + if (lines == null) + { + continue; + } Layer parentLayer = activeDoc.Layers.FindName(parentLayerNames[i]); int parentIndex = parentLayer.Index; Guid parentId = parentLayer.Id; @@ -87,44 +106,38 @@ private void BakeLine() { var objAttr = new ObjectAttributes(); - if (i < 5) + Dictionary[] infos = infoArray[i]; + Dictionary info = infos[bIndex]; + + foreach (KeyValuePair pair in info) { - Dictionary[] infos = infoArray[i]; - Dictionary info = infos[bIndex]; - - foreach (KeyValuePair pair in info) - { - objAttr.SetUserString(pair.Key, pair.Value); - } - - var layer = new Layer { Name = info["name"], ParentLayerId = parentId, Color = layerColors[i] }; - int layerIndex = activeDoc.Layers.Add(layer); - if (layerIndex == -1) - { - layer = activeDoc.Layers.FindName(info["name"]); - layerIndex = layer.Index; - } - objAttr.LayerIndex = layerIndex; + objAttr.SetUserString(pair.Key, pair.Value); } - else + + var layer = new Layer { Name = info["name"], ParentLayerId = parentId, Color = layerColors[i] }; + int layerIndex = activeDoc.Layers.Add(layer); + if (layerIndex == -1) { - objAttr.LayerIndex = parentIndex; + layer = activeDoc.Layers.FindName(info["name"]); + layerIndex = layer.Index; } + objAttr.LayerIndex = layerIndex; activeDoc.Objects.AddLine(line, objAttr); } } } - private void CreateLine() + private void CreateLine(bool isOffset) { - var createLines = new CreateLineFromStb(_stBridge); + var createLines = new CreateLineFromStb(_stBridge, isOffset); _nodes = createLines.Nodes(); _lineList[0] = createLines.Columns(); _lineList[1] = createLines.Girders(); _lineList[2] = createLines.Posts(); _lineList[3] = createLines.Beams(); _lineList[4] = createLines.Braces(); + _lineList[7] = createLines.Piles(); } protected override Bitmap Icon => Resource.Line; diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs index 25ca8d7f..0f0a05b2 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs @@ -14,11 +14,13 @@ public class CreateLineFromStb { private readonly StbMembers _members; private readonly StbNode[] _nodes; + private readonly bool _isOffset; - public CreateLineFromStb(ST_BRIDGE stBridge) + public CreateLineFromStb(ST_BRIDGE stBridge, bool isOffset) { _members = stBridge.StbModel.StbMembers; _nodes = stBridge.StbModel.StbNodes; + _isOffset = isOffset; } public List Nodes() @@ -36,8 +38,32 @@ public GH_Structure Columns() foreach ((StbColumn member, int i) in _members.StbColumns.Select((member, index) => (member, index))) { - StbNode nodeBottom = _nodes.First(node => node.id == member.id_node_bottom); - StbNode nodeTop = _nodes.First(node => node.id == member.id_node_top); + StbNode nodeBottom = new StbNode(); + StbNode nodeTop = new StbNode(); + + StbNode nodeBottomBase = _nodes.First(node => node.id == member.id_node_bottom); + StbNode nodeTopBase = _nodes.First(node => node.id == member.id_node_top); + + if (_isOffset) + { + nodeBottom = new StbNode + { + X = nodeBottomBase.X + member.offset_bottom_X, + Y = nodeBottomBase.Y + member.offset_bottom_Y, + Z = nodeBottomBase.Z + member.offset_bottom_Z + }; + nodeTop = new StbNode + { + X = nodeTopBase.X + member.offset_top_X, + Y = nodeTopBase.Y + member.offset_top_Y, + Z = nodeTopBase.Z + member.offset_top_Z + }; + } + else + { + nodeBottom = nodeBottomBase; + nodeTop = nodeTopBase; + } lines.Append(GH_LineFromStbNode(nodeBottom, nodeTop), new GH_Path(0, i)); } @@ -55,9 +81,32 @@ public GH_Structure Girders() foreach ((StbGirder member, int i) in _members.StbGirders.Select((member, index) => (member, index))) { - StbNode nodeStart = _nodes.First(node => node.id == member.id_node_start); - StbNode nodeEnd = _nodes.First(node => node.id == member.id_node_end); + var nodeStart = new StbNode(); + var nodeEnd = new StbNode(); + + StbNode nodeStartBase = _nodes.First(node => node.id == member.id_node_start); + StbNode nodeEndBase = _nodes.First(node => node.id == member.id_node_end); + if (_isOffset) + { + nodeStart = new StbNode + { + X = nodeStartBase.X + member.offset_start_X, + Y = nodeStartBase.Y + member.offset_start_Y, + Z = nodeStartBase.Z + member.offset_start_Z + }; + nodeEnd = new StbNode + { + X = nodeEndBase.X + member.offset_end_X, + Y = nodeEndBase.Y + member.offset_end_Y, + Z = nodeEndBase.Z + member.offset_end_Z + }; + } + else + { + nodeStart = nodeStartBase; + nodeEnd = nodeEndBase; + } lines.Append(GH_LineFromStbNode(nodeStart, nodeEnd), new GH_Path(0, i)); } @@ -74,8 +123,32 @@ public GH_Structure Posts() foreach ((StbPost member, int i) in _members.StbPosts.Select((member, index) => (member, index))) { - StbNode nodeBottom = _nodes.First(node => node.id == member.id_node_bottom); - StbNode nodeTop = _nodes.First(node => node.id == member.id_node_top); + var nodeBottom = new StbNode(); + var nodeTop = new StbNode(); + + StbNode nodeBottomBase = _nodes.First(node => node.id == member.id_node_bottom); + StbNode nodeTopBase = _nodes.First(node => node.id == member.id_node_top); + + if (_isOffset) + { + nodeBottom = new StbNode + { + X = nodeBottomBase.X + member.offset_bottom_X, + Y = nodeBottomBase.Y + member.offset_bottom_Y, + Z = nodeBottomBase.Z + member.offset_bottom_Z + }; + nodeTop = new StbNode + { + X = nodeTopBase.X + member.offset_top_X, + Y = nodeTopBase.Y + member.offset_top_Y, + Z = nodeTopBase.Z + member.offset_top_Z + }; + } + else + { + nodeBottom = nodeBottomBase; + nodeTop = nodeTopBase; + } lines.Append(GH_LineFromStbNode(nodeBottom, nodeTop), new GH_Path(0, i)); } @@ -93,8 +166,32 @@ public GH_Structure Beams() foreach ((StbBeam member, int i) in _members.StbBeams.Select((member, index) => (member, index))) { - StbNode nodeStart = _nodes.First(node => node.id == member.id_node_start); - StbNode nodeEnd = _nodes.First(node => node.id == member.id_node_end); + var nodeStart = new StbNode(); + var nodeEnd = new StbNode(); + + StbNode nodeStartBase = _nodes.First(node => node.id == member.id_node_start); + StbNode nodeEndBase = _nodes.First(node => node.id == member.id_node_end); + + if (_isOffset) + { + nodeStart = new StbNode + { + X = nodeStartBase.X + member.offset_start_X, + Y = nodeStartBase.Y + member.offset_start_Y, + Z = nodeStartBase.Z + member.offset_start_Z + }; + nodeEnd = new StbNode + { + X = nodeEndBase.X + member.offset_end_X, + Y = nodeEndBase.Y + member.offset_end_Y, + Z = nodeEndBase.Z + member.offset_end_Z + }; + } + else + { + nodeStart = nodeStartBase; + nodeEnd = nodeEndBase; + } lines.Append(GH_LineFromStbNode(nodeStart, nodeEnd), new GH_Path(0, i)); } @@ -112,8 +209,32 @@ public GH_Structure Braces() foreach ((StbBrace member, int i) in _members.StbBraces.Select((member, index) => (member, index))) { - StbNode nodeStart = _nodes.First(node => node.id == member.id_node_start); - StbNode nodeEnd = _nodes.First(node => node.id == member.id_node_end); + var nodeStart = new StbNode(); + var nodeEnd = new StbNode(); + + StbNode nodeStartBase = _nodes.First(node => node.id == member.id_node_start); + StbNode nodeEndBase = _nodes.First(node => node.id == member.id_node_end); + + if (_isOffset) + { + nodeStart = new StbNode + { + X = nodeStartBase.X + member.offset_start_X, + Y = nodeStartBase.Y + member.offset_start_Y, + Z = nodeStartBase.Z + member.offset_start_Z + }; + nodeEnd = new StbNode + { + X = nodeEndBase.X + member.offset_end_X, + Y = nodeEndBase.Y + member.offset_end_Y, + Z = nodeEndBase.Z + member.offset_end_Z + }; + } + else + { + nodeStart = nodeStartBase; + nodeEnd = nodeEndBase; + } lines.Append(GH_LineFromStbNode(nodeStart, nodeEnd), new GH_Path(0, i)); } @@ -121,6 +242,57 @@ public GH_Structure Braces() return lines; } + internal GH_Structure Piles() + { + var lines = new GH_Structure(); + if (_members.StbPiles == null) + { + return lines; + } + + foreach ((StbPile member, int i) in _members.StbPiles.Select((member, index) => (member, index))) + { + var nodeBottom = new StbNode(); + var nodeTop = new StbNode(); + + StbNode node = _nodes.First(n => n.id == member.id_node); + if (_isOffset) + { + nodeTop = new StbNode + { + X = node.X, + Y = node.Y, + Z = node.Z + member.level_top + }; + nodeBottom = new StbNode + { + X = nodeTop.X, + Y = nodeTop.Y, + Z = nodeTop.Z - member.length_all + }; + + } + else + { + nodeTop = new StbNode + { + X = node.X, + Y = node.Y, + Z = node.Z + }; + nodeBottom = new StbNode + { + X = nodeTop.X, + Y = nodeTop.Y, + Z = nodeTop.Z - member.length_all + member.level_top + }; + } + lines.Append(GH_LineFromStbNode(nodeBottom, nodeTop), new GH_Path(0, i)); + } + + return lines; + } + private static GH_Line GH_LineFromStbNode(StbNode from, StbNode to) { var ptFrom = new Point3d(from.X, from.Y, from.Z); diff --git a/HoaryFox/RH7/Component/Utils/TagUtils.cs b/HoaryFox/RH7/Component/Utils/TagUtils.cs index 6546163a..7ce0aa42 100644 --- a/HoaryFox/RH7/Component/Utils/TagUtils.cs +++ b/HoaryFox/RH7/Component/Utils/TagUtils.cs @@ -294,10 +294,10 @@ internal static IEnumerable GetWallRcSection(StbSecWall_RC_Straight f public static Dictionary[][] GetAllSectionInfoArray(StbMembers members, StbSections sections) { - var allTagList = new Dictionary[7][]; + var allTagList = new Dictionary[8][]; - var memberArray = new object[][] { members.StbColumns, members.StbGirders, members.StbPosts, members.StbBeams, members.StbBraces, members.StbSlabs, members.StbWalls }; - for (var i = 0; i < 7; i++) + var memberArray = new object[][] { members.StbColumns, members.StbGirders, members.StbPosts, members.StbBeams, members.StbBraces, members.StbSlabs, members.StbWalls, members.StbPiles }; + for (var i = 0; i < 8; i++) { allTagList[i] = memberArray[i] != null ? StbMembersToDictArray(memberArray[i], sections) : Array.Empty>(); } From a8d18503bad489733d4299b7f20da95dc48e13ee Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 27 May 2023 15:45:30 +0900 Subject: [PATCH 03/13] Fix apply pile top node offset --- HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs index 0f0a05b2..b213db74 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs @@ -260,8 +260,8 @@ internal GH_Structure Piles() { nodeTop = new StbNode { - X = node.X, - Y = node.Y, + X = node.X + member.offset_X, + Y = node.Y + member.offset_Y, Z = node.Z + member.level_top }; nodeBottom = new StbNode From 715e81bb3044d6b713ce1c105cf4ee3b06d4aa0c Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 27 May 2023 17:18:40 +0900 Subject: [PATCH 04/13] Update S2B to support Pile --- HoaryFox/RH7/Component/Geometry/Stb2Brep.cs | 10 +- HoaryFox/RH7/Component/Geometry/Stb2Line.cs | 2 +- .../Utils/Geometry/BrepMaker/Pile.cs | 104 ++++++++++++++++++ .../Geometry/CreateMemberBrepListFromStb.cs | 40 +++++++ 4 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs diff --git a/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs b/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs index d70e875c..fd33bc21 100644 --- a/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs +++ b/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs @@ -22,7 +22,7 @@ namespace HoaryFox.Component.Geometry public class Stb2Brep : GH_Component { private ST_BRIDGE _stBridge; - private readonly GH_Structure[] _brepList = new GH_Structure[7]; + private readonly GH_Structure[] _brepList = new GH_Structure[8]; public override GH_Exposure Exposure => GH_Exposure.primary; @@ -48,6 +48,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) pManager.AddBrepParameter("Braces", "Brc", "output StbBraces to Brep", GH_ParamAccess.tree); pManager.AddBrepParameter("Slabs", "Slb", "output StbSlabs to Brep", GH_ParamAccess.tree); pManager.AddBrepParameter("Walls", "Wl", "output StbWalls to Brep", GH_ParamAccess.tree); + pManager.AddBrepParameter("Piles", "Pil", "output StbPiles to Brep", GH_ParamAccess.tree); } protected override void SolveInstance(IGH_DataAccess dataAccess) @@ -62,7 +63,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) BakeBrep(); } - for (var i = 0; i < 7; i++) + for (var i = 0; i < 8; i++) { dataAccess.SetDataTree(i, _brepList[i]); } @@ -82,13 +83,14 @@ private void CreateBrep() _brepList[4] = brepFromStb.Brace(member.StbBraces); _brepList[5] = brepFromStb.Slab(member.StbSlabs); _brepList[6] = brepFromStb.Wall(member.StbWalls, member.StbOpens); + _brepList[7] = brepFromStb.Pile(member.StbPiles); } private void BakeBrep() { RhinoDoc activeDoc = RhinoDoc.ActiveDoc; - var parentLayerNames = new[] { "Column", "Girder", "Post", "Beam", "Brace", "Slab", "Wall" }; - Color[] layerColors = { Color.Red, Color.Green, Color.Aquamarine, Color.LightCoral, Color.MediumPurple, Color.DarkGray, Color.CornflowerBlue }; + var parentLayerNames = new[] { "Column", "Girder", "Post", "Beam", "Brace", "Slab", "Wall", "Pile" }; + Color[] layerColors = { Color.Red, Color.Green, Color.Aquamarine, Color.LightCoral, Color.MediumPurple, Color.DarkGray, Color.CornflowerBlue, Color.DarkOrange }; GeometryBaker.MakeParentLayers(activeDoc, parentLayerNames, layerColors); Dictionary[][] infoArray = Utils.TagUtils.GetAllSectionInfoArray(_stBridge.StbModel.StbMembers, _stBridge.StbModel.StbSections); diff --git a/HoaryFox/RH7/Component/Geometry/Stb2Line.cs b/HoaryFox/RH7/Component/Geometry/Stb2Line.cs index 7349d9e8..d0815efa 100644 --- a/HoaryFox/RH7/Component/Geometry/Stb2Line.cs +++ b/HoaryFox/RH7/Component/Geometry/Stb2Line.cs @@ -49,7 +49,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) pManager.AddLineParameter("Posts", "Pst", "output StbPosts to Line", GH_ParamAccess.tree); pManager.AddLineParameter("Beams", "Beam", "output StbBeams to Line", GH_ParamAccess.tree); pManager.AddLineParameter("Braces", "Brc", "output StbBraces to Line", GH_ParamAccess.tree); - pManager.AddLineParameter("Piles", "Pile", "output StbPiles to Line", GH_ParamAccess.tree); + pManager.AddLineParameter("Piles", "Pil", "output StbPiles to Line", GH_ParamAccess.tree); } protected override void SolveInstance(IGH_DataAccess dataAccess) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs new file mode 100644 index 00000000..52e17823 --- /dev/null +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Rhino.Geometry; + +using STBDotNet.v202; + +namespace HoaryFox.Component.Utils.Geometry.BrepMaker +{ + public class Pile + { + private readonly IReadOnlyList _tolerance; + private readonly StbSections _sections; + public Pile(StbSections sections, IReadOnlyList tolerance) + { + _tolerance = tolerance; + _sections = sections; + } + + public Brep CreatePileBrep(string idSection, StbPileKind_structure kind, IReadOnlyList sectionPoints, Vector3d axis) + { + SectionCurve[] curveList = CreateFromEachColumnKind(idSection, kind, sectionPoints, axis); + return Utils.CreateCapedBrepFromLoft(curveList, _tolerance[0]); + } + + private SectionCurve[] CreateFromEachColumnKind(string idSection, StbPileKind_structure kind, IReadOnlyList sectionPoints, Vector3d axis) + { + SectionCurve[] curveList; + try + { + curveList = CreateCurveList(idSection, kind, sectionPoints, axis); + } + catch (Exception) + { + throw new ArgumentException("The cross-sectional shape of the pile seems to be wrong. Please check."); + } + + return curveList; + } + + private SectionCurve[] CreateCurveList(string idSection, StbPileKind_structure kind, IReadOnlyList sectionPoints, Vector3d axis) + { + SectionCurve[] curveList; + switch (kind) + { + case StbPileKind_structure.RC: + StbSecPile_RC rcSec = _sections.StbSecPile_RC.First(sec => sec.id == idSection); + curveList = SecRcPileToCurves(rcSec.StbSecFigurePile_RC.Item, sectionPoints, axis); + break; + case StbPileKind_structure.S: + case StbPileKind_structure.PC: + default: + throw new ArgumentException("Unsupported StbPileKind"); + } + + return curveList; + } + + private static SectionCurve[] SecRcPileToCurves(object figure, IReadOnlyList sectionPoints, Vector3d axis) + { + var curveList = new List(); + Vector3d[] localAxis = Utils.CreateLocalAxis(sectionPoints); + + switch (figure) + { + case StbSecPile_RC_Straight straight: + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], straight.D, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], straight.D, localAxis[0])); + break; + case StbSecPile_RC_ExtendedFoot foot: + var footPos1 = sectionPoints[3] - axis * foot.length_extended_foot; + var footPos2 = footPos1 - axis * (foot.D_extended_foot - foot.D_axial) / 2d / Math.Tan(Math.PI / 180 * foot.angle_extended_foot_taper); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], foot.D_axial, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(footPos2, foot.D_axial, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(footPos1, foot.D_extended_foot, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], foot.D_extended_foot, localAxis[0])); + break; + case StbSecPile_RC_ExtendedTop top: + var topPos1 = sectionPoints[1] + axis * (top.D_extended_top - top.D_axial) / 2d / Math.Tan(Math.PI / 180 * top.angle_extended_top_taper); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], top.D_extended_top, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[1], top.D_extended_top, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(topPos1, top.D_axial, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], top.D_axial, localAxis[0])); + break; + case StbSecPile_RC_ExtendedTopFoot both: + var bothPos1 = sectionPoints[1] + axis * (both.D_extended_top - both.D_axial) / 2d / Math.Tan(Math.PI / 180 * both.angle_extended_top_taper); + var bothPos2 = sectionPoints[3] - axis * both.length_extended_foot; + var bothPos3 = bothPos2 - axis * (both.D_extended_foot - both.D_axial) / 2d / Math.Tan(Math.PI / 180 * both.angle_extended_foot_taper); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], both.D_extended_top, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[1], both.D_extended_top, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos1, both.D_axial, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos3, both.D_axial, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos2, both.D_extended_foot, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], both.D_extended_foot, localAxis[0])); + break; + default: + throw new ArgumentException(); + } + + return curveList.ToArray(); + } + } +} diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs index 482621a3..dff64a16 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs @@ -424,5 +424,45 @@ private static Point3d[] GetOpenCurvePts(IReadOnlyList wallPts, StbOpen return openCurvePts; } + + public GH_Structure Pile(IEnumerable piles) + { + var brepList = new GH_Structure(); + if (piles == null) + { + return brepList; + } + + foreach ((StbPile pile, int i) in piles.Select((pile, index) => (pile, index))) + { + StbPileKind_structure kind = pile.kind_structure; + + StbNode node = _nodes.First(n => n.id == pile.id_node); + Point3d[] endNodes = + { + new Point3d(node.X, node.Y, node.Z), + new Point3d(node.X, node.Y, node.Z - pile.length_all) + }; + Point3d[] offset = + { + new Point3d(pile.offset_X, pile.offset_Y, pile.level_top), + new Point3d(pile.offset_X, pile.offset_Y, pile.level_top), + }; + Point3d[] sectionPoints = + { + endNodes[0] + offset[0], + new Point3d(), + new Point3d(), + endNodes[1] + offset[1] + }; + Vector3d memberAxis = sectionPoints[3] - sectionPoints[0]; + sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * pile.length_head; + + var brepMaker = new BrepMaker.Pile(_sections, _tolerance); + brepList.Append(new GH_Brep(brepMaker.CreatePileBrep(pile.id_section, kind, sectionPoints, memberAxis / memberAxis.Length)), new GH_Path(0, i)); + } + + return brepList; + } } } From 843a5000850fc19130d6f1e440ecafb624392a6a Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 27 May 2023 17:51:51 +0900 Subject: [PATCH 05/13] Fix 0 length haunch beam bake error --- .../Utils/Geometry/BrepMaker/Girder.cs | 20 ++++++------- .../BrepMaker/GirderFigureToCurveList.cs | 28 +++++++++---------- .../Geometry/CreateMemberBrepListFromStb.cs | 28 ++++++++++++------- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs index 309cba44..d1bb6f1e 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs @@ -77,14 +77,14 @@ private static SectionCurve[] SecRcBeamCurves(IReadOnlyList figures, IRe case 1: var straight = figures[0] as StbSecBeam_RC_Straight; curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[0], straight.depth, straight.width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[3], straight.depth, straight.width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[5], straight.depth, straight.width, localAxis)); break; case 2: var taper = new[] { figures[0] as StbSecBeam_RC_Taper, figures[1] as StbSecBeam_RC_Taper }; curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[0], taper[0].depth, taper[0].width, localAxis)); curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[1], taper[0].depth, taper[0].width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[2], taper[1].depth, taper[1].width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[3], taper[1].depth, taper[1].width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[4], taper[1].depth, taper[1].width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[5], taper[1].depth, taper[1].width, localAxis)); break; case 3: var haunch = new[] { figures[0] as StbSecBeam_RC_Haunch, figures[1] as StbSecBeam_RC_Haunch, figures[2] as StbSecBeam_RC_Haunch }; @@ -93,8 +93,8 @@ private static SectionCurve[] SecRcBeamCurves(IReadOnlyList figures, IRe StbSecBeam_RC_Haunch end = haunch.First(fig => fig.pos == StbSecBeam_RC_HaunchPos.END); curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[0], start.depth, start.width, localAxis)); curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[1], center.depth, center.width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[2], center.depth, center.width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[3], end.depth, end.width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[4], center.depth, center.width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[5], end.depth, end.width, localAxis)); break; default: throw new Exception(); @@ -113,14 +113,14 @@ private static SectionCurve[] SecSrcBeamCurves(IReadOnlyList figures, IR case 1: var straight = figures[0] as StbSecBeam_SRC_Straight; curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[0], straight.depth, straight.width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[3], straight.depth, straight.width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[5], straight.depth, straight.width, localAxis)); break; case 2: var taper = new[] { figures[0] as StbSecBeam_SRC_Taper, figures[1] as StbSecBeam_SRC_Taper }; curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[0], taper[0].depth, taper[0].width, localAxis)); curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[1], taper[0].depth, taper[0].width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[2], taper[1].depth, taper[1].width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[3], taper[1].depth, taper[1].width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[4], taper[1].depth, taper[1].width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[5], taper[1].depth, taper[1].width, localAxis)); break; case 3: var haunch = new[] { figures[0] as StbSecBeam_SRC_Haunch, figures[1] as StbSecBeam_SRC_Haunch, figures[2] as StbSecBeam_SRC_Haunch }; @@ -129,8 +129,8 @@ private static SectionCurve[] SecSrcBeamCurves(IReadOnlyList figures, IR StbSecBeam_SRC_Haunch end = haunch.First(fig => fig.pos == StbSecBeam_RC_HaunchPos.END); curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[0], start.depth, start.width, localAxis)); curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[1], center.depth, center.width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[2], center.depth, center.width, localAxis)); - curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[3], end.depth, end.width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[4], center.depth, center.width, localAxis)); + curveList.Add(SectionCurve.CreateSolidBeamRect(sectionPoints[5], end.depth, end.width, localAxis)); break; default: throw new Exception(); diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs index fd00fb9f..1ccf257e 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs @@ -22,7 +22,7 @@ public void SingleFigure(IReadOnlyList figures, IReadOnlyList s var straight = figures[0] as StbSecSteelBeam_S_Straight; string center = straight.shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } public void TwoFigure(IReadOnlyList figures, IReadOnlyList sectionPoints, ICollection curveList, Vector3d[] localAxis) @@ -78,8 +78,8 @@ private void TwoFigureTaper(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_TaperPos.END).shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[1], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[2], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[4], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } private void TwoFigureJoint(IReadOnlyList figures, IReadOnlyList sectionPoints, ICollection curveList, Vector3d[] localAxis) @@ -91,17 +91,17 @@ private void TwoFigureJoint(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_JointPos.START).shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } else { string end = joint.First(sec => sec.pos == StbSecSteelBeam_S_JointPos.END).shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } } @@ -116,8 +116,8 @@ private void TwoFigureHaunch(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_HaunchPos.CENTER).shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[4], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } else { @@ -125,8 +125,8 @@ private void TwoFigureHaunch(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_HaunchPos.END).shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[4], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } } @@ -138,8 +138,8 @@ private void ThreeFigureHaunch(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_HaunchPos.END).shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[4], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } private void ThreeFigureJoint(IReadOnlyList figures, IReadOnlyList sectionPoints, ICollection curveList, Vector3d[] localAxis) @@ -149,9 +149,9 @@ private void ThreeFigureJoint(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_JointPos.CENTER).shape; string end = joint.First(sec => sec.pos == StbSecSteelBeam_S_JointPos.END).shape; curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Beam, localAxis)); curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); } } } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs index dff64a16..e57c1f97 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs @@ -128,13 +128,17 @@ public GH_Structure Girder(IEnumerable girders) Point3d[] sectionPoints = { new Point3d(endNodes[0].X, endNodes[0].Y, endNodes[0].Z) + offset[0], - Point3d.Origin, - Point3d.Origin, + Point3d.Origin, // haunch_s + Point3d.Origin, // joint_s + Point3d.Origin, // joint_e + Point3d.Origin, // haunch_e new Point3d(endNodes[1].X, endNodes[1].Y, endNodes[1].Z) + offset[1] }; - Vector3d memberAxis = sectionPoints[3] - sectionPoints[0]; - sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * girder.joint_start; - sectionPoints[2] = sectionPoints[3] - memberAxis / memberAxis.Length * girder.joint_end; + Vector3d memberAxis = sectionPoints[5] - sectionPoints[0]; + sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * girder.haunch_start; + sectionPoints[2] = sectionPoints[0] + memberAxis / memberAxis.Length * girder.joint_start; + sectionPoints[3] = sectionPoints[5] - memberAxis / memberAxis.Length * girder.joint_end; + sectionPoints[4] = sectionPoints[5] - memberAxis / memberAxis.Length * girder.haunch_end; var brepMaker = new BrepMaker.Girder(_sections, _tolerance); brepList.Append(new GH_Brep(brepMaker.CreateGirderBrep(girder.id_section, girder.rotate, kind, sectionPoints, memberAxis)), new GH_Path(0, i)); @@ -168,13 +172,17 @@ public GH_Structure Beam(IEnumerable beams) Point3d[] sectionPoints = { new Point3d(endNodes[0].X, endNodes[0].Y, endNodes[0].Z) + offset[0], - Point3d.Origin, - Point3d.Origin, + Point3d.Origin, // haunch_s + Point3d.Origin, // joint_s + Point3d.Origin, // joint_e + Point3d.Origin, // haunch_e new Point3d(endNodes[1].X, endNodes[1].Y, endNodes[1].Z) + offset[1] }; - Vector3d memberAxis = sectionPoints[3] - sectionPoints[0]; - sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * beam.joint_start; - sectionPoints[2] = sectionPoints[3] - memberAxis / memberAxis.Length * beam.joint_end; + Vector3d memberAxis = sectionPoints[5] - sectionPoints[0]; + sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * beam.haunch_start; + sectionPoints[2] = sectionPoints[0] + memberAxis / memberAxis.Length * beam.joint_start; + sectionPoints[3] = sectionPoints[5] - memberAxis / memberAxis.Length * beam.joint_end; + sectionPoints[4] = sectionPoints[5] - memberAxis / memberAxis.Length * beam.haunch_end; var brepMaker = new BrepMaker.Girder(_sections, _tolerance); brepList.Append(new GH_Brep(brepMaker.CreateGirderBrep(beam.id_section, beam.rotate, kind, sectionPoints, memberAxis)), new GH_Path(0, i)); From 000ed9e07d19061db246d5bdb02b5ac1a532680f Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 27 May 2023 20:57:09 +0900 Subject: [PATCH 06/13] Fix even input radius, input in diameter. --- HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs index a201440d..e29c34ca 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs @@ -33,7 +33,7 @@ public static SectionCurve CreateSolidColumnCircle(Point3d sectionPoint, double { return new SectionCurve { - OuterCurve = SectionCornerPoints.ColumnPipe(sectionPoint, diameter, xAxis), + OuterCurve = SectionCornerPoints.ColumnPipe(sectionPoint, diameter / 2, xAxis), InnerCurve = null, Shape = SectionShape.Circle, Type = SectionType.Solid, From f4338949d3f35ef21d0585bbb480c3652dc2fe23 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 27 May 2023 20:57:34 +0900 Subject: [PATCH 07/13] Add support S2B Footing --- HoaryFox/RH7/Component/Geometry/Stb2Brep.cs | 10 ++-- .../Utils/Geometry/BrepMaker/Footing.cs | 56 +++++++++++++++++++ .../Geometry/CreateMemberBrepListFromStb.cs | 37 ++++++++++++ HoaryFox/RH7/Component/Utils/TagUtils.cs | 6 +- 4 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs diff --git a/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs b/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs index fd33bc21..18429709 100644 --- a/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs +++ b/HoaryFox/RH7/Component/Geometry/Stb2Brep.cs @@ -22,7 +22,7 @@ namespace HoaryFox.Component.Geometry public class Stb2Brep : GH_Component { private ST_BRIDGE _stBridge; - private readonly GH_Structure[] _brepList = new GH_Structure[8]; + private readonly GH_Structure[] _brepList = new GH_Structure[9]; public override GH_Exposure Exposure => GH_Exposure.primary; @@ -49,6 +49,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) pManager.AddBrepParameter("Slabs", "Slb", "output StbSlabs to Brep", GH_ParamAccess.tree); pManager.AddBrepParameter("Walls", "Wl", "output StbWalls to Brep", GH_ParamAccess.tree); pManager.AddBrepParameter("Piles", "Pil", "output StbPiles to Brep", GH_ParamAccess.tree); + pManager.AddBrepParameter("Footings", "Ftg", "output StbFootings to Brep", GH_ParamAccess.tree); } protected override void SolveInstance(IGH_DataAccess dataAccess) @@ -63,7 +64,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) BakeBrep(); } - for (var i = 0; i < 8; i++) + for (var i = 0; i < 9; i++) { dataAccess.SetDataTree(i, _brepList[i]); } @@ -84,13 +85,14 @@ private void CreateBrep() _brepList[5] = brepFromStb.Slab(member.StbSlabs); _brepList[6] = brepFromStb.Wall(member.StbWalls, member.StbOpens); _brepList[7] = brepFromStb.Pile(member.StbPiles); + _brepList[8] = brepFromStb.Footing(member.StbFootings); } private void BakeBrep() { RhinoDoc activeDoc = RhinoDoc.ActiveDoc; - var parentLayerNames = new[] { "Column", "Girder", "Post", "Beam", "Brace", "Slab", "Wall", "Pile" }; - Color[] layerColors = { Color.Red, Color.Green, Color.Aquamarine, Color.LightCoral, Color.MediumPurple, Color.DarkGray, Color.CornflowerBlue, Color.DarkOrange }; + var parentLayerNames = new[] { "Column", "Girder", "Post", "Beam", "Brace", "Slab", "Wall", "Pile", "Footing" }; + Color[] layerColors = new[] { Color.Red, Color.Green, Color.Aquamarine, Color.LightCoral, Color.MediumPurple, Color.DarkGray, Color.CornflowerBlue, Color.DarkOrange, Color.DarkKhaki }; GeometryBaker.MakeParentLayers(activeDoc, parentLayerNames, layerColors); Dictionary[][] infoArray = Utils.TagUtils.GetAllSectionInfoArray(_stBridge.StbModel.StbMembers, _stBridge.StbModel.StbSections); diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs new file mode 100644 index 00000000..a05fef3d --- /dev/null +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Rhino.Geometry; + +using STBDotNet.v202; + +namespace HoaryFox.Component.Utils.Geometry.BrepMaker +{ + public class Footing + { + private readonly IReadOnlyList _tolerance; + private readonly StbSections _sections; + public Footing(StbSections sections, IReadOnlyList tolerance) + { + _tolerance = tolerance; + _sections = sections; + } + + public Brep CreateFootingBrep(string idSection, double rotate, IReadOnlyList sectionPoints, Vector3d axis) + { + SectionCurve[] curveList = CreateCurveList(idSection, sectionPoints, axis); + Utils.RotateCurveList(axis, curveList, rotate, sectionPoints); + return Utils.CreateCapedBrepFromLoft(curveList, _tolerance[0]); + } + + private SectionCurve[] CreateCurveList(string idSection, IReadOnlyList sectionPoints, Vector3d axis) + { + SectionCurve[] curveList; + StbSecFoundation_RC rcSec = _sections.StbSecFoundation_RC.First(sec => sec.id == idSection); + curveList = SecRcFootingToCurves(rcSec.StbSecFigureFoundation_RC.Item, sectionPoints, axis); + + return curveList; + } + + private static SectionCurve[] SecRcFootingToCurves(object figure, IReadOnlyList sectionPoints, Vector3d axis) + { + var curveList = new List(); + Vector3d[] localAxis = Utils.CreateLocalAxis(sectionPoints); + + switch (figure) + { + case StbSecFoundation_RC_Rect rect: + var topPt = sectionPoints[3] - axis * rect.depth; + curveList.Add(SectionCurve.CreateSolidColumnRect(topPt, rect.width_X, rect.width_Y, localAxis)); + curveList.Add(SectionCurve.CreateSolidColumnRect(sectionPoints[3], rect.width_X, rect.width_Y, localAxis)); + break; + default: + throw new ArgumentException("Unsupported StbSecFoundation_RC type."); + } + + return curveList.ToArray(); + } + } +} diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs index e57c1f97..3b71dadf 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs @@ -472,5 +472,42 @@ public GH_Structure Pile(IEnumerable piles) return brepList; } + + public GH_Structure Footing(IEnumerable footings) + { + var brepList = new GH_Structure(); + if (footings == null) + { + return brepList; + } + + foreach ((StbFooting footing, int i) in footings.Select((f, index) => (f, index))) + { + StbNode node = _nodes.First(n => n.id == footing.id_node); + Point3d[] endNodes = + { + new Point3d(node.X, node.Y, node.Z), + new Point3d(node.X, node.Y, node.Z + footing.level_bottom) + }; + Point3d[] offset = + { + new Point3d(footing.offset_X, footing.offset_Y, 0), + new Point3d(footing.offset_X, footing.offset_Y, 0), + }; + Point3d[] sectionPoints = + { + endNodes[0] + offset[0], + new Point3d(), + new Point3d(), + endNodes[1] + offset[1] + }; + Vector3d memberAxis = sectionPoints[3] - sectionPoints[0]; + + var brepMaker = new BrepMaker.Footing(_sections, _tolerance); + brepList.Append(new GH_Brep(brepMaker.CreateFootingBrep(footing.id_section, footing.rotate, sectionPoints, memberAxis / memberAxis.Length)), new GH_Path(0, i)); + } + + return brepList; + } } } diff --git a/HoaryFox/RH7/Component/Utils/TagUtils.cs b/HoaryFox/RH7/Component/Utils/TagUtils.cs index 7ce0aa42..8d237259 100644 --- a/HoaryFox/RH7/Component/Utils/TagUtils.cs +++ b/HoaryFox/RH7/Component/Utils/TagUtils.cs @@ -294,10 +294,10 @@ internal static IEnumerable GetWallRcSection(StbSecWall_RC_Straight f public static Dictionary[][] GetAllSectionInfoArray(StbMembers members, StbSections sections) { - var allTagList = new Dictionary[8][]; + var allTagList = new Dictionary[9][]; - var memberArray = new object[][] { members.StbColumns, members.StbGirders, members.StbPosts, members.StbBeams, members.StbBraces, members.StbSlabs, members.StbWalls, members.StbPiles }; - for (var i = 0; i < 8; i++) + var memberArray = new object[][] { members.StbColumns, members.StbGirders, members.StbPosts, members.StbBeams, members.StbBraces, members.StbSlabs, members.StbWalls, members.StbPiles, members.StbFootings }; + for (var i = 0; i < 9; i++) { allTagList[i] = memberArray[i] != null ? StbMembersToDictArray(memberArray[i], sections) : Array.Empty>(); } From e6f0c3903aa3b732001df69b4b09fd549a2fe3d2 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sun, 28 May 2023 13:36:50 +0900 Subject: [PATCH 08/13] Fix same d extended pile bake error --- .../Utils/Geometry/BrepMaker/Pile.cs | 94 ++++++++++++++----- 1 file changed, 71 insertions(+), 23 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs index 52e17823..2154339b 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs @@ -61,38 +61,48 @@ private static SectionCurve[] SecRcPileToCurves(object figure, IReadOnlyList(); Vector3d[] localAxis = Utils.CreateLocalAxis(sectionPoints); - switch (figure) { case StbSecPile_RC_Straight straight: - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], straight.D, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], straight.D, localAxis[0])); + PileStraight(sectionPoints, curveList, localAxis, straight.D); break; case StbSecPile_RC_ExtendedFoot foot: - var footPos1 = sectionPoints[3] - axis * foot.length_extended_foot; - var footPos2 = footPos1 - axis * (foot.D_extended_foot - foot.D_axial) / 2d / Math.Tan(Math.PI / 180 * foot.angle_extended_foot_taper); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], foot.D_axial, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(footPos2, foot.D_axial, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(footPos1, foot.D_extended_foot, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], foot.D_extended_foot, localAxis[0])); + if (foot.D_axial == foot.D_extended_foot) + { + PileStraight(sectionPoints, curveList, localAxis, foot.D_axial); + } + else + { + PileExtendedFoot(sectionPoints, axis, curveList, localAxis, foot.D_axial, foot.D_extended_foot, foot.length_extended_foot, foot.angle_extended_foot_taper); + } break; case StbSecPile_RC_ExtendedTop top: - var topPos1 = sectionPoints[1] + axis * (top.D_extended_top - top.D_axial) / 2d / Math.Tan(Math.PI / 180 * top.angle_extended_top_taper); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], top.D_extended_top, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[1], top.D_extended_top, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(topPos1, top.D_axial, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], top.D_axial, localAxis[0])); + if (top.D_axial == top.D_extended_top) + { + PileStraight(sectionPoints, curveList, localAxis, top.D_axial); + } + else + { + PileExtendedTop(sectionPoints, axis, curveList, localAxis, top.D_extended_top, top.D_axial, top.angle_extended_top_taper); + } break; case StbSecPile_RC_ExtendedTopFoot both: - var bothPos1 = sectionPoints[1] + axis * (both.D_extended_top - both.D_axial) / 2d / Math.Tan(Math.PI / 180 * both.angle_extended_top_taper); - var bothPos2 = sectionPoints[3] - axis * both.length_extended_foot; - var bothPos3 = bothPos2 - axis * (both.D_extended_foot - both.D_axial) / 2d / Math.Tan(Math.PI / 180 * both.angle_extended_foot_taper); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], both.D_extended_top, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[1], both.D_extended_top, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos1, both.D_axial, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos3, both.D_axial, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos2, both.D_extended_foot, localAxis[0])); - curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], both.D_extended_foot, localAxis[0])); + if (both.D_axial == both.D_extended_foot && both.D_axial == both.D_extended_top) + { + PileStraight(sectionPoints, curveList, localAxis, both.D_axial); + } + else if (both.D_axial == both.D_extended_foot) + { + PileExtendedTop(sectionPoints, axis, curveList, localAxis, both.D_extended_top, both.D_axial, both.angle_extended_top_taper); + } + else if (both.D_axial == both.D_extended_top) + { + PileExtendedFoot(sectionPoints, axis, curveList, localAxis, both.D_axial, both.D_extended_foot, both.length_extended_foot, both.angle_extended_foot_taper); + } + else + { + PileExtendedTopFoot(sectionPoints, axis, curveList, localAxis, both); + } break; default: throw new ArgumentException(); @@ -100,5 +110,43 @@ private static SectionCurve[] SecRcPileToCurves(object figure, IReadOnlyList sectionPoints, Vector3d axis, List curveList, Vector3d[] localAxis, StbSecPile_RC_ExtendedTopFoot both) + { + var bothPos1 = sectionPoints[1] + axis * (both.D_extended_top - both.D_axial) / 2d / Math.Tan(Math.PI / 180 * both.angle_extended_top_taper); + var bothPos2 = sectionPoints[3] - axis * both.length_extended_foot; + var bothPos3 = bothPos2 - axis * (both.D_extended_foot - both.D_axial) / 2d / Math.Tan(Math.PI / 180 * both.angle_extended_foot_taper); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], both.D_extended_top, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[1], both.D_extended_top, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos1, both.D_axial, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos3, both.D_axial, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(bothPos2, both.D_extended_foot, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], both.D_extended_foot, localAxis[0])); + } + + private static void PileExtendedTop(IReadOnlyList sectionPoints, Vector3d axis, List curveList, Vector3d[] localAxis, double dExtend, double d, double angle) + { + var topPos1 = sectionPoints[1] + axis * (dExtend - d) / 2d / Math.Tan(Math.PI / 180 * angle); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], dExtend, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[1], dExtend, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(topPos1, d, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], d, localAxis[0])); + } + + private static void PileExtendedFoot(IReadOnlyList sectionPoints, Vector3d axis, List curveList, Vector3d[] localAxis, double d, double dExtend, double length, double angle) + { + var footPos1 = sectionPoints[3] - axis * length; + var footPos2 = footPos1 - axis * (dExtend - d) / 2d / Math.Tan(Math.PI / 180 * angle); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], d, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(footPos2, d, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(footPos1, dExtend, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], dExtend, localAxis[0])); + } + + private static void PileStraight(IReadOnlyList sectionPoints, List curveList, Vector3d[] localAxis, double d) + { + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[0], d, localAxis[0])); + curveList.Add(SectionCurve.CreateSolidColumnCircle(sectionPoints[3], d, localAxis[0])); + } } } From d104e22357b0916ab6a9ac8b41d7bedb3605455f Mon Sep 17 00:00:00 2001 From: hrntsm Date: Mon, 29 May 2023 23:11:02 +0900 Subject: [PATCH 09/13] Add support stb PC pile to line --- .../Utils/Geometry/CreateLineFromStb.cs | 171 ++++++++++++++---- .../Component/Utils/Geometry/PCPileFigure.cs | 91 ++++++++++ 2 files changed, 229 insertions(+), 33 deletions(-) create mode 100644 HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs index b213db74..941be859 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs @@ -13,12 +13,14 @@ namespace HoaryFox.Component.Utils.Geometry public class CreateLineFromStb { private readonly StbMembers _members; + private readonly StbSections _sections; private readonly StbNode[] _nodes; private readonly bool _isOffset; public CreateLineFromStb(ST_BRIDGE stBridge, bool isOffset) { _members = stBridge.StbModel.StbMembers; + _sections = stBridge.StbModel.StbSections; _nodes = stBridge.StbModel.StbNodes; _isOffset = isOffset; } @@ -252,45 +254,148 @@ internal GH_Structure Piles() foreach ((StbPile member, int i) in _members.StbPiles.Select((member, index) => (member, index))) { - var nodeBottom = new StbNode(); - var nodeTop = new StbNode(); + switch (member.kind_structure) + { + case StbPileKind_structure.RC: + GetRcPileLines(lines, member, i); + break; + case StbPileKind_structure.S: + break; + case StbPileKind_structure.PC: + GetPcPileLines(lines, member, i); + break; + } + } - StbNode node = _nodes.First(n => n.id == member.id_node); - if (_isOffset) + return lines; + } + + private void GetPcPileLines(GH_Structure lines, StbPile member, int i) + { + var figures = GetFigureList(member); + + var nodes = new List(); + StbNode node = _nodes.First(n => n.id == member.id_node); + if (_isOffset) + { + nodes.Add(new StbNode { - nodeTop = new StbNode - { - X = node.X + member.offset_X, - Y = node.Y + member.offset_Y, - Z = node.Z + member.level_top - }; - nodeBottom = new StbNode - { - X = nodeTop.X, - Y = nodeTop.Y, - Z = nodeTop.Z - member.length_all - }; + X = node.X + member.offset_X, + Y = node.Y + member.offset_Y, + Z = node.Z + member.level_top + }); + } + else + { + nodes.Add(new StbNode + { + X = node.X, + Y = node.Y, + Z = node.Z + }); + } - } - else + foreach ((PCPileFigure figure, int index) in figures.Select((figure, index) => (figure, index))) + { + nodes.Add(new StbNode { - nodeTop = new StbNode - { - X = node.X, - Y = node.Y, - Z = node.Z - }; - nodeBottom = new StbNode - { - X = nodeTop.X, - Y = nodeTop.Y, - Z = nodeTop.Z - member.length_all + member.level_top - }; - } - lines.Append(GH_LineFromStbNode(nodeBottom, nodeTop), new GH_Path(0, i)); + X = nodes[index].X, + Y = nodes[index].Y, + Z = nodes[index].Z - figure.Length + }); + lines.Append(GH_LineFromStbNode(nodes[index], nodes[index + 1]), new GH_Path(0, i)); } + } - return lines; + private IEnumerable GetFigureList(StbPile member) + { + var figures = new List(); + var idSection = member.id_section; + + StbSecPileProduct secPileProduct = _sections.StbSecPileProduct.First(sec => sec.id == idSection); + var secNodularCPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_CPRC; + if (secNodularCPRC != null) + { + figures.AddRange(secNodularCPRC.Select(figure => new PCPileFigure(figure))); + } + var secNodularPHC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_PHC; + if (secNodularPHC != null) + { + figures.AddRange(secNodularPHC.Select(figure => new PCPileFigure(figure))); + } + var secNodularPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_PRC; + if (secNodularPRC != null) + { + figures.AddRange(secNodularPRC.Select(figure => new PCPileFigure(figure))); + } + var secCPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_CPRC; + if (secCPRC != null) + { + figures.AddRange(secCPRC.Select(figure => new PCPileFigure(figure))); + } + var secPHC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_PHC; + if (secPHC != null) + { + figures.AddRange(secPHC.Select(figure => new PCPileFigure(figure))); + } + var secPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_PRC; + if (secPRC != null) + { + figures.AddRange(secPRC.Select(figure => new PCPileFigure(figure))); + } + var secSC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_SC; + if (secSC != null) + { + figures.AddRange(secSC.Select(figure => new PCPileFigure(figure))); + } + var secST = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_ST; + if (secST != null) + { + figures.AddRange(secST.Select(figure => new PCPileFigure(figure))); + } + + figures.Sort(); + return figures; + } + + private void GetRcPileLines(GH_Structure lines, StbPile member, int i) + { + var nodeBottom = new StbNode(); + var nodeTop = new StbNode(); + + StbNode node = _nodes.First(n => n.id == member.id_node); + if (_isOffset) + { + nodeTop = new StbNode + { + X = node.X + member.offset_X, + Y = node.Y + member.offset_Y, + Z = node.Z + member.level_top + }; + nodeBottom = new StbNode + { + X = nodeTop.X, + Y = nodeTop.Y, + Z = nodeTop.Z - member.length_all + }; + + } + else + { + nodeTop = new StbNode + { + X = node.X, + Y = node.Y, + Z = node.Z + }; + nodeBottom = new StbNode + { + X = nodeTop.X, + Y = nodeTop.Y, + Z = nodeTop.Z - member.length_all + }; + } + lines.Append(GH_LineFromStbNode(nodeBottom, nodeTop), new GH_Path(0, i)); } private static GH_Line GH_LineFromStbNode(StbNode from, StbNode to) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs b/HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs new file mode 100644 index 00000000..35a96522 --- /dev/null +++ b/HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs @@ -0,0 +1,91 @@ +using System; + +using STBDotNet.v202; + +namespace HoaryFox.Component.Utils.Geometry +{ + public class PCPileFigure : IComparable + { + public int Order { get; private set; } + public double Diameter { get; private set; } + public double Thickness { get; private set; } + public double Length { get; private set; } + + public PCPileFigure(int order, double diameter, double thickness, double length) + { + Order = order; + Diameter = diameter; + Thickness = thickness; + Length = length; + } + + public PCPileFigure(StbSecPileProductNodular_CPRC figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D1; + Thickness = figure.tc; + Length = figure.length_pile; + } + + public PCPileFigure(StbSecPileProductNodular_PRC figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D1; + Thickness = figure.tc; + Length = figure.length_pile; + } + + public PCPileFigure(StbSecPileProductNodular_PHC figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D1; + Thickness = figure.t; + Length = figure.length_pile; + } + + public PCPileFigure(StbSecPileProduct_CPRC figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D; + Thickness = figure.tc; + Length = figure.length_pile; + } + + public PCPileFigure(StbSecPileProduct_PRC figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D; + Thickness = figure.tc; + Length = figure.length_pile; + } + + public PCPileFigure(StbSecPileProduct_PHC figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D; + Thickness = figure.t; + Length = figure.length_pile; + } + + public PCPileFigure(StbSecPileProduct_SC figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D; + Thickness = figure.tc; + Length = figure.length_pile; + } + + public PCPileFigure(StbSecPileProduct_ST figure) + { + Order = int.Parse(figure.id_order); + Diameter = figure.D1; + Thickness = figure.t1; + Length = figure.length_pile; + } + + public int CompareTo(PCPileFigure other) + { + return Order.CompareTo(other.Order); + } + } +} From 343e25a055fb70c8c2936457ff85be06849fc6ec Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 3 Jun 2023 16:00:10 +0900 Subject: [PATCH 10/13] Change stb2brep exception to show guid --- .../Component/Utils/Geometry/BrepMaker/Brace.cs | 6 ++++-- .../Component/Utils/Geometry/BrepMaker/Column.cs | 4 +++- .../Utils/Geometry/BrepMaker/Footing.cs | 16 +++++++++++++--- .../Component/Utils/Geometry/BrepMaker/Girder.cs | 8 ++++++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs index 221bd1a2..b732f3d1 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs @@ -12,11 +12,13 @@ public class Brace { private readonly IReadOnlyList _tolerance; private readonly StbSections _sections; + private readonly string _guid; - public Brace(StbSections sections, IReadOnlyList tolerance) + public Brace(StbSections sections, IReadOnlyList tolerance, string guid) { _tolerance = tolerance; _sections = sections; + _guid = guid; } public Brep CreateBraceBrep(string idSection, double rotate, StbBraceKind_structure kind, IReadOnlyList sectionPoints, Vector3d memberAxis) @@ -45,7 +47,7 @@ private SectionCurve[] CreateFromEachBraceKind(string idSection, StbBraceKind_st } catch (Exception) { - throw new ArgumentException("The cross-sectional shape of the brace seems to be wrong. Please check."); + throw new ArgumentException($"Error converting guid: {_guid}\nThe cross-sectional shape of the brace seems to be wrong. Please check."); } } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs index e99af064..3c508d57 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs @@ -12,6 +12,8 @@ public class Column { private readonly IReadOnlyList _tolerance; private readonly StbSections _sections; + private readonly string _guid; + public Column(StbSections sections, IReadOnlyList tolerance) { _tolerance = tolerance; @@ -34,7 +36,7 @@ private SectionCurve[] CreateFromEachColumnKind(string idSection, StbColumnKind_ } catch (Exception) { - throw new ArgumentException("The cross-sectional shape of the column or post seems to be wrong. Please check."); + throw new ArgumentException($"Error converting guid: {_guid}\nThe cross-sectional shape of the column or post seems to be wrong. Please check."); } return curveList; diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs index a05fef3d..c36929be 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Footing.cs @@ -12,10 +12,13 @@ public class Footing { private readonly IReadOnlyList _tolerance; private readonly StbSections _sections; - public Footing(StbSections sections, IReadOnlyList tolerance) + private readonly string _guid; + + public Footing(StbSections sections, IReadOnlyList tolerance, string guid) { _tolerance = tolerance; _sections = sections; + _guid = guid; } public Brep CreateFootingBrep(string idSection, double rotate, IReadOnlyList sectionPoints, Vector3d axis) @@ -28,8 +31,15 @@ public Brep CreateFootingBrep(string idSection, double rotate, IReadOnlyList sectionPoints, Vector3d axis) { SectionCurve[] curveList; - StbSecFoundation_RC rcSec = _sections.StbSecFoundation_RC.First(sec => sec.id == idSection); - curveList = SecRcFootingToCurves(rcSec.StbSecFigureFoundation_RC.Item, sectionPoints, axis); + try + { + StbSecFoundation_RC rcSec = _sections.StbSecFoundation_RC.First(sec => sec.id == idSection); + curveList = SecRcFootingToCurves(rcSec.StbSecFigureFoundation_RC.Item, sectionPoints, axis); + } + catch (Exception) + { + throw new ArgumentException($"Error converting guid: {_guid}\nThe cross-sectional shape of the footing seems to be wrong. Please check."); + } return curveList; } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs index d1bb6f1e..82620f9e 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Girder.cs @@ -12,11 +12,15 @@ public class Girder { private readonly IReadOnlyList _tolerance; private readonly StbSections _sections; - public Girder(StbSections sections, IReadOnlyList tolerance) + private readonly string _guid; + + public Girder(StbSections sections, IReadOnlyList tolerance, string guid) { _tolerance = tolerance; _sections = sections; + _guid = guid; } + public Brep CreateGirderBrep(string idSection, double rotate, StbGirderKind_structure kind, IReadOnlyList sectionPoints, Vector3d memberAxis) { SectionCurve[] curveList = CreateFromEachGirderKind(idSection, kind, sectionPoints); @@ -33,7 +37,7 @@ private SectionCurve[] CreateFromEachGirderKind(string idSection, StbGirderKind_ } catch (Exception) { - throw new ArgumentException("The cross-sectional shape of the girder or beam seems to be wrong. Please check."); + throw new ArgumentException($"Error converting guid: {_guid}\nThe cross-sectional shape of the girder or beam seems to be wrong. Please check."); } return curveList; From a4dcc07022082b11e65c1305ef17b5f5641b79db Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 3 Jun 2023 17:23:14 +0900 Subject: [PATCH 11/13] Add support PC Pile in S2B --- .../Utils/Geometry/BrepMaker/Column.cs | 3 +- .../Utils/Geometry/BrepMaker/Pile.cs | 32 +++++++- .../Utils/Geometry/CreateLineFromStb.cs | 60 ++------------- .../Geometry/CreateMemberBrepListFromStb.cs | 77 ++++++++++++------- .../Component/Utils/Geometry/PCPileFigure.cs | 59 ++++++++++++++ .../Component/Utils/Geometry/SectionCurve.cs | 12 +++ 6 files changed, 157 insertions(+), 86 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs index 3c508d57..246e6ed4 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs @@ -14,10 +14,11 @@ public class Column private readonly StbSections _sections; private readonly string _guid; - public Column(StbSections sections, IReadOnlyList tolerance) + public Column(StbSections sections, IReadOnlyList tolerance, string guid) { _tolerance = tolerance; _sections = sections; + _guid = guid; } public Brep CreateColumnBrep(string idSection, double rotate, StbColumnKind_structure kind, IReadOnlyList sectionPoints, Vector3d memberAxis) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs index 2154339b..ccbb1346 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs @@ -12,10 +12,13 @@ public class Pile { private readonly IReadOnlyList _tolerance; private readonly StbSections _sections; - public Pile(StbSections sections, IReadOnlyList tolerance) + private readonly string _guid; + + public Pile(StbSections sections, IReadOnlyList tolerance, string guid) { _tolerance = tolerance; _sections = sections; + _guid = guid; } public Brep CreatePileBrep(string idSection, StbPileKind_structure kind, IReadOnlyList sectionPoints, Vector3d axis) @@ -33,7 +36,7 @@ private SectionCurve[] CreateFromEachColumnKind(string idSection, StbPileKind_st } catch (Exception) { - throw new ArgumentException("The cross-sectional shape of the pile seems to be wrong. Please check."); + throw new ArgumentException($"Error converting guid: {_guid}\nThe cross-sectional shape of the pile seems to be wrong. Please check."); } return curveList; @@ -48,8 +51,11 @@ private SectionCurve[] CreateCurveList(string idSection, StbPileKind_structure k StbSecPile_RC rcSec = _sections.StbSecPile_RC.First(sec => sec.id == idSection); curveList = SecRcPileToCurves(rcSec.StbSecFigurePile_RC.Item, sectionPoints, axis); break; - case StbPileKind_structure.S: case StbPileKind_structure.PC: + StbSecPileProduct productSec = _sections.StbSecPileProduct.First(sec => sec.id == idSection); + curveList = SecProductPileToCurves(productSec, sectionPoints, axis); + break; + case StbPileKind_structure.S: default: throw new ArgumentException("Unsupported StbPileKind"); } @@ -57,6 +63,26 @@ private SectionCurve[] CreateCurveList(string idSection, StbPileKind_structure k return curveList; } + private SectionCurve[] SecProductPileToCurves(StbSecPileProduct stbSecPileProduct, IReadOnlyList sectionPoints, Vector3d axis) + { + var curveList = new List(); + Vector3d[] localAxis = Utils.CreateLocalAxis(sectionPoints); + var figures = PCPileFigure.GetFigureList(stbSecPileProduct); + foreach ((PCPileFigure fig, int index) in figures.Select((fig, index) => (fig, index))) + { + curveList.Add(SectionCurve.CreateSolidColumnPipe( + sectionPoints[index], fig.Diameter, fig.Diameter - 2 * fig.Thickness, localAxis[0]) + ); + curveList.Add(SectionCurve.CreateSolidColumnPipe( + sectionPoints[index + 1] + 10 * Vector3d.ZAxis, fig.Diameter, fig.Diameter - 2 * fig.Thickness, localAxis[0]) + ); + } + curveList.Add(SectionCurve.CreateSolidColumnPipe( + sectionPoints.Last(), figures.Last().Diameter, figures.Last().Diameter - 2 * figures.Last().Thickness, localAxis[0]) + ); + return curveList.ToArray(); + } + private static SectionCurve[] SecRcPileToCurves(object figure, IReadOnlyList sectionPoints, Vector3d axis) { var curveList = new List(); diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs index 941be859..d539d74e 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using Grasshopper.Kernel.Data; @@ -259,11 +260,11 @@ internal GH_Structure Piles() case StbPileKind_structure.RC: GetRcPileLines(lines, member, i); break; - case StbPileKind_structure.S: - break; case StbPileKind_structure.PC: GetPcPileLines(lines, member, i); break; + case StbPileKind_structure.S: + throw new NotImplementedException(); } } @@ -272,7 +273,7 @@ internal GH_Structure Piles() private void GetPcPileLines(GH_Structure lines, StbPile member, int i) { - var figures = GetFigureList(member); + var figures = PCPileFigure.GetFigureList(_sections, member); var nodes = new List(); StbNode node = _nodes.First(n => n.id == member.id_node); @@ -307,57 +308,6 @@ private void GetPcPileLines(GH_Structure lines, StbPile member, int i) } } - private IEnumerable GetFigureList(StbPile member) - { - var figures = new List(); - var idSection = member.id_section; - - StbSecPileProduct secPileProduct = _sections.StbSecPileProduct.First(sec => sec.id == idSection); - var secNodularCPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_CPRC; - if (secNodularCPRC != null) - { - figures.AddRange(secNodularCPRC.Select(figure => new PCPileFigure(figure))); - } - var secNodularPHC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_PHC; - if (secNodularPHC != null) - { - figures.AddRange(secNodularPHC.Select(figure => new PCPileFigure(figure))); - } - var secNodularPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_PRC; - if (secNodularPRC != null) - { - figures.AddRange(secNodularPRC.Select(figure => new PCPileFigure(figure))); - } - var secCPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_CPRC; - if (secCPRC != null) - { - figures.AddRange(secCPRC.Select(figure => new PCPileFigure(figure))); - } - var secPHC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_PHC; - if (secPHC != null) - { - figures.AddRange(secPHC.Select(figure => new PCPileFigure(figure))); - } - var secPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_PRC; - if (secPRC != null) - { - figures.AddRange(secPRC.Select(figure => new PCPileFigure(figure))); - } - var secSC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_SC; - if (secSC != null) - { - figures.AddRange(secSC.Select(figure => new PCPileFigure(figure))); - } - var secST = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_ST; - if (secST != null) - { - figures.AddRange(secST.Select(figure => new PCPileFigure(figure))); - } - - figures.Sort(); - return figures; - } - private void GetRcPileLines(GH_Structure lines, StbPile member, int i) { var nodeBottom = new StbNode(); diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs index 3b71dadf..b206e552 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs @@ -56,7 +56,7 @@ public GH_Structure Column(IEnumerable columns) sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * column.joint_bottom; sectionPoints[2] = sectionPoints[3] - memberAxis / memberAxis.Length * column.joint_top; - var brepMaker = new BrepMaker.Column(_sections, _tolerance); + var brepMaker = new BrepMaker.Column(_sections, _tolerance, column.guid); brepList.Append(new GH_Brep(brepMaker.CreateColumnBrep(column.id_section, column.rotate, kind, sectionPoints, memberAxis)), new GH_Path(0, i)); } @@ -96,7 +96,7 @@ public GH_Structure Post(IEnumerable posts) sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * post.joint_bottom; sectionPoints[2] = sectionPoints[3] - memberAxis / memberAxis.Length * post.joint_top; - var brepMaker = new BrepMaker.Column(_sections, _tolerance); + var brepMaker = new BrepMaker.Column(_sections, _tolerance, post.guid); brepList.Append(new GH_Brep(brepMaker.CreateColumnBrep(post.id_section, post.rotate, kind, sectionPoints, memberAxis)), new GH_Path(0, i)); } @@ -140,7 +140,7 @@ public GH_Structure Girder(IEnumerable girders) sectionPoints[3] = sectionPoints[5] - memberAxis / memberAxis.Length * girder.joint_end; sectionPoints[4] = sectionPoints[5] - memberAxis / memberAxis.Length * girder.haunch_end; - var brepMaker = new BrepMaker.Girder(_sections, _tolerance); + var brepMaker = new BrepMaker.Girder(_sections, _tolerance, girder.guid); brepList.Append(new GH_Brep(brepMaker.CreateGirderBrep(girder.id_section, girder.rotate, kind, sectionPoints, memberAxis)), new GH_Path(0, i)); } @@ -184,7 +184,7 @@ public GH_Structure Beam(IEnumerable beams) sectionPoints[3] = sectionPoints[5] - memberAxis / memberAxis.Length * beam.joint_end; sectionPoints[4] = sectionPoints[5] - memberAxis / memberAxis.Length * beam.haunch_end; - var brepMaker = new BrepMaker.Girder(_sections, _tolerance); + var brepMaker = new BrepMaker.Girder(_sections, _tolerance, beam.guid); brepList.Append(new GH_Brep(brepMaker.CreateGirderBrep(beam.id_section, beam.rotate, kind, sectionPoints, memberAxis)), new GH_Path(0, i)); } @@ -224,7 +224,7 @@ public GH_Structure Brace(IEnumerable braces) sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * brace.joint_start; sectionPoints[2] = sectionPoints[3] - memberAxis / memberAxis.Length * brace.joint_end; - var brepMaker = new BrepMaker.Brace(_sections, _tolerance); + var brepMaker = new BrepMaker.Brace(_sections, _tolerance, brace.guid); brepList.Append(new GH_Brep(brepMaker.CreateBraceBrep(brace.id_section, brace.rotate, kind, sectionPoints, memberAxis)), new GH_Path(0, i)); } @@ -444,30 +444,53 @@ public GH_Structure Pile(IEnumerable piles) foreach ((StbPile pile, int i) in piles.Select((pile, index) => (pile, index))) { StbPileKind_structure kind = pile.kind_structure; - StbNode node = _nodes.First(n => n.id == pile.id_node); - Point3d[] endNodes = - { - new Point3d(node.X, node.Y, node.Z), - new Point3d(node.X, node.Y, node.Z - pile.length_all) - }; - Point3d[] offset = - { - new Point3d(pile.offset_X, pile.offset_Y, pile.level_top), - new Point3d(pile.offset_X, pile.offset_Y, pile.level_top), - }; - Point3d[] sectionPoints = + var sectionPoints = new List(); + + switch (kind) { - endNodes[0] + offset[0], - new Point3d(), - new Point3d(), - endNodes[1] + offset[1] - }; - Vector3d memberAxis = sectionPoints[3] - sectionPoints[0]; - sectionPoints[1] = sectionPoints[0] + memberAxis / memberAxis.Length * pile.length_head; + case StbPileKind_structure.RC: + Point3d[] endNodes = + { + new Point3d(node.X, node.Y, node.Z), + new Point3d(node.X, node.Y, node.Z - pile.length_all) + }; + Point3d[] offset = + { + new Point3d(pile.offset_X, pile.offset_Y, pile.level_top), + new Point3d(pile.offset_X, pile.offset_Y, pile.level_top), + }; + sectionPoints = new List + { + endNodes[0] + offset[0], + new Point3d(), + new Point3d(), + endNodes[1] + offset[1] + }; + sectionPoints[1] = sectionPoints[0] - Vector3d.ZAxis * pile.length_head; + break; + case StbPileKind_structure.PC: + var figures = PCPileFigure.GetFigureList(_sections, pile); + sectionPoints.Add(new Point3d + { + X = node.X + pile.offset_X, + Y = node.Y + pile.offset_Y, + Z = node.Z + pile.level_top + }); + foreach ((PCPileFigure figure, int index) in figures.Select((figure, index) => (figure, index))) + { + sectionPoints.Add(new Point3d + { + X = sectionPoints[index].X, + Y = sectionPoints[index].Y, + Z = sectionPoints[index].Z - figure.Length + }); + } + break; + } - var brepMaker = new BrepMaker.Pile(_sections, _tolerance); - brepList.Append(new GH_Brep(brepMaker.CreatePileBrep(pile.id_section, kind, sectionPoints, memberAxis / memberAxis.Length)), new GH_Path(0, i)); + var brepMaker = new BrepMaker.Pile(_sections, _tolerance, pile.guid); + brepList.Append(new GH_Brep(brepMaker.CreatePileBrep(pile.id_section, kind, sectionPoints, -Vector3d.ZAxis)), new GH_Path(0, i)); } return brepList; @@ -503,7 +526,7 @@ public GH_Structure Footing(IEnumerable footings) }; Vector3d memberAxis = sectionPoints[3] - sectionPoints[0]; - var brepMaker = new BrepMaker.Footing(_sections, _tolerance); + var brepMaker = new BrepMaker.Footing(_sections, _tolerance, footing.guid); brepList.Append(new GH_Brep(brepMaker.CreateFootingBrep(footing.id_section, footing.rotate, sectionPoints, memberAxis / memberAxis.Length)), new GH_Path(0, i)); } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs b/HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs index 35a96522..5f2e8c36 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/PCPileFigure.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Linq; using STBDotNet.v202; @@ -87,5 +89,62 @@ public int CompareTo(PCPileFigure other) { return Order.CompareTo(other.Order); } + + public static IEnumerable GetFigureList(StbSections sections, StbPile member) + { + var figures = new List(); + var idSection = member.id_section; + + StbSecPileProduct secPileProduct = sections.StbSecPileProduct.First(sec => sec.id == idSection); + return GetFigureList(secPileProduct); + } + + public static List GetFigureList(StbSecPileProduct secPileProduct) + { + var figures = new List(); + var secNodularCPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_CPRC; + if (secNodularCPRC != null) + { + figures.AddRange(secNodularCPRC.Select(figure => new PCPileFigure(figure))); + } + var secNodularPHC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_PHC; + if (secNodularPHC != null) + { + figures.AddRange(secNodularPHC.Select(figure => new PCPileFigure(figure))); + } + var secNodularPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProductNodular_PRC; + if (secNodularPRC != null) + { + figures.AddRange(secNodularPRC.Select(figure => new PCPileFigure(figure))); + } + var secCPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_CPRC; + if (secCPRC != null) + { + figures.AddRange(secCPRC.Select(figure => new PCPileFigure(figure))); + } + var secPHC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_PHC; + if (secPHC != null) + { + figures.AddRange(secPHC.Select(figure => new PCPileFigure(figure))); + } + var secPRC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_PRC; + if (secPRC != null) + { + figures.AddRange(secPRC.Select(figure => new PCPileFigure(figure))); + } + var secSC = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_SC; + if (secSC != null) + { + figures.AddRange(secSC.Select(figure => new PCPileFigure(figure))); + } + var secST = secPileProduct.StbSecFigurePileProduct.StbSecPileProduct_ST; + if (secST != null) + { + figures.AddRange(secST.Select(figure => new PCPileFigure(figure))); + } + + figures.Sort(); + return figures; + } } } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs index e29c34ca..7201b24a 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs @@ -41,6 +41,18 @@ public static SectionCurve CreateSolidColumnCircle(Point3d sectionPoint, double }; } + public static SectionCurve CreateSolidColumnPipe(Point3d sectionPoint, double outerDiameter, double innerDiameter, Vector3d xAxis) + { + return new SectionCurve + { + OuterCurve = SectionCornerPoints.ColumnPipe(sectionPoint, outerDiameter / 2, xAxis), + InnerCurve = SectionCornerPoints.ColumnPipe(sectionPoint, innerDiameter / 2, xAxis), + Shape = SectionShape.Circle, + Type = SectionType.Solid, + XAxis = xAxis, + }; + } + public static SectionCurve CreateSolidBeamRect(Point3d sectionPoint, double depth, double width, Vector3d[] localAxis) { return new SectionCurve() From a42996f16dc9eff81c5c327c567d58339b9e7125 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 3 Jun 2023 17:42:38 +0900 Subject: [PATCH 12/13] Fix to 0 thickness column pc pile error --- HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs index 7201b24a..eb87850c 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs @@ -46,7 +46,7 @@ public static SectionCurve CreateSolidColumnPipe(Point3d sectionPoint, double ou return new SectionCurve { OuterCurve = SectionCornerPoints.ColumnPipe(sectionPoint, outerDiameter / 2, xAxis), - InnerCurve = SectionCornerPoints.ColumnPipe(sectionPoint, innerDiameter / 2, xAxis), + InnerCurve = outerDiameter != innerDiameter ? SectionCornerPoints.ColumnPipe(sectionPoint, innerDiameter / 2, xAxis) : null, Shape = SectionShape.Circle, Type = SectionType.Solid, XAxis = xAxis, From c28bcdfc5f1b7ebb346722ee51f04c4a45454465 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 3 Jun 2023 17:43:12 +0900 Subject: [PATCH 13/13] Apply formatter --- HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs index eb87850c..0c2b6ef7 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionCurve.cs @@ -46,7 +46,9 @@ public static SectionCurve CreateSolidColumnPipe(Point3d sectionPoint, double ou return new SectionCurve { OuterCurve = SectionCornerPoints.ColumnPipe(sectionPoint, outerDiameter / 2, xAxis), - InnerCurve = outerDiameter != innerDiameter ? SectionCornerPoints.ColumnPipe(sectionPoint, innerDiameter / 2, xAxis) : null, + InnerCurve = outerDiameter != innerDiameter + ? SectionCornerPoints.ColumnPipe(sectionPoint, innerDiameter / 2, xAxis) + : null, Shape = SectionShape.Circle, Type = SectionType.Solid, XAxis = xAxis,