Skip to content

Commit

Permalink
Merge pull request #260 from hrntsm/Fix/filter_error
Browse files Browse the repository at this point in the history
Fix/filter error
  • Loading branch information
hrntsm authored Aug 24, 2023
2 parents 9d7bf2f + 33be8d1 commit 4669b5b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion HoaryFox/RH6/HoaryFoxRH6.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
<Title>HoaryFox</Title>
<Description>This Component read ST-Bridge file(.stb) and display its model data.</Description>
<TargetExt>.gha</TargetExt>
Expand Down
10 changes: 7 additions & 3 deletions HoaryFox/RH7/Component/Filter/FilterByMaterials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager)
pManager.AddBrepParameter("S", "S", "output S geometry", GH_ParamAccess.tree);
pManager.AddBrepParameter("SRC", "SRC", "output SRC geometry", GH_ParamAccess.tree);
pManager.AddBrepParameter("CFT", "CFT", "output CFT geometry", GH_ParamAccess.tree);
pManager.AddBrepParameter("PC", "PC", "output PC geometry", GH_ParamAccess.tree);
}

protected override void SolveInstance(IGH_DataAccess dataAccess)
Expand All @@ -49,15 +50,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess)
return;
}

var filteredBreps = new GH_Structure<GH_Brep>[4];
for (var i = 0; i < 4; i++)
var filteredBreps = new GH_Structure<GH_Brep>[5];
for (var i = 0; i < 5; i++)
{
filteredBreps[i] = new GH_Structure<GH_Brep>();
}

FilterValue(breps, stories, materials, filteredBreps);

for (var i = 0; i < 4; i++)
for (var i = 0; i < 5; i++)
{
dataAccess.SetDataTree(i, filteredBreps[i]);
}
Expand Down Expand Up @@ -93,6 +94,9 @@ private bool SetMaterialFilteredBrep(IReadOnlyList<GH_Structure<GH_Brep>> result
case "CFT":
results[3].Append(brep.DuplicateBrep(), path);
break;
case "PC":
results[4].Append(brep.DuplicateBrep(), path);
break;
default:
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Unknown material type");
return true;
Expand Down
9 changes: 6 additions & 3 deletions HoaryFox/RH7/Component/Filter/MaterialType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace HoaryFox.Component.Filter
public class MaterialType : GH_Component
{
private ST_BRIDGE _stBridge;
private readonly GH_Structure<GH_String>[] _materialTypeList = new GH_Structure<GH_String>[7];
private readonly GH_Structure<GH_String>[] _materialTypeList = new GH_Structure<GH_String>[9];

public override GH_Exposure Exposure => GH_Exposure.primary;

Expand All @@ -41,6 +41,8 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager)
pManager.AddTextParameter("Braces", "Brc", "output StbBrace material types", GH_ParamAccess.tree);
pManager.AddTextParameter("Slabs", "Slb", "output StbSlab material types", GH_ParamAccess.tree);
pManager.AddTextParameter("Walls", "Wl", "output StbWall material types", GH_ParamAccess.tree);
pManager.AddTextParameter("Piles", "Pil", "output StbPile material types", GH_ParamAccess.tree);
pManager.AddTextParameter("Footings", "Ftg", "output StbFooting material types", GH_ParamAccess.tree);
}

protected override void SolveInstance(IGH_DataAccess dataAccess)
Expand All @@ -54,12 +56,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess)
var materialTypes = new GH_Structure<GH_String>();
foreach ((Dictionary<string, string> info, int itemIndex) in infoDict.Select((dict, itemIndex) => (dict, itemIndex)))
{
materialTypes.Append(new GH_String(info["kind_structure"]), new GH_Path(0, itemIndex));
var materialType = info["stb_element_type"] == "StbFooting" ? "RC" : info["kind_structure"];
materialTypes.Append(new GH_String(materialType), new GH_Path(0, itemIndex));
}
_materialTypeList[index] = materialTypes;
}

for (var i = 0; i < 7; i++)
for (var i = 0; i < 9; i++)
{
dataAccess.SetDataTree(i, _materialTypeList[i]);
}
Expand Down
4 changes: 4 additions & 0 deletions HoaryFox/RH7/Component/Filter/Story.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess)

foreach ((Dictionary<string, string>[] infoDict, int index) in infoArray.Select((dict, index) => (dict, index)))
{
if (index > 6)
{
break;
}
var decisionNode = new List<string>();
var result = new GH_Structure<GH_Integer>();
GetFloorDecisionNode(infoDict, decisionNode);
Expand Down
2 changes: 1 addition & 1 deletion HoaryFox/RH7/HoaryFoxRH7.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
<Title>HoaryFox</Title>
<Description>This Component read ST-Bridge file(.stb) and display its model data.</Description>
<TargetExt>.gha</TargetExt>
Expand Down
2 changes: 1 addition & 1 deletion KarambaConnect/RH6K1/karambaConnectRH6K1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
<Title>karambaConnect</Title>
<Description>HoaryFox karamba connect extension</Description>
<TargetExt>.gha</TargetExt>
Expand Down
2 changes: 1 addition & 1 deletion KarambaConnect/RH6K2/karambaConnectRH6K2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
<Title>karambaConnect</Title>
<Description>HoaryFox karamba connect extension</Description>
<TargetExt>.gha</TargetExt>
Expand Down
2 changes: 1 addition & 1 deletion KarambaConnect/RH7K1/karambaConnectRH7K1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
<Title>karambaConnect</Title>
<Description>HoaryFox karamba connect extension</Description>
<TargetExt>.gha</TargetExt>
Expand Down
2 changes: 1 addition & 1 deletion KarambaConnect/RH7K2/karambaConnectRH7K2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
<Title>karambaConnect</Title>
<Description>HoaryFox karamba connect extension</Description>
<TargetExt>.gha</TargetExt>
Expand Down

0 comments on commit 4669b5b

Please sign in to comment.