Skip to content

Commit

Permalink
Merge branch 'develop' into feature/add-webpage-search
Browse files Browse the repository at this point in the history
  • Loading branch information
hrntsm committed Sep 29, 2021
2 parents add7ef4 + a60297d commit 32d38a1
Show file tree
Hide file tree
Showing 47 changed files with 2,746 additions and 360 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Check Code Format
on: pull_request
on:
pull_request:
paths-ignore:
- "website/**"

jobs:
check:
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/dotnet-grasshopper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ on:
- "website/**"
pull_request:
branches: [main, develop]

paths-ignore:
- "website/**"

jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]

runs-on: windows-latest # For a list of available runner types, refer to
runs-on: windows-latest # For a list of available runner types, refer to

env:
Solution_Name: HoaryFox.sln
Expand Down Expand Up @@ -43,21 +45,23 @@ jobs:
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

- name: Copy karambaConnect and samples to /HoaryFox/bin dir
if: ${{ matrix.configuration == 'Release' }} # Only upload gha from a release build
shell: powershell
run: |
cp ./KarambaConnect/bin/Release/net48/KarambaConnect.gha ./HoaryFox/bin/Release/net48/KarambaConnect.gha
cp ./Samples ./HoaryFox/bin/Release/net48/Samples -recurse
cp ./LICENSE ./HoaryFox/bin/Release/net48/LICENSE
- name: Upload release build of plugin as artefact
if: ${{ matrix.configuration == 'Release' }} # Only upload gha from a release build
uses: actions/upload-artifact@v2
with:
name: HoaryFox
path: |
./HoaryFox/bin/Release/net48/HoaryFox.gha
./HoaryFox/bin/Release/net48/KarambaConnect.gha
./HoaryFox/bin/Release/net48/STBDotNet.dll
./HoaryFox/bin/Release/net48/Samples/
./HoaryFox/bin/Release/net48/HoaryFox.gha
./HoaryFox/bin/Release/net48/KarambaConnect.gha
./HoaryFox/bin/Release/net48/STBDotNet.dll
./HoaryFox/bin/Release/net48/Samples/
./HoaryFox/bin/Release/net48/LICENSE
19 changes: 19 additions & 0 deletions .github/workflows/test-build-document.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test build document site

on:
pull_request:
branches: [develop]
paths:
- "website/**"

jobs:
deploy:
runs-on: ubuntu-18.04
defaults:
run:
working-directory: website

steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn build
45 changes: 23 additions & 22 deletions HoaryFox/Component/Geometry/Stb2Brep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Drawing;
using System.Linq;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
using HoaryFox.Component.Utils.Geometry;
using HoaryFox.Properties;
using Rhino;
Expand All @@ -15,7 +17,7 @@ namespace HoaryFox.Component.Geometry
public class Stb2Brep : GH_Component
{
private ST_BRIDGE _stBridge;
private readonly List<List<Brep>> _brepList = new List<List<Brep>>();
private readonly GH_Structure<GH_Brep>[] _brepList = new GH_Structure<GH_Brep>[7];

public override GH_Exposure Exposure => GH_Exposure.primary;

Expand All @@ -29,7 +31,6 @@ public Stb2Brep()
public override void ClearData()
{
base.ClearData();
_brepList.Clear();
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
Expand All @@ -40,13 +41,13 @@ protected override void RegisterInputParams(GH_InputParamManager pManager)

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddBrepParameter("Columns", "Col", "output StbColumns to Brep", GH_ParamAccess.list);
pManager.AddBrepParameter("Girders", "Gird", "output StbGirders to Brep", GH_ParamAccess.list);
pManager.AddBrepParameter("Posts", "Pst", "output StbPosts to Brep", GH_ParamAccess.list);
pManager.AddBrepParameter("Beams", "Bm", "output StbBeams to Brep", GH_ParamAccess.list);
pManager.AddBrepParameter("Braces", "Brc", "output StbBraces to Brep", GH_ParamAccess.list);
pManager.AddBrepParameter("Slabs", "Slb", "output StbSlabs to Brep", GH_ParamAccess.list);
pManager.AddBrepParameter("Walls", "Wl", "output StbWalls to Brep", GH_ParamAccess.list);
pManager.AddBrepParameter("Columns", "Col", "output StbColumns to Brep", GH_ParamAccess.tree);
pManager.AddBrepParameter("Girders", "Gird", "output StbGirders to Brep", GH_ParamAccess.tree);
pManager.AddBrepParameter("Posts", "Pst", "output StbPosts to Brep", GH_ParamAccess.tree);
pManager.AddBrepParameter("Beams", "Bm", "output StbBeams to Brep", GH_ParamAccess.tree);
pManager.AddBrepParameter("Braces", "Brc", "output StbBraces to Brep", GH_ParamAccess.tree);
pManager.AddBrepParameter("Slabs", "Slb", "output StbSlabs to Brep", GH_ParamAccess.tree);
pManager.AddBrepParameter("Walls", "Wl", "output StbWalls to Brep", GH_ParamAccess.tree);
}

protected override void SolveInstance(IGH_DataAccess dataAccess)
Expand All @@ -63,7 +64,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess)

for (var i = 0; i < 7; i++)
{
dataAccess.SetDataList(i, _brepList[i]);
dataAccess.SetDataTree(i, _brepList[i]);
}
}

Expand All @@ -74,13 +75,13 @@ private void CreateBrep()
{
StbMembers member = _stBridge.StbModel.StbMembers;
var brepFromStb = new CreateMemberBrepListFromStb(_stBridge.StbModel.StbSections, _stBridge.StbModel.StbNodes, new[] { DocumentTolerance(), DocumentAngleTolerance() });
_brepList.Add(brepFromStb.Column(member.StbColumns));
_brepList.Add(brepFromStb.Girder(member.StbGirders));
_brepList.Add(brepFromStb.Post(member.StbPosts));
_brepList.Add(brepFromStb.Beam(member.StbBeams));
_brepList.Add(brepFromStb.Brace(member.StbBraces));
_brepList.Add(brepFromStb.Slab(member.StbSlabs));
_brepList.Add(brepFromStb.Wall(member.StbWalls));
_brepList[0] = brepFromStb.Column(member.StbColumns);
_brepList[1] = brepFromStb.Girder(member.StbGirders);
_brepList[2] = brepFromStb.Post(member.StbPosts);
_brepList[3] = brepFromStb.Beam(member.StbBeams);
_brepList[4] = brepFromStb.Brace(member.StbBraces);
_brepList[5] = brepFromStb.Slab(member.StbSlabs);
_brepList[6] = brepFromStb.Wall(member.StbWalls);
}

private void BakeBrep()
Expand All @@ -92,23 +93,23 @@ private void BakeBrep()

Dictionary<string, string>[][] infoArray = Utils.TagUtils.GetAllSectionInfoArray(_stBridge.StbModel.StbMembers, _stBridge.StbModel.StbSections);

foreach ((List<Brep> breps, int index) in _brepList.Select((frameBrep, index) => (frameBrep, index)))
foreach ((GH_Structure<GH_Brep> breps, int i) in _brepList.Select((frameBrep, index) => (frameBrep, index)))
{
Layer parentLayer = activeDoc.Layers.FindName(parentLayerNames[index]);
Layer parentLayer = activeDoc.Layers.FindName(parentLayerNames[i]);
Guid parentId = parentLayer.Id;
foreach ((Brep brep, int bIndex) in breps.Select((brep, bIndex) => (brep, bIndex)))
foreach ((Brep brep, int bIndex) in breps.Select((brep, bIndex) => (brep.Value, bIndex)))
{
var objAttr = new ObjectAttributes();

Dictionary<string, string>[] infos = infoArray[index];
Dictionary<string, string>[] infos = infoArray[i];
Dictionary<string, string> info = infos[bIndex];

foreach (KeyValuePair<string, string> pair in info)
{
objAttr.SetUserString(pair.Key, pair.Value);
}

var layer = new Layer { Name = info["name"], ParentLayerId = parentId, Color = layerColors[index] };
var layer = new Layer { Name = info["name"], ParentLayerId = parentId, Color = layerColors[i] };
int layerIndex = activeDoc.Layers.Add(layer);
if (layerIndex == -1)
{
Expand Down
46 changes: 21 additions & 25 deletions HoaryFox/Component/Geometry/Stb2Line.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Drawing;
using System.Linq;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
using HoaryFox.Component.Utils.Geometry;
using HoaryFox.Properties;
using Rhino;
Expand All @@ -16,7 +18,7 @@ public class Stb2Line : GH_Component
{
private ST_BRIDGE _stBridge;
private List<Point3d> _nodes = new List<Point3d>();
private readonly List<List<Line>> _lineList = new List<List<Line>>();
private readonly GH_Structure<GH_Line>[] _lineList = new GH_Structure<GH_Line>[5];

public override GH_Exposure Exposure => GH_Exposure.primary;

Expand All @@ -27,12 +29,6 @@ public Stb2Line()
{
}

public override void ClearData()
{
base.ClearData();
_lineList.Clear();
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Data", "D", "input ST-Bridge Data", GH_ParamAccess.item);
Expand All @@ -42,11 +38,11 @@ protected override void RegisterInputParams(GH_InputParamManager pManager)
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddPointParameter("Nodes", "pt", "output StbNodes to point3d", GH_ParamAccess.list);
pManager.AddLineParameter("Columns", "Col", "output StbColumns to Line", GH_ParamAccess.list);
pManager.AddLineParameter("Girders", "Gird", "output StbGirders to Line", GH_ParamAccess.list);
pManager.AddLineParameter("Posts", "Pst", "output StbPosts to Line", GH_ParamAccess.list);
pManager.AddLineParameter("Beams", "Beam", "output StbBeams to Line", GH_ParamAccess.list);
pManager.AddLineParameter("Braces", "Brc", "output StbBraces to Line", GH_ParamAccess.list);
pManager.AddLineParameter("Columns", "Col", "output StbColumns to Line", GH_ParamAccess.tree);
pManager.AddLineParameter("Girders", "Gird", "output StbGirders to Line", GH_ParamAccess.tree);
pManager.AddLineParameter("Posts", "Pst", "output StbPosts to Line", GH_ParamAccess.tree);
pManager.AddLineParameter("Beams", "Beam", "output StbBeams to Line", GH_ParamAccess.tree);
pManager.AddLineParameter("Braces", "Brc", "output StbBraces to Line", GH_ParamAccess.tree);
}

protected override void SolveInstance(IGH_DataAccess dataAccess)
Expand All @@ -62,9 +58,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess)
}

dataAccess.SetDataList(0, _nodes);
foreach ((List<Line> geometry, int i) in _lineList.Select((geo, index) => (geo, index + 1)))
foreach ((GH_Structure<GH_Line> geometry, int i) in _lineList.Select((geo, index) => (geo, index + 1)))
{
dataAccess.SetDataList(i, geometry);
dataAccess.SetDataTree(i, geometry);
}
}

Expand All @@ -77,26 +73,26 @@ private void BakeLine()

Dictionary<string, string>[][] infoArray = Utils.TagUtils.GetAllSectionInfoArray(_stBridge.StbModel.StbMembers, _stBridge.StbModel.StbSections);

foreach ((List<Line> lines, int index) in _lineList.Select((frameBrep, index) => (frameBrep, index)))
foreach ((GH_Structure<GH_Line> lines, int i) in _lineList.Select((frameBrep, index) => (frameBrep, index)))
{
Layer parentLayer = activeDoc.Layers.FindName(parentLayerNames[index]);
Layer parentLayer = activeDoc.Layers.FindName(parentLayerNames[i]);
int parentIndex = parentLayer.Index;
Guid parentId = parentLayer.Id;
foreach ((Line line, int bIndex) in lines.Select((brep, bIndex) => (brep, bIndex)))
foreach ((Line line, int bIndex) in lines.Select((geometry, bIndex) => (geometry.Value, bIndex)))
{
var objAttr = new ObjectAttributes();

if (index < 5)
if (i < 5)
{
Dictionary<string, string>[] infos = infoArray[index];
Dictionary<string, string>[] infos = infoArray[i];
Dictionary<string, string> info = infos[bIndex];

foreach (KeyValuePair<string, string> pair in info)
{
objAttr.SetUserString(pair.Key, pair.Value);
}

var layer = new Layer { Name = info["name"], ParentLayerId = parentId, Color = layerColors[index] };
var layer = new Layer { Name = info["name"], ParentLayerId = parentId, Color = layerColors[i] };
int layerIndex = activeDoc.Layers.Add(layer);
if (layerIndex == -1)
{
Expand All @@ -119,11 +115,11 @@ private void CreateLine()
{
var createLines = new CreateLineFromStb(_stBridge);
_nodes = createLines.Nodes();
_lineList.Add(createLines.Columns());
_lineList.Add(createLines.Girders());
_lineList.Add(createLines.Posts());
_lineList.Add(createLines.Beams());
_lineList.Add(createLines.Braces());
_lineList[0] = createLines.Columns();
_lineList[1] = createLines.Girders();
_lineList[2] = createLines.Posts();
_lineList[3] = createLines.Beams();
_lineList[4] = createLines.Braces();
}

protected override Bitmap Icon => Resource.Line;
Expand Down
19 changes: 11 additions & 8 deletions HoaryFox/Component/Tag/Name/BeamNameTag.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
using HoaryFox.Component.Utils;
using Rhino.Geometry;
using STBDotNet.v202;
Expand All @@ -13,7 +16,7 @@ public class BeamNameTag : GH_Component
private ST_BRIDGE _stBridge;
private int _size;

private readonly List<string> _frameName = new List<string>();
private readonly GH_Structure<GH_String> _frameName = new GH_Structure<GH_String>();
private readonly List<Point3d> _framePos = new List<Point3d>();

public override bool IsPreviewCapable => true;
Expand Down Expand Up @@ -41,7 +44,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager)

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddTextParameter("NameTag", "NTag", "output name tag", GH_ParamAccess.list);
pManager.AddTextParameter("NameTag", "NTag", "output name tag", GH_ParamAccess.tree);
}

protected override void SolveInstance(IGH_DataAccess dataAccess)
Expand All @@ -51,26 +54,26 @@ protected override void SolveInstance(IGH_DataAccess dataAccess)

StbNode[] nodes = _stBridge.StbModel.StbNodes;
StbBeam[] beams = _stBridge.StbModel.StbMembers.StbBeams;
foreach (StbBeam beam in beams)
foreach ((StbBeam beam, int i) in beams.Select((beam, index) => (beam, index)))
{
_frameName.Add(beam.name);
_frameName.Append(new GH_String(beam.name), new GH_Path(0, i));

string idNodeStart = beam.id_node_start;
string idNodeEnd = beam.id_node_end;
_framePos.Add(TagUtils.GetFrameTagPosition(idNodeStart, idNodeEnd, nodes));
}
dataAccess.SetDataList(0, _frameName);
dataAccess.SetDataTree(0, _frameName);
}

public override void DrawViewportWires(IGH_PreviewArgs args)
{
for (var i = 0; i < _frameName.Count; i++)
for (var i = 0; i < _frameName.PathCount; i++)
{
args.Display.Draw2dText(_frameName[i], Color.Black, _framePos[i], true, _size);
args.Display.Draw2dText(_frameName.Branches[i][0].Value, Color.Black, _framePos[i], true, _size);
}
}

protected override System.Drawing.Bitmap Icon => Properties.Resource.BeamName;
protected override Bitmap Icon => Properties.Resource.BeamName;

public override Guid ComponentGuid => new Guid("FDC62C6D-7C03-412D-8FF8-B76439197730");
}
Expand Down
Loading

0 comments on commit 32d38a1

Please sign in to comment.