Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Brep display in CFT column #253

Merged
merged 2 commits into from
May 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions HoaryFox/RH7/Component/Utils/Geometry/BrepMaker/Column.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ private SectionCurve[] CreateCurveList(string idSection, StbColumnKind_structure
curveList = SecRcColumnToCurves(srcSec.StbSecFigureColumn_SRC.Item, sectionPoints);
break;
case StbColumnKind_structure.CFT:
StbSecColumn_CFT cftSec = _sections.StbSecColumn_CFT.First(sec => sec.id == idSection);
curveList = SecCftColumnToCurves(cftSec.StbSecSteelFigureColumn_CFT.Items, sectionPoints);
break;
case StbColumnKind_structure.UNDEFINED:
throw new ArgumentException("Unsupported StbColumnKind");
default:
Expand All @@ -67,6 +70,54 @@ private SectionCurve[] CreateCurveList(string idSection, StbColumnKind_structure
return curveList;
}

private SectionCurve[] SecCftColumnToCurves(IReadOnlyList<object> figures, IReadOnlyList<Point3d> sectionPoints)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method SecCftColumnToCurves has 44 lines of code (exceeds 25 allowed). Consider refactoring.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method SecCftColumnToCurves has 48 lines of code (exceeds 25 allowed). Consider refactoring.

{
var curveList = new List<SectionCurve>();
Vector3d[] localAxis = Utils.CreateLocalAxis(sectionPoints);

string bottom, center, top;
switch (figures.Count)
{
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));
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));
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));
}
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, top, sectionPoints[3], Utils.SectionType.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));
break;
default:
throw new ArgumentException("Unmatched StbSecSteelColumn_CFT");
}

return curveList.ToArray();
}

private static SectionCurve[] SecRcColumnToCurves(object figure, IReadOnlyList<Point3d> sectionPoints)
{
var curveList = new List<SectionCurve>();
Expand Down