Skip to content

Commit

Permalink
Merge pull request #192 from hrntsm/feature/support-2figure-beam-with…
Browse files Browse the repository at this point in the history
…-haunched-brep

Update 2figure beam to make haunched brep
  • Loading branch information
hrntsm authored Sep 24, 2021
2 parents bd2b781 + 64717cf commit 8fe256b
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 123 deletions.
139 changes: 16 additions & 123 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 @@ -127,17 +123,18 @@ private List<Curve> SecSteelBeamToCurves(IReadOnlyList<object> figures, IReadOnl
{
var curveList = new List<Curve>();
Vector3d[] localAxis = Utils.CreateLocalAxis(sectionPoints);
var toCurveList = new GirderFigureToCurveList(_sections);

switch (figures.Count)
{
case 1:
SingleFigureCurveList(figures, sectionPoints, curveList, localAxis);
toCurveList.SingleFigure(figures, sectionPoints, curveList, localAxis);
break;
case 2:
TwoFigureCurveList(figures, sectionPoints, curveList, localAxis);
toCurveList.TwoFigure(figures, sectionPoints, curveList, localAxis);
break;
case 3:
ThreeFigureCurveList(figures, sectionPoints, curveList, localAxis);
toCurveList.ThreeFigure(figures, sectionPoints, curveList, localAxis);
break;
case 5:
throw new ArgumentException("5 section steel is not supported");
Expand All @@ -147,109 +144,5 @@ private List<Curve> SecSteelBeamToCurves(IReadOnlyList<object> figures, IReadOnl

return curveList;
}

private void SingleFigureCurveList(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));
}

private void TwoFigureCurveList(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");
}
}
}

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, 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;
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));
}

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 = joint.First(sec => sec.pos == StbSecSteelBeam_S_HaunchPos.CENTER).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));
}

private void ThreeFigureCurveList(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 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 8fe256b

Please sign in to comment.