Skip to content

Commit

Permalink
Merge pull request #198 from hrntsm/develop
Browse files Browse the repository at this point in the history
Release v2.0.1
  • Loading branch information
hrntsm authored Oct 10, 2021
2 parents 74abccb + eaed2f5 commit 16094e0
Show file tree
Hide file tree
Showing 10 changed files with 505 additions and 286 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-document.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: git config
run: |
git config --global user.email "contact@hrntsm.com"
git config --global user.name "hrntsm"
git config --global user.name "hiron"
- run: yarn install
- run: yarn deploy
env:
Expand Down
60 changes: 16 additions & 44 deletions HoaryFox/Component/Utils/Geometry/BrepMaker/Girder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ private static List<Curve> SecRcBeamCurves(IReadOnlyList<object> figures, IReadO
{
case 1:
var straight = figures[0] as StbSecBeam_RC_Straight;
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[0], straight.depth, straight.width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[3], straight.depth, straight.width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[0], straight.depth, straight.width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[3], straight.depth, straight.width, localAxis[1], localAxis[2])));
break;
case 2:
var taper = new[] { figures[0] as StbSecBeam_RC_Taper, figures[1] as StbSecBeam_RC_Taper };
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[0], taper[0].depth, taper[0].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[3], taper[1].depth, taper[1].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[0], taper[0].depth, taper[0].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[1], taper[0].depth, taper[0].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[2], taper[1].depth, taper[1].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[3], taper[1].depth, taper[1].width, localAxis[1], localAxis[2])));
break;
case 3:
var haunch = new[] { figures[0] as StbSecBeam_RC_Haunch, figures[1] as StbSecBeam_RC_Haunch, figures[2] as StbSecBeam_RC_Haunch };
Expand Down Expand Up @@ -94,17 +92,15 @@ private static List<Curve> SecSrcBeamCurves(IReadOnlyList<object> figures, IRead
{
case 1:
var straight = figures[0] as StbSecBeam_SRC_Straight;
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[0], straight.depth, straight.width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[3], straight.depth, straight.width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[0], straight.depth, straight.width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[3], straight.depth, straight.width, localAxis[1], localAxis[2])));
break;
case 2:
var taper = new[] { figures[0] as StbSecBeam_SRC_Taper, figures[1] as StbSecBeam_SRC_Taper };
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[0], taper[0].depth, taper[0].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(
SectionCornerPoints.BeamRect(sectionPoints[3], taper[1].depth, taper[1].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[0], taper[0].depth, taper[0].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[1], taper[0].depth, taper[0].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[2], taper[1].depth, taper[1].width, localAxis[1], localAxis[2])));
curveList.Add(new PolylineCurve(SectionCornerPoints.BeamRect(sectionPoints[3], taper[1].depth, taper[1].width, localAxis[1], localAxis[2])));
break;
case 3:
var haunch = new[] { figures[0] as StbSecBeam_SRC_Haunch, figures[1] as StbSecBeam_SRC_Haunch, figures[2] as StbSecBeam_SRC_Haunch };
Expand All @@ -126,43 +122,19 @@ private static List<Curve> SecSrcBeamCurves(IReadOnlyList<object> figures, IRead
private List<Curve> SecSteelBeamToCurves(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints)
{
var curveList = new List<Curve>();
string start, center, end;
Vector3d[] localAxis = Utils.CreateLocalAxis(sectionPoints);
var toCurveList = new GirderFigureToCurveList(_sections);

switch (figures.Count)
{
case 1:
var straight = figures[0] as StbSecSteelBeam_S_Straight;
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));
toCurveList.SingleFigure(figures, sectionPoints, curveList, localAxis);
break;
case 2:
var tapers = new[] { figures[0] as StbSecSteelBeam_S_Taper, figures[1] as StbSecSteelBeam_S_Taper };
start = tapers.First(sec => sec.pos == StbSecSteelBeam_S_TaperPos.START).shape;
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, end, sectionPoints[3], Utils.SectionType.Beam, localAxis));
toCurveList.TwoFigure(figures, sectionPoints, curveList, localAxis);
break;
case 3:
if (figures[0] is StbSecSteelBeam_S_Haunch)
{
var haunch = new[] { figures[0] as StbSecSteelBeam_S_Haunch, figures[1] as StbSecSteelBeam_S_Haunch, figures[2] as StbSecSteelBeam_S_Haunch };
start = haunch.First(sec => sec.pos == StbSecSteelBeam_S_HaunchPos.START).shape;
center = haunch.First(sec => sec.pos == StbSecSteelBeam_S_HaunchPos.CENTER).shape;
end = haunch.First(sec => sec.pos == StbSecSteelBeam_S_HaunchPos.END).shape;
}
else
{
var joint = new[] { figures[0] as StbSecSteelBeam_S_Joint, figures[1] as StbSecSteelBeam_S_Joint, figures[2] as StbSecSteelBeam_S_Joint };
start = joint.First(sec => sec.pos == StbSecSteelBeam_S_JointPos.START).shape;
center = joint.First(sec => sec.pos == StbSecSteelBeam_S_JointPos.CENTER).shape;
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));
toCurveList.ThreeFigure(figures, sectionPoints, curveList, localAxis);
break;
case 5:
throw new ArgumentException("5 section steel is not supported");
Expand Down
155 changes: 155 additions & 0 deletions HoaryFox/Component/Utils/Geometry/BrepMaker/GirderFigureToCurveList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Rhino.Geometry;
using STBDotNet.v202;

namespace HoaryFox.Component.Utils.Geometry.BrepMaker
{
public class GirderFigureToCurveList
{
private readonly StbSections _sections;

public GirderFigureToCurveList(StbSections sections)
{
_sections = sections;
}

public void SingleFigure(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
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));
}

public void TwoFigure(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
switch (figures[0])
{
case StbSecSteelBeam_S_Taper _:
{
TwoFigureTaper(figures, sectionPoints, curveList, localAxis);
break;
}
case StbSecSteelBeam_S_Joint _:
{
TwoFigureJoint(figures, sectionPoints, curveList, localAxis);
break;
}
case StbSecSteelBeam_S_Haunch _:
{
TwoFigureHaunch(figures, sectionPoints, curveList, localAxis);
break;
}
default:
{
throw new ArgumentException("Unmatched StbSecSteelBeam_S");
}
}
}

public void ThreeFigure(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
switch (figures[0])
{
case StbSecSteelBeam_S_Haunch _:
{
ThreeFigureHaunch(figures, sectionPoints, curveList, localAxis);
break;
}
case StbSecSteelBeam_S_Joint _:
{
ThreeFigureJoint(figures, sectionPoints, curveList, localAxis);
break;
}
default:
{
throw new ArgumentException("Unmatched StbSecSteelBeam_S");
}
}
}
private void TwoFigureTaper(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
var tapers = new[] { figures[0] as StbSecSteelBeam_S_Taper, figures[1] as StbSecSteelBeam_S_Taper };
string start = tapers.First(sec => 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[2], Utils.SectionType.Beam, localAxis));
curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis));
}

private void TwoFigureJoint(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
var joint = new[] { figures[0] as StbSecSteelBeam_S_Joint, figures[1] as StbSecSteelBeam_S_Joint };
string center = joint.First(sec => sec.pos == StbSecSteelBeam_S_JointPos.CENTER).shape;

if (joint.FirstOrDefault(sec => 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[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));
}
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));
}
}

private void TwoFigureHaunch(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
var joint = new[] { figures[0] as StbSecSteelBeam_S_Haunch, figures[1] as StbSecSteelBeam_S_Haunch };
string center;

if (joint.FirstOrDefault(sec => sec.pos == StbSecSteelBeam_S_HaunchPos.START) != null)
{
string start = joint.First(sec => 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[2], Utils.SectionType.Beam, localAxis));
curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, center, sectionPoints[3], Utils.SectionType.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[2], Utils.SectionType.Beam, localAxis));
curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis));
}
}

private void ThreeFigureHaunch(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
var haunch = new[] { figures[0] as StbSecSteelBeam_S_Haunch, figures[1] as StbSecSteelBeam_S_Haunch, figures[2] as StbSecSteelBeam_S_Haunch };
string start = haunch.First(sec => 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[2], Utils.SectionType.Beam, localAxis));
curveList.Add(SteelSections.GetCurve(_sections.StbSecSteel, end, sectionPoints[3], Utils.SectionType.Beam, localAxis));
}

private void ThreeFigureJoint(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints, ICollection<Curve> curveList, Vector3d[] localAxis)
{
var joint = new[] { figures[0] as StbSecSteelBeam_S_Joint, figures[1] as StbSecSteelBeam_S_Joint, figures[2] as StbSecSteelBeam_S_Joint };
string start = joint.First(sec => 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[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));
}
}
}
Loading

0 comments on commit 16094e0

Please sign in to comment.