Skip to content

Commit

Permalink
Merge pull request #243 from hrntsm/develop
Browse files Browse the repository at this point in the history
Release v2.3.0
  • Loading branch information
hrntsm authored Oct 15, 2022
2 parents 6b8a19d + 2d38321 commit f2c3c77
Show file tree
Hide file tree
Showing 78 changed files with 13,344 additions and 530 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dotnet_diagnostic.IDE0055.severity = warning

# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
dotnet_separate_import_directive_groups = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:refactoring
dotnet_style_qualification_for_property = false:refactoring
Expand Down
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
ko_fi: hrntsm
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
Expand Down
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# How to contribute

👍🎉 First off, thanks for taking the time to contribute! 🎉👍

The following is a set of guidelines for contributing to this component.
These are mostly guidelines, not rules.
Use your best judgment, and feel free to propose changes to this document in a pull request.

## Note

Writing code and suggesting fixes is not the only way to contribute!
Your comments, problems, and opinions posted in [Discussion](https://github.com/hrntsm/HoaryFox/discussions) or [Issues](https://github.com/hrntsm/HoaryFox/issues) are one aspect of contribution.

Feel free to post it.

## Submitting changes

Please send a [GitHub Pull Request](https://github.com/hrntsm/HoaryFox/pull/new/main) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).
When you send a pull request, we will love you forever if you include examples.
Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).

Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:

$ git commit -m "A brief summary of the commit
>
> A paragraph describing what changed and its impact."

## Coding conventions

Start reading our code and you'll get the hang of it.
Please check your .editorconfig file and code accordingly and format it with `dotnet format` commands.

Thanks,
hrntsm
9 changes: 7 additions & 2 deletions HoaryFox/Common/HoaryFoxCommon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<GenerateResourceUsePreserializedResources>True</GenerateResourceUsePreserializedResources>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,14 +12,18 @@
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resource.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>


<ItemGroup>
<PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
Expand Down
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.1.1</Version>
<Version>2.3.0</Version>
<Title>HoaryFox</Title>
<Description>This Component read ST-Bridge file(.stb) and display its model data.</Description>
<TargetExt>.gha</TargetExt>
Expand Down
1 change: 1 addition & 0 deletions HoaryFox/RH6/HoaryFoxRH6Info.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Drawing;

using Grasshopper.Kernel;

namespace HoaryFox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
using System.Drawing;

using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;

using HoaryFoxCommon.Properties;

namespace HoaryFox.Component.Check
namespace HoaryFox.Component.Filter
{
public class FilterByMaterials : GH_Component
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;

using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;

using HoaryFoxCommon.Properties;

using STBDotNet.v202;

namespace HoaryFox.Component.Check
namespace HoaryFox.Component.Filter
{
public class MaterialType : GH_Component
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;

using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;

using HoaryFoxCommon.Properties;

using STBDotNet.v202;

namespace HoaryFox.Component.Check
namespace HoaryFox.Component.Filter
{
public class Story : GH_Component
{
Expand Down
77 changes: 36 additions & 41 deletions HoaryFox/RH7/Component/Geometry/Axes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;

using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;

using HoaryFoxCommon.Properties;

using Rhino.Geometry;

using STBDotNet.v202;

namespace HoaryFox.Component.Geometry
Expand All @@ -14,18 +20,18 @@ public class Axis : GH_Component
private ST_BRIDGE _stBridge;
private int _size;
private double _factor;
private readonly List<Line> _axisLines = new List<Line>();
private readonly List<Point3d> _axisPts = new List<Point3d>();
private readonly List<string> _axisStr = new List<string>();
private readonly List<Point3d> _storyPts = new List<Point3d>();
private readonly List<string> _storyStr = new List<string>();
private readonly GH_Structure<GH_Line> _axisLines = new GH_Structure<GH_Line>();
private readonly GH_Structure<GH_Point> _axisPts = new GH_Structure<GH_Point>();
private readonly GH_Structure<GH_String> _axisName = new GH_Structure<GH_String>();
private readonly GH_Structure<GH_Point> _storyPts = new GH_Structure<GH_Point>();
private readonly GH_Structure<GH_String> _storyName = new GH_Structure<GH_String>();

public override bool IsPreviewCapable => true;
public override GH_Exposure Exposure => GH_Exposure.secondary;

public Axis()
: base("Axis", "Axis",
"Description",
"Create Axis and Story lines",
"HoaryFox", "Geometry")
{
}
Expand All @@ -35,9 +41,9 @@ public override void ClearData()
base.ClearData();
_axisLines.Clear();
_axisPts.Clear();
_axisStr.Clear();
_axisName.Clear();
_storyPts.Clear();
_storyStr.Clear();
_storyName.Clear();
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
Expand All @@ -49,7 +55,9 @@ protected override void RegisterInputParams(GH_InputParamManager pManager)

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddLineParameter("Axis", "Ax", "output StbAxes to Line", GH_ParamAccess.list);
pManager.AddLineParameter("Axis", "Ax", "output StbAxes to Line", GH_ParamAccess.tree);
pManager.AddTextParameter("StoryName", "StName", "output StbAxes name", GH_ParamAccess.tree);
pManager.AddTextParameter("AxisName", "AxName", "output StbStroy name", GH_ParamAccess.tree);
}

protected override void SolveInstance(IGH_DataAccess dataAccess)
Expand All @@ -65,24 +73,24 @@ protected override void SolveInstance(IGH_DataAccess dataAccess)

StbParallelAxesToLine(_factor, parallels, stories, length);

dataAccess.SetDataList(0, _axisLines);
dataAccess.SetDataTree(0, _axisLines);
dataAccess.SetDataTree(1, _storyName);
dataAccess.SetDataTree(2, _axisName);
}

private void StbParallelAxesToLine(double factor, StbParallelAxes[] parallels, IEnumerable<StbStory> stories, double length)
{
var isFirst = true;
foreach (StbStory story in stories)
foreach ((StbStory story, int i) in stories.Select((s, i) => (s, i)))
{
var path = new GH_Path(0, i);
double height = story.height;
_storyStr.Add(story.name);
_storyPts.Add(new Point3d(0, 0, height));
CreateEachAxis(factor, parallels, length, isFirst, height);

isFirst = false;
_storyName.Append(new GH_String(story.name), path);
_storyPts.Append(new GH_Point(new Point3d(0, 0, height)), path);
CreateEachAxis(factor, parallels, length, height, path);
}
}

private void CreateEachAxis(double factor, StbParallelAxes[] parallels, double length, bool isFirst, double height)
private void CreateEachAxis(double factor, IEnumerable<StbParallelAxes> parallels, double length, double height, GH_Path path)
{
foreach (StbParallelAxes parallel in parallels)
{
Expand All @@ -94,12 +102,12 @@ private void CreateEachAxis(double factor, StbParallelAxes[] parallels, double l

foreach (StbParallelAxis pAxis in parallel.StbParallelAxis)
{
_axisLines.Add(new Line(
_axisLines.Append(new GH_Line(new Line(
basePt - (axisVec * (factor - 1)) + (distanceVec * pAxis.distance),
basePt + (axisVec * factor) + (distanceVec * pAxis.distance)
));
_axisPts.Add(basePt - (axisVec * (factor - 1)) + (distanceVec * pAxis.distance));
_axisStr.Add(isFirst ? pAxis.name : string.Empty);
)), path);
_axisPts.Append(new GH_Point(basePt - (axisVec * (factor - 1)) + (distanceVec * pAxis.distance)), path);
_axisName.Append(new GH_String(_storyName.get_Branch(path)[0] + " " + pAxis.name), path);
}
}
}
Expand All @@ -114,27 +122,14 @@ private static double GetMaxLength(StbNode[] stbNodes)

public override void DrawViewportWires(IGH_PreviewArgs args)
{
for (var i = 0; i < _axisLines.Count; i++)
{
args.Display.Draw2dText(_axisStr[i], Color.Black, _axisPts[i], true, _size);
args.Display.DrawPatternedLine(_axisLines[i], Color.Black, 0x0000AFAF, 1);
}

double xMin = _axisPts.Min(pt => pt.X);
double yMin = _axisPts.Min(pt => pt.Y);
var vec = new Vector3d(xMin, yMin, 0);
double length = _axisLines.Max(line => line.Length);

for (var i = 1; i < _storyPts.Count; i++)
{
args.Display.DrawLine(new Line(_storyPts[i - 1] + vec, _storyPts[i] + vec), Color.Black);
}
Line[] lines = _axisLines.FlattenData().Select(ln => ln.Value).ToArray();
string[] names = _axisName.FlattenData().Select(nm => nm.Value).ToArray();
Point3d[] pts = _axisPts.FlattenData().Select(pt => pt.Value).ToArray();

for (var i = 0; i < _storyPts.Count; i++)
for (var i = 0; i < lines.Length; i++)
{
args.Display.Draw2dText(_storyStr[i], Color.Black, _storyPts[i] + vec, true, _size);
args.Display.DrawLine(new Line(_storyPts[i] + vec, _storyPts[i] + vec + length * Vector3d.XAxis), Color.Black);
args.Display.DrawLine(new Line(_storyPts[i] + vec, _storyPts[i] + vec + length * Vector3d.YAxis), Color.Black);
args.Display.Draw2dText(names[i], Color.Black, pts[i], true, _size);
args.Display.DrawPatternedLine(lines[i], Color.Black, 0x0000AFAF, 1);
}
}

Expand Down
5 changes: 5 additions & 0 deletions HoaryFox/RH7/Component/Geometry/Stb2Brep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
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.Geometry;

using HoaryFoxCommon.Properties;

using Rhino;
using Rhino.DocObjects;
using Rhino.Geometry;

using STBDotNet.v202;

namespace HoaryFox.Component.Geometry
Expand Down
5 changes: 5 additions & 0 deletions HoaryFox/RH7/Component/Geometry/Stb2Line.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
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.Geometry;

using HoaryFoxCommon.Properties;

using Rhino;
using Rhino.DocObjects;
using Rhino.Geometry;

using STBDotNet.v202;

namespace HoaryFox.Component.Geometry
Expand Down
3 changes: 3 additions & 0 deletions HoaryFox/RH7/Component/IO/StbLoader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;

using Grasshopper.Kernel;

using HoaryFoxCommon.Properties;

using STBDotNet.v202;

namespace HoaryFox.Component.IO
Expand Down
5 changes: 5 additions & 0 deletions HoaryFox/RH7/Component/Tag/Name/BeamNameTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
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 HoaryFoxCommon.Properties;

using Rhino.Geometry;

using STBDotNet.v202;

namespace HoaryFox.Component.Tag.Name
Expand Down
5 changes: 5 additions & 0 deletions HoaryFox/RH7/Component/Tag/Name/BraceNameTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
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 HoaryFoxCommon.Properties;

using Rhino.Geometry;

using STBDotNet.v202;

namespace HoaryFox.Component.Tag.Name
Expand Down
Loading

0 comments on commit f2c3c77

Please sign in to comment.