From be8a8ce0cd8f6d3359ce5d328f9d332005bd1fe9 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Fri, 9 Jun 2023 23:12:05 +0900 Subject: [PATCH 1/5] Add support c section --- .../Utils/Geometry/BrepMaker/Brace.cs | 24 ++-- .../Utils/Geometry/BrepMaker/Column.cs | 48 ++++---- .../BrepMaker/GirderFigureToCurveList.cs | 60 +++++----- .../Utils/Geometry/BrepMaker/Pile.cs | 7 +- .../Utils/Geometry/BrepMaker/SteelSections.cs | 113 +++++++++++++++--- .../Utils/Geometry/BrepMaker/Utils.cs | 2 +- .../Utils/Geometry/SectionCornerPoints.cs | 61 ++++++++++ .../Component/Utils/Geometry/SectionShape.cs | 2 + 8 files changed, 227 insertions(+), 90 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs index b732f3d1..28e9a838 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Brace.cs @@ -62,31 +62,31 @@ private SectionCurve[] SecSteelBraceToCurves(IReadOnlyList figures, IRea case 1: var same = figures[0] as StbSecSteelBrace_S_Same; center = same.shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionType.Brace, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionPositionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionPositionType.Brace, localAxis)); break; case 2: var notSames = new[] { figures[0] as StbSecSteelBrace_S_NotSame, figures[1] as StbSecSteelBrace_S_NotSame }; start = notSames.First(sec => sec.pos == StbSecSteelBrace_S_NotSamePos.BOTTOM).shape; end = notSames.First(sec => sec.pos == StbSecSteelBrace_S_NotSamePos.TOP).shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionPositionType.Brace, localAxis)); curveList.Add(sectionPoints[0] == sectionPoints[1] - ? SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[2], Utils.SectionType.Brace, localAxis) - : SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[1], Utils.SectionType.Brace, localAxis)); + ? SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[2], Utils.SectionPositionType.Brace, localAxis) + : SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[1], Utils.SectionPositionType.Brace, localAxis)); curveList.Add(sectionPoints[0] == sectionPoints[1] - ? SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[2], Utils.SectionType.Brace, localAxis) - : SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[1], Utils.SectionType.Brace, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Brace, localAxis)); + ? SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[2], Utils.SectionPositionType.Brace, localAxis) + : SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[1], Utils.SectionPositionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionPositionType.Brace, localAxis)); break; case 3: var three = new[] { figures[0] as StbSecSteelBrace_S_ThreeTypes, figures[1] as StbSecSteelBrace_S_ThreeTypes, figures[2] as StbSecSteelBrace_S_ThreeTypes }; start = three.First(sec => sec.pos == StbSecSteelBrace_S_ThreeTypesPos.BOTTOM).shape; center = three.First(sec => sec.pos == StbSecSteelBrace_S_ThreeTypesPos.CENTER).shape; end = three.First(sec => sec.pos == StbSecSteelBrace_S_ThreeTypesPos.TOP).shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionType.Brace, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Brace, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Brace, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionPositionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionPositionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionPositionType.Brace, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionPositionType.Brace, localAxis)); break; default: throw new ArgumentException("Unmatched StbSecSteelBrace_S"); diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs index 246e6ed4..9c4db635 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs @@ -84,35 +84,35 @@ private SectionCurve[] SecCftColumnToCurves(IReadOnlyList figures, IRead case 1: var same = figures[0] as StbSecSteelColumn_CFT_Same; center = same.shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionPositionType.Column, localAxis)); break; case 2: var notSames = new[] { figures[0] as StbSecSteelColumn_CFT_NotSame, figures[1] as StbSecSteelColumn_CFT_NotSame }; bottom = notSames.First(item => item.pos == StbSecSteelColumn_CFT_NotSamePos.BOTTOM).shape; top = notSames.First(item => item.pos == StbSecSteelColumn_CFT_NotSamePos.TOP).shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionPositionType.Column, localAxis)); if (sectionPoints[1].Z > sectionPoints[0].Z) { - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[1], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[1], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[1], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[1], Utils.SectionPositionType.Column, localAxis)); } else { - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[2], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[2], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[2], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[2], Utils.SectionPositionType.Column, localAxis)); } - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionPositionType.Column, localAxis)); break; case 3: var three = new[] { figures[0] as StbSecSteelColumn_CFT_ThreeTypes, figures[1] as StbSecSteelColumn_CFT_ThreeTypes, figures[2] as StbSecSteelColumn_CFT_ThreeTypes }; bottom = three.First(item => item.pos == StbSecSteelColumn_CFT_ThreeTypesPos.BOTTOM).shape; center = three.First(item => item.pos == StbSecSteelColumn_CFT_ThreeTypesPos.CENTER).shape; top = three.First(item => item.pos == StbSecSteelColumn_CFT_ThreeTypesPos.TOP).shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionPositionType.Column, localAxis)); break; default: throw new ArgumentException("Unmatched StbSecSteelColumn_CFT"); @@ -165,35 +165,35 @@ private SectionCurve[] SecSteelColumnToCurves(IReadOnlyList figures, IRe case 1: var same = figures[0] as StbSecSteelColumn_S_Same; center = same.shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionPositionType.Column, localAxis)); break; case 2: var notSames = new[] { figures[0] as StbSecSteelColumn_S_NotSame, figures[1] as StbSecSteelColumn_S_NotSame }; bottom = notSames.First(item => item.pos == StbSecSteelColumn_S_NotSamePos.BOTTOM).shape; top = notSames.First(item => item.pos == StbSecSteelColumn_S_NotSamePos.TOP).shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionPositionType.Column, localAxis)); if (sectionPoints[1].Z > sectionPoints[0].Z) { - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[1], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[1], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[1], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[1], Utils.SectionPositionType.Column, localAxis)); } else { - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[2], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[2], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[2], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[2], Utils.SectionPositionType.Column, localAxis)); } - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionPositionType.Column, localAxis)); break; case 3: var three = new[] { figures[0] as StbSecSteelColumn_S_ThreeTypes, figures[1] as StbSecSteelColumn_S_ThreeTypes, figures[2] as StbSecSteelColumn_S_ThreeTypes }; bottom = three.First(item => item.pos == StbSecSteelColumn_S_ThreeTypesPos.BOTTOM).shape; center = three.First(item => item.pos == StbSecSteelColumn_S_ThreeTypesPos.CENTER).shape; top = three.First(item => item.pos == StbSecSteelColumn_S_ThreeTypesPos.TOP).shape; - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionType.Column, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, bottom, sectionPoints[0], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionPositionType.Column, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, top, sectionPoints[3], Utils.SectionPositionType.Column, localAxis)); break; default: throw new ArgumentException("Unmatched StbSecSteelColumn_S"); diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs index 1ccf257e..d9b51b64 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs @@ -21,8 +21,8 @@ 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[5], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[5], Utils.SectionPositionType.Beam, localAxis)); } public void TwoFigure(IReadOnlyList figures, IReadOnlyList sectionPoints, ICollection curveList, Vector3d[] localAxis) @@ -76,10 +76,10 @@ private void TwoFigureTaper(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_TaperPos.START).shape; string end = tapers.First(sec => 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[4], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[1], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[4], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionPositionType.Beam, localAxis)); } private void TwoFigureJoint(IReadOnlyList figures, IReadOnlyList sectionPoints, ICollection curveList, Vector3d[] localAxis) @@ -90,18 +90,18 @@ private void TwoFigureJoint(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_JointPos.START) != null) { string start = joint.First(sec => 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[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)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[5], Utils.SectionPositionType.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[2], 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)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionPositionType.Beam, localAxis)); } } @@ -114,19 +114,19 @@ private void TwoFigureHaunch(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_HaunchPos.START).shape; center = joint.First(sec => 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[4], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[5], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[4], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[5], Utils.SectionPositionType.Beam, localAxis)); } else { center = joint.First(sec => sec.pos == StbSecSteelBeam_S_HaunchPos.CENTER).shape; string end = joint.First(sec => 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[4], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[4], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionPositionType.Beam, localAxis)); } } @@ -136,10 +136,10 @@ private void ThreeFigureHaunch(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_HaunchPos.START).shape; string center = haunch.First(sec => sec.pos == StbSecSteelBeam_S_HaunchPos.CENTER).shape; string end = haunch.First(sec => 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[4], Utils.SectionType.Beam, localAxis)); - curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[1], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[4], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionPositionType.Beam, localAxis)); } private void ThreeFigureJoint(IReadOnlyList figures, IReadOnlyList sectionPoints, ICollection curveList, Vector3d[] localAxis) @@ -148,10 +148,10 @@ private void ThreeFigureJoint(IReadOnlyList figures, IReadOnlyList sec.pos == StbSecSteelBeam_S_JointPos.START).shape; string center = joint.First(sec => 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[2], 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)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, start, sectionPoints[0], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[2], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionPositionType.Beam, localAxis)); + curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[5], Utils.SectionPositionType.Beam, localAxis)); } } } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs index ccbb1346..80011c7a 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Pile.cs @@ -66,19 +66,18 @@ private SectionCurve[] CreateCurveList(string idSection, StbPileKind_structure k 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]) + sectionPoints[index], fig.Diameter, fig.Diameter - 2 * fig.Thickness, -Vector3d.ZAxis) ); curveList.Add(SectionCurve.CreateSolidColumnPipe( - sectionPoints[index + 1] + 10 * Vector3d.ZAxis, fig.Diameter, fig.Diameter - 2 * fig.Thickness, localAxis[0]) + sectionPoints[index + 1] + 10 * Vector3d.ZAxis, fig.Diameter, fig.Diameter - 2 * fig.Thickness, -Vector3d.ZAxis) ); } curveList.Add(SectionCurve.CreateSolidColumnPipe( - sectionPoints.Last(), figures.Last().Diameter, figures.Last().Diameter - 2 * figures.Last().Thickness, localAxis[0]) + sectionPoints.Last(), figures.Last().Diameter, figures.Last().Diameter - 2 * figures.Last().Thickness, -Vector3d.ZAxis) ); return curveList.ToArray(); } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs index 5232b1ab..9015fc98 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs @@ -10,7 +10,7 @@ namespace HoaryFox.Component.Utils.Geometry.BrepMaker { public static class SteelSections { - public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d point, Utils.SectionType type, Vector3d[] localAxis) + public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d point, Utils.SectionPositionType type, Vector3d[] localAxis) { // TODO: foreach なのに最初にマッチしたもので return しているのでが変なので直す。 if (secSteel.StbSecBuildBOX != null) @@ -78,15 +78,90 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d } // TODO: C 断面を実装する - if (secSteel.StbSecRollC != null || secSteel.StbSecLipC != null) + if (secSteel.StbSecRollC != null) { - throw new ArgumentException("StbSecRollC & StbSecLipC is not supported"); + foreach (StbSecRollC rollC in secSteel.StbSecRollC.Where(rollC => rollC.name == shape)) + { + return CurveFromStbSecRollC(localAxis, point, type, rollC); + } + } + + if (secSteel.StbSecLipC != null) + { + foreach (StbSecLipC lipC in secSteel.StbSecLipC.Where(lipC => lipC.name == shape)) + { + return CurveFromStbSecLipC(localAxis, point, type, lipC); + } } throw new ArgumentException("There are no matching steel section"); } - private static SectionCurve CurveFromStbSecPipe(IReadOnlyList localAxis, Point3d point, Utils.SectionType type, double diameter, double thickness) + private static SectionCurve CurveFromStbSecLipC(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, StbSecLipC lipC) + { + StbSecRollCType shapeType; + switch (lipC.type) + { + case StbSecLipCType.SINGLE: + shapeType = StbSecRollCType.SINGLE; + break; + case StbSecLipCType.BACKTOBACK: + shapeType = StbSecRollCType.BACKTOBACK; + break; + case StbSecLipCType.FACETOFACE: + shapeType = StbSecRollCType.FACETOFACE; + break; + default: + throw new ArgumentOutOfRangeException(); + } + return CurveFromSecC(localAxis, point, type, lipC.A, lipC.H, lipC.t, lipC.t, shapeType); + } + + private static SectionCurve CurveFromStbSecRollC(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, StbSecRollC rollC) + { + return CurveFromSecC(localAxis, point, type, rollC.B, rollC.A, rollC.t1, rollC.t2, rollC.type); + } + + private static SectionCurve CurveFromSecC(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, double width, double height, double tw, double tf, StbSecRollCType shapeType) + { + var sectionCurve = new SectionCurve + { + Shape = SectionShape.C, + Type = shapeType == StbSecRollCType.FACETOFACE ? SectionType.Hollow : SectionType.Solid, + XAxis = localAxis[0], + }; + switch (type) + { + case Utils.SectionPositionType.Column: + case Utils.SectionPositionType.Brace: + if (shapeType == StbSecRollCType.FACETOFACE) + { + sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.ColumnRect(point, 2 * width, height, localAxis[1], localAxis[2])); + sectionCurve.InnerCurve = new PolylineCurve(SectionCornerPoints.ColumnRect(point, 2 * width - tw * 2, height - tf * 2, localAxis[1], localAxis[2])); + } + else + { + sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.ColumnC(point, height, width, tw, tf, shapeType, localAxis[1], localAxis[2])); + } + break; + case Utils.SectionPositionType.Beam: + if (shapeType == StbSecRollCType.FACETOFACE) + { + sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.BeamRect(point, height, width, localAxis[1], localAxis[2])); + sectionCurve.InnerCurve = new PolylineCurve(SectionCornerPoints.BeamRect(point, height - tf * 2, width - tw * 2, localAxis[1], localAxis[2])); + } + else + { + sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.BeamC(point, height, width, tw, tf, shapeType, localAxis[1], localAxis[2])); + } + break; + default: + throw new ArgumentOutOfRangeException(nameof(type), type, null); + } + return sectionCurve; + } + + private static SectionCurve CurveFromStbSecPipe(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, double diameter, double thickness) { var radius = diameter / 2; var sectionCurve = new SectionCurve @@ -97,12 +172,12 @@ private static SectionCurve CurveFromStbSecPipe(IReadOnlyList localAxi }; switch (type) { - case Utils.SectionType.Column: - case Utils.SectionType.Brace: + case Utils.SectionPositionType.Column: + case Utils.SectionPositionType.Brace: sectionCurve.OuterCurve = SectionCornerPoints.ColumnPipe(point, radius, localAxis[0]); sectionCurve.InnerCurve = thickness > 0 ? SectionCornerPoints.ColumnPipe(point, radius - thickness, localAxis[0]) : null; break; - case Utils.SectionType.Beam: + case Utils.SectionPositionType.Beam: sectionCurve.OuterCurve = SectionCornerPoints.BeamPipe(point, radius, localAxis[0]); sectionCurve.InnerCurve = thickness > 0 ? SectionCornerPoints.BeamPipe(point, radius - thickness, localAxis[0]) : null; break; @@ -112,7 +187,7 @@ private static SectionCurve CurveFromStbSecPipe(IReadOnlyList localAxi return sectionCurve; } - private static SectionCurve CurveFromStbSecL(IReadOnlyList localAxis, Point3d point, Utils.SectionType type, StbSecRollL rollL) + private static SectionCurve CurveFromStbSecL(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, StbSecRollL rollL) { var sectionCurve = new SectionCurve { @@ -122,11 +197,11 @@ private static SectionCurve CurveFromStbSecL(IReadOnlyList localAxis, }; switch (type) { - case Utils.SectionType.Column: - case Utils.SectionType.Brace: + case Utils.SectionPositionType.Column: + case Utils.SectionPositionType.Brace: sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.ColumnL(point, rollL.A, rollL.B, rollL.t1, rollL.t2, rollL.type, localAxis[1], localAxis[2])); break; - case Utils.SectionType.Beam: + case Utils.SectionPositionType.Beam: sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.BeamL(point, rollL.A, rollL.B, rollL.t1, rollL.t2, rollL.type, localAxis[1], localAxis[2])); break; default: @@ -135,7 +210,7 @@ private static SectionCurve CurveFromStbSecL(IReadOnlyList localAxis, return sectionCurve; } - private static SectionCurve CurveFromStbSecBox(IReadOnlyList localAxis, Point3d point, Utils.SectionType type, double A, double B, double t1, double t2) + private static SectionCurve CurveFromStbSecBox(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, double A, double B, double t1, double t2) { var sectionCurve = new SectionCurve { @@ -145,12 +220,12 @@ private static SectionCurve CurveFromStbSecBox(IReadOnlyList localAxis }; switch (type) { - case Utils.SectionType.Column: - case Utils.SectionType.Brace: + case Utils.SectionPositionType.Column: + case Utils.SectionPositionType.Brace: sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.ColumnRect(point, B, A, localAxis[1], localAxis[2])); sectionCurve.InnerCurve = t1 > 0 ? new PolylineCurve(SectionCornerPoints.ColumnRect(point, B - 2 * t1, A - 2 * t2, localAxis[1], localAxis[2])) : null; break; - case Utils.SectionType.Beam: + case Utils.SectionPositionType.Beam: sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.BeamRect(point, B, A, localAxis[1], localAxis[2])); sectionCurve.InnerCurve = t1 > 0 ? new PolylineCurve(SectionCornerPoints.BeamRect(point, B - 2 * t1, A - 2 * t2, localAxis[1], localAxis[2])) : null; break; @@ -160,7 +235,7 @@ private static SectionCurve CurveFromStbSecBox(IReadOnlyList localAxis return sectionCurve; } - private static SectionCurve CurveFromStbSecH(IReadOnlyList localAxis, Point3d point, Utils.SectionType type, double A, double B, double t1, double t2) + private static SectionCurve CurveFromStbSecH(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, double A, double B, double t1, double t2) { var sectionCurve = new SectionCurve { @@ -170,11 +245,11 @@ private static SectionCurve CurveFromStbSecH(IReadOnlyList localAxis, }; switch (type) { - case Utils.SectionType.Column: - case Utils.SectionType.Brace: + case Utils.SectionPositionType.Column: + case Utils.SectionPositionType.Brace: sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.ColumnH(point, A, B, t1, t2, localAxis[1], localAxis[2])); break; - case Utils.SectionType.Beam: + case Utils.SectionPositionType.Beam: sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.BeamH(point, A, B, t1, t2, localAxis[1], localAxis[2])); break; default: diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Utils.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Utils.cs index 02e065e1..ae6068c2 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Utils.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Utils.cs @@ -91,7 +91,7 @@ public static Brep CreateCapedBrepFromLoft(SectionCurve[] sectionCurve, double t return brep; } - public enum SectionType + public enum SectionPositionType { Column, Beam, diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs index 1baebdab..2b90dc50 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs @@ -48,6 +48,37 @@ public static Point3d[] ColumnH(Point3d pt, double height, double width, double }; } + // TODO: 重心位置をちゃんと計算する + // 今は バウンディングボックスの図心 = STBの節点位置 になっている。 + // 7 - - 6 + // | 4 - 5 + // Y | | o + // ^ | 3 - 2 + // o > X 0 - - 1 + public static Point3d[] ColumnC(Point3d pt, double height, double width, double tw, double tf, StbSecRollCType type, Vector3d xAxis, Vector3d yAxis) + { + switch (type) + { + case StbSecRollCType.SINGLE: + return new[] + { + pt - xAxis * width / 2 - yAxis * height / 2, + pt + xAxis * width / 2 - yAxis * height / 2, + pt + xAxis * width / 2 - yAxis * (height / 2 - tf), + pt - xAxis * (width / 2 - tw) - yAxis * (height / 2 - tf), + pt - xAxis * (width / 2 - tw) + yAxis * (height / 2 - tf), + pt + xAxis * width / 2 + yAxis * (height / 2 - tf), + pt + xAxis * width / 2 + yAxis * height / 2, + pt - xAxis * width / 2 + yAxis * height / 2, + }; + case StbSecRollCType.BACKTOBACK: + return ColumnH(pt, height, width, 2 * tw, tf, xAxis, yAxis); + case StbSecRollCType.FACETOFACE: + default: + throw new ArgumentOutOfRangeException(nameof(type), type, null); + } + } + public static Point3d[] ColumnL(Point3d pt, double height, double width, double tw, double tf, StbSecRollLType type, Vector3d xAxis, Vector3d yAxis) { switch (type) @@ -143,6 +174,36 @@ public static Point3d[] BeamH(Point3d pt, double height, double width, double tw }; } + // TODO: 原点はここでよい? + // 7 - o - 6 + // | 4 - - 5 + // Z | | + // ^ | 3 - - 2 + // o > Y 0 - - - 1 + public static Point3d[] BeamC(Point3d pt, double height, double width, double tw, double tf, StbSecRollCType type, Vector3d yAxis, Vector3d zAxis) + { + switch (type) + { + case StbSecRollCType.SINGLE: + return new[] + { + pt - yAxis * width / 2 - zAxis * height, + pt + yAxis * width / 2 - zAxis * height, + pt + yAxis * width / 2 - zAxis * (height - tf), + pt - yAxis * (width / 2 - tw) - zAxis * (height - tf), + pt - yAxis * (width / 2 - tw) + zAxis * (height - tf), + pt + yAxis * width / 2 + zAxis * (height - tf), + pt + yAxis * width / 2, + pt - yAxis * width / 2, + }; + case StbSecRollCType.BACKTOBACK: + return BeamH(pt, height, width, 2 * tw, tf, yAxis, yAxis); + case StbSecRollCType.FACETOFACE: + default: + throw new ArgumentOutOfRangeException(nameof(type), type, null); + } + } + public static Point3d[] BeamL(Point3d pt, double height, double width, double tw, double tf, StbSecRollLType type, Vector3d yAxis, Vector3d zAxis) { switch (type) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs index 0ab08efa..a55cb6bd 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs @@ -8,6 +8,8 @@ public enum SectionShape L, Rectangle, Circle, + C, + LipC, Other, } } From a62683849f17279bedacc65a708d76d0fd21f483 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Fri, 9 Jun 2023 23:27:18 +0900 Subject: [PATCH 2/5] Clean SteelSections code --- .../Utils/Geometry/BrepMaker/SteelSections.cs | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs index 9015fc98..87c2208b 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs @@ -12,10 +12,10 @@ public static class SteelSections { public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d point, Utils.SectionPositionType type, Vector3d[] localAxis) { - // TODO: foreach なのに最初にマッチしたもので return しているのでが変なので直す。 if (secSteel.StbSecBuildBOX != null) { - foreach (StbSecBuildBOX box in secSteel.StbSecBuildBOX.Where(box => box.name == shape)) + StbSecBuildBOX box = secSteel.StbSecBuildBOX.FirstOrDefault(b => b.name == shape); + if (box != null) { return CurveFromStbSecBox(localAxis, point, type, box.A, box.B, box.t1, box.t2); } @@ -23,7 +23,8 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecRollBOX != null) { - foreach (StbSecRollBOX box in secSteel.StbSecRollBOX.Where(box => box.name == shape)) + StbSecRollBOX box = secSteel.StbSecRollBOX.FirstOrDefault(b => b.name == shape); + if (box != null) { return CurveFromStbSecBox(localAxis, point, type, box.A, box.B, box.t, box.t); } @@ -31,7 +32,8 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecFlatBar != null) { - foreach (StbSecFlatBar flatBar in secSteel.StbSecFlatBar.Where(bar => bar.name == shape)) + StbSecFlatBar flatBar = secSteel.StbSecFlatBar.FirstOrDefault(bar => bar.name == shape); + if (flatBar != null) { return CurveFromStbSecBox(localAxis, point, type, flatBar.B, flatBar.t, -1, -1); } @@ -39,7 +41,8 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecBuildH != null) { - foreach (StbSecBuildH buildH in secSteel.StbSecBuildH.Where(buildH => buildH.name == shape)) + StbSecBuildH buildH = secSteel.StbSecBuildH.FirstOrDefault(bH => bH.name == shape); + if (buildH != null) { return CurveFromStbSecH(localAxis, point, type, buildH.A, buildH.B, buildH.t1, buildH.t2); } @@ -47,7 +50,8 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecRollH != null) { - foreach (StbSecRollH rollH in secSteel.StbSecRollH.Where(rollH => rollH.name == shape)) + StbSecRollH rollH = secSteel.StbSecRollH.FirstOrDefault(rH => rH.name == shape); + if (rollH != null) { return CurveFromStbSecH(localAxis, point, type, rollH.A, rollH.B, rollH.t1, rollH.t2); } @@ -55,7 +59,8 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecRollL != null) { - foreach (StbSecRollL rollL in secSteel.StbSecRollL.Where(rollL => rollL.name == shape)) + StbSecRollL rollL = secSteel.StbSecRollL.FirstOrDefault(rL => rL.name == shape); + if (rollL != null) { return CurveFromStbSecL(localAxis, point, type, rollL); } @@ -63,7 +68,8 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecPipe != null) { - foreach (StbSecPipe pipe in secSteel.StbSecPipe.Where(pipe => pipe.name == shape)) + StbSecPipe pipe = secSteel.StbSecPipe.FirstOrDefault(p => p.name == shape); + if (pipe != null) { return CurveFromStbSecPipe(localAxis, point, type, pipe.D, pipe.t); } @@ -71,16 +77,17 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecRoundBar != null) { - foreach (StbSecRoundBar bar in secSteel.StbSecRoundBar.Where(pipe => pipe.name == shape)) + StbSecRoundBar bar = secSteel.StbSecRoundBar.FirstOrDefault(b => b.name == shape); + if (bar != null) { return CurveFromStbSecPipe(localAxis, point, type, bar.R, -1); } } - // TODO: C 断面を実装する if (secSteel.StbSecRollC != null) { - foreach (StbSecRollC rollC in secSteel.StbSecRollC.Where(rollC => rollC.name == shape)) + StbSecRollC rollC = secSteel.StbSecRollC.FirstOrDefault(rC => rC.name == shape); + if (rollC != null) { return CurveFromStbSecRollC(localAxis, point, type, rollC); } @@ -88,7 +95,8 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d if (secSteel.StbSecLipC != null) { - foreach (StbSecLipC lipC in secSteel.StbSecLipC.Where(lipC => lipC.name == shape)) + StbSecLipC lipC = secSteel.StbSecLipC.FirstOrDefault(lC => lC.name == shape); + if (lipC != null) { return CurveFromStbSecLipC(localAxis, point, type, lipC); } From fec2ab126dd980fb92422666ed69d04f5a025b91 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Fri, 9 Jun 2023 23:32:08 +0900 Subject: [PATCH 3/5] Fix line pile length --- HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs index d539d74e..1a53a73f 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateLineFromStb.cs @@ -342,7 +342,7 @@ private void GetRcPileLines(GH_Structure lines, StbPile member, int i) { X = nodeTop.X, Y = nodeTop.Y, - Z = nodeTop.Z - member.length_all + Z = nodeTop.Z - member.length_all + member.level_top }; } lines.Append(GH_LineFromStbNode(nodeBottom, nodeTop), new GH_Path(0, i)); From aa16585a428a638c795b5a52b23acaacb2a3846f Mon Sep 17 00:00:00 2001 From: hrntsm Date: Fri, 9 Jun 2023 23:59:10 +0900 Subject: [PATCH 4/5] Support T shape section --- .../Utils/Geometry/BrepMaker/SteelSections.cs | 32 ++++ .../Utils/Geometry/SectionCornerPoints.cs | 151 +++++++++--------- .../Component/Utils/Geometry/SectionShape.cs | 1 + 3 files changed, 106 insertions(+), 78 deletions(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs index 87c2208b..86730d55 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/SteelSections.cs @@ -57,6 +57,15 @@ public static SectionCurve GetCurve(StbSecSteel secSteel, string shape, Point3d } } + if (secSteel.StbSecRollT != null) + { + StbSecRollT rollT = secSteel.StbSecRollT.FirstOrDefault(rT => rT.name == shape); + if (rollT != null) + { + return CurveFromStbSecT(localAxis, point, type, rollT.A, rollT.B, rollT.t1, rollT.t2); + } + } + if (secSteel.StbSecRollL != null) { StbSecRollL rollL = secSteel.StbSecRollL.FirstOrDefault(rL => rL.name == shape); @@ -265,5 +274,28 @@ private static SectionCurve CurveFromStbSecH(IReadOnlyList localAxis, } return sectionCurve; } + + private static SectionCurve CurveFromStbSecT(IReadOnlyList localAxis, Point3d point, Utils.SectionPositionType type, double A, double B, double t1, double t2) + { + var sectionCurve = new SectionCurve + { + Shape = SectionShape.T, + Type = SectionType.Solid, + XAxis = localAxis[0], + }; + switch (type) + { + case Utils.SectionPositionType.Column: + case Utils.SectionPositionType.Brace: + sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.ColumnT(point, A, B, t1, t2, localAxis[1], localAxis[2])); + break; + case Utils.SectionPositionType.Beam: + sectionCurve.OuterCurve = new PolylineCurve(SectionCornerPoints.BeamT(point, A, B, t1, t2, localAxis[1], localAxis[2])); + break; + default: + throw new ArgumentOutOfRangeException(nameof(type), type, null); + } + return sectionCurve; + } } } diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs index 2b90dc50..9cf4b845 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionCornerPoints.cs @@ -48,6 +48,25 @@ public static Point3d[] ColumnH(Point3d pt, double height, double width, double }; } + // 5 - - - - - 4 + // Y 6 - 7 2 - 3 + // ^ | o | + // o > X 0 - 1 + public static Point3d[] ColumnT(Point3d pt, double height, double width, double tw, double tf, Vector3d xAxis, Vector3d yAxis) + { + return new[] + { + pt - xAxis * tw - yAxis * height / 2, + pt + xAxis * tw - yAxis * height / 2, + pt + xAxis * tw + yAxis * (height / 2 - tf), + pt + xAxis * width + yAxis * (height / 2 - tf), + pt + xAxis * width + yAxis * height / 2, + pt - xAxis * width + yAxis * height / 2, + pt - xAxis * width + yAxis * (height / 2 - tf), + pt - xAxis * tw + yAxis * (height / 2 - tf), + }; + } + // TODO: 重心位置をちゃんと計算する // 今は バウンディングボックスの図心 = STBの節点位置 になっている。 // 7 - - 6 @@ -79,55 +98,36 @@ public static Point3d[] ColumnC(Point3d pt, double height, double width, double } } + // TODO: 重心位置をちゃんと計算する + // 今は バウンディングボックスの図心 = STBの節点位置 になっている。 + // 5 - - 4 + // Y | 2 - 3 + // ^ | | o + // o > X 0 1 public static Point3d[] ColumnL(Point3d pt, double height, double width, double tw, double tf, StbSecRollLType type, Vector3d xAxis, Vector3d yAxis) { switch (type) { case StbSecRollLType.SINGLE: - return ColumnLSingle(pt, height, width, tw, tf, xAxis, yAxis); + return new[] + { + pt - xAxis * width / 2 - yAxis * height / 2, + pt - xAxis * (width / 2 - tw) - yAxis * height / 2, + pt - xAxis * (width / 2 - tw) + yAxis * (height / 2 - tf), + pt + xAxis * width / 2 + yAxis * (height / 2 - tf), + pt + xAxis * width / 2 + yAxis * height / 2, + pt - xAxis * width / 2 + yAxis * height / 2, + pt - xAxis * width / 2 - yAxis * height / 2, + }; case StbSecRollLType.BACKTOBACK: - return ColumnLBackToBack(pt, height, width, tw, tf, xAxis, yAxis); + return ColumnT(pt, height, 2 * width, 2 * tw, tf, xAxis, yAxis); case StbSecRollLType.FACETOFACE: - return ColumnLFaceToFace(pt, height, width, tw, tf, xAxis, yAxis); + return ColumnC(pt, 2 * width, height, tf, tw, StbSecRollCType.SINGLE, -yAxis, xAxis); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } } - // TODO: 重心位置をちゃんと計算する - // 今は バウンディングボックスの図心 = STBの節点位置 になっている。 - // 5 - - 4 - // Y | 2 - 3 - // ^ | | o - // o > X 0 1 - private static Point3d[] ColumnLSingle(Point3d pt, double height, double width, double tw, double tf, Vector3d xAxis, Vector3d yAxis) - { - return new[] - { - pt - xAxis * width / 2 - yAxis * height / 2, - pt - xAxis * (width / 2 - tw) - yAxis * height / 2, - pt - xAxis * (width / 2 - tw) + yAxis * (height / 2 - tf), - pt + xAxis * width / 2 + yAxis * (height / 2 - tf), - pt + xAxis * width / 2 + yAxis * height / 2, - pt - xAxis * width / 2 + yAxis * height / 2, - pt - xAxis * width / 2 - yAxis * height / 2, - }; - } - - // 5 - - - - - 4 - // Y 6 - 7 2 - 3 - // ^ | o | - // o > X 0 - 1 - private static Point3d[] ColumnLBackToBack(Point3d pt, double height, double width, double tw, double tf, Vector3d xAxis, Vector3d yAxis) - { - throw new NotImplementedException(); - } - - private static Point3d[] ColumnLFaceToFace(Point3d pt, double height, double width, double tw, double tf, Vector3d xAxis, Vector3d yAxis) - { - throw new NotImplementedException(); - } - internal static Curve ColumnPipe(Point3d pt, double radius, Vector3d zAxis) { Plane plane = new Plane(pt, zAxis); @@ -174,6 +174,25 @@ public static Point3d[] BeamH(Point3d pt, double height, double width, double tw }; } + // 5 - - o - - 4 + // Y 6 - 7 2 - 3 + // ^ | | + // o > X 0 - 1 + public static Point3d[] BeamT(Point3d pt, double height, double width, double tw, double tf, Vector3d xAxis, Vector3d yAxis) + { + return new[] + { + pt - xAxis * tw - yAxis * height, + pt + xAxis * tw - yAxis * height, + pt + xAxis * tw + yAxis * (height - tf), + pt + xAxis * width + yAxis * (height - tf), + pt + xAxis * width + yAxis * height, + pt - xAxis * width + yAxis * height, + pt - xAxis * width + yAxis * (height - tf), + pt - xAxis * tw + yAxis * (height - tf), + }; + } + // TODO: 原点はここでよい? // 7 - o - 6 // | 4 - - 5 @@ -204,59 +223,35 @@ public static Point3d[] BeamC(Point3d pt, double height, double width, double tw } } + // TODO: 断面の原点位置はここでよい?今は4と5の中心 + // 5 - o - 4 + // Z | 2 - - 3 + // ^ | | + // o > Y 0 1 public static Point3d[] BeamL(Point3d pt, double height, double width, double tw, double tf, StbSecRollLType type, Vector3d yAxis, Vector3d zAxis) { switch (type) { case StbSecRollLType.SINGLE: - return BeamLSingle(pt, height, width, tw, tf, yAxis, zAxis); + return new[] + { + pt - yAxis * width / 2 - zAxis * height, + pt - yAxis * (width / 2 - tw) - zAxis * height, + pt - yAxis * (width / 2 - tw) - zAxis * tf, + pt + yAxis * width / 2 - zAxis * tf, + pt + yAxis * width / 2, + pt - yAxis * width / 2, + pt - yAxis * width / 2 - zAxis * height + }; case StbSecRollLType.BACKTOBACK: - return BeamLBackToBack(pt, height, width, tw, tf, yAxis, zAxis); + return BeamT(pt, height, width, tw, tf, yAxis, zAxis); case StbSecRollLType.FACETOFACE: - return BeamLFaceToFace(pt, height, width, tw, tf, yAxis, zAxis); + return BeamC(pt, 2 * width, height, tf, tw, StbSecRollCType.SINGLE, -zAxis, yAxis); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } } - // TODO: 断面の原点位置はここでよい?今は4と5の中心 - // 5 - o - 4 - // Z | 2 - - 3 - // ^ | | - // o > Y 0 1 - private static Point3d[] BeamLSingle(Point3d pt, double height, double width, double tw, double tf, Vector3d yAxis, Vector3d zAxis) - { - return new[] - { - pt - yAxis * width / 2 - zAxis * height, - pt - yAxis * (width / 2 - tw) - zAxis * height, - pt - yAxis * (width / 2 - tw) - zAxis * tf, - pt + yAxis * width / 2 - zAxis * tf, - pt + yAxis * width / 2, - pt - yAxis * width / 2, - pt - yAxis * width / 2 - zAxis * height - }; - } - - // 5 - - o - - 4 - // Z 6 - 7 2 - 3 - // ^ | | - // o > Y 0 - 1 - private static Point3d[] BeamLBackToBack(Point3d pt, double height, double width, double tw, double tf, Vector3d yAxis, Vector3d zAxis) - { - throw new NotImplementedException(); - } - - // 7 - - o - - 6 - // Z | 2 - 3 | - // ^ | | | | - // o > Y 0 - 1 4 - 5 - private static Point3d[] BeamLFaceToFace(Point3d pt, double height, double width, double tw, double tf, Vector3d yAxis, Vector3d zAxis) - { - throw new NotImplementedException(); - } - - internal static Curve BeamPipe(Point3d pt, double radius, Vector3d xAxis) { var centerPt = new Point3d(pt.X, pt.Y, pt.Z - radius); diff --git a/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs b/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs index a55cb6bd..86cab545 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/SectionShape.cs @@ -4,6 +4,7 @@ public enum SectionShape { Box, H, + T, Pipe, L, Rectangle, From 2607b4dbca1f702b9d59ad11f5896f99bd84cc2e Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sat, 10 Jun 2023 00:04:01 +0900 Subject: [PATCH 5/5] Fix error if wall open brep is null --- .../Component/Utils/Geometry/CreateMemberBrepListFromStb.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs index b206e552..e1eb376d 100644 --- a/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs +++ b/HoaryFox/RH7/Component/Utils/Geometry/CreateMemberBrepListFromStb.cs @@ -402,7 +402,10 @@ private Brep ApplyWallOpen(IEnumerable opens, StbWall wall, IReadOnlyLi Brep openBrep = Brep.CreateFromLoft(openCurve, Point3d.Unset, Point3d.Unset, LoftType.Straight, false)[0].CapPlanarHoles(_tolerance[0]); CheckBrepOrientation(openBrep); - brep = Brep.CreateBooleanDifference(brep, openBrep, 1)[0]; + if (openBrep != null) + { + brep = Brep.CreateBooleanDifference(brep, openBrep, 1)[0]; + } } }