Skip to content

Commit

Permalink
Release v1.2.0
Browse files Browse the repository at this point in the history
Release v1.2.0
  • Loading branch information
hrntsm committed Dec 30, 2020
2 parents 8b807f9 + e072f35 commit f9a8e7e
Show file tree
Hide file tree
Showing 46 changed files with 1,758 additions and 56 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/dotnet-grasshopper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ jobs:

- name: Copy karambaConnect to /HoaryFox/bin dir
shell: powershell
run: cp ./karambaConnect/bin/karambaConnect.gha ./HoaryFox/bin/karambaConnect.gha
run: |
cp ./KarambaConnect/bin/KarambaConnect.gha ./HoaryFox/bin/KarambaConnect.gha
cp ./KarambaConnect/bin/STBDotNet.dll ./HoaryFox/bin/STBDotNet.dll
- name: Upload release build of plugin as artefact
if: ${{ matrix.configuration == 'Release' }} # Only upload gha from a release build
Expand All @@ -53,7 +55,8 @@ jobs:
name: HoaryFox
path: |
./HoaryFox/bin/HoaryFox.gha
./HoaryFox/bin/KarambaConnect.gha
./HoaryFox/bin/STBReader.dll
./HoaryFox/bin/karambaConnect.gha
./HoaryFox/bin/STBDotNet.dll
2 changes: 1 addition & 1 deletion HoaryFox.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.30711.63
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HoaryFox", "HoaryFox\HoaryFox.csproj", "{9637855D-D144-4448-9F56-A391A3575DAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "karambaConnect", "karambaConnect\karambaConnect.csproj", "{CD5D3228-2B3E-4112-9B42-C82615673DFE}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "karambaConnect", "KarambaConnect\karambaConnect.csproj", "{CD5D3228-2B3E-4112-9B42-C82615673DFE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion HoaryFox/Component/Base/NameTagBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class NameTagBase:GH_Component
public override bool IsPreviewCapable => true;

protected NameTagBase(string name, string nickname, string description, FrameType frameType)
:base(name, nickname, description, category: "HoaryFox", subCategory: "Name")
:base(name, nickname, description, category: "HoaryFox", subCategory: "NameTag")
{
_frameType = frameType;
}
Expand Down
2 changes: 1 addition & 1 deletion HoaryFox/Component/Base/SecTagBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class SecTagBase:GH_Component
private List<Point3d> _tagPos = new List<Point3d>();

protected SecTagBase(string name, string nickname, string description, FrameType frameType)
:base(name, nickname, description, category: "HoaryFox", subCategory: "Section")
:base(name, nickname, description, category: "HoaryFox", subCategory: "SectionTag")
{
_frameType = frameType;
}
Expand Down
2 changes: 1 addition & 1 deletion HoaryFox/Component/IO/StbLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class StbLoader:GH_Component
private readonly double _angleTolerance = DocumentAngleTolerance();

public StbLoader()
: base("Load stb data", "Loader", "Read ST-Bridge file and display", "HoaryFox", "IO")
: base("Load STB file", "Loader", "Read ST-Bridge file and display", "HoaryFox", "IO")
{
}

Expand Down
10 changes: 0 additions & 10 deletions HoaryFox/Properties/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions HoaryFox/Properties/Resource.resx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,4 @@
<data name="PostSection" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\PostSection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ToKaramba" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ToKaramba.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file modified HoaryFox/Resources/LoadStb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HoaryFox/Resources/LoadStb.xcf
Binary file not shown.
Binary file removed HoaryFox/Resources/ToKaramba.xcf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@
using System.Drawing;
using System.Linq;
using Grasshopper.Kernel;
using HoaryFox.KarambaConnect;
using STBReader;
using STBReader.Model;
using STBReader.Member;
using Karamba.CrossSections;
using Karamba.Elements;
using Karamba.Geometry;
using Karamba.GHopper.CrossSections;
using Karamba.GHopper.Elements;
using Karamba.Utilities;
using KarambaConnect.Properties;
using KarambaConnect.S2K;
using STBReader;

namespace HoaryFox.Component.IO
namespace KarambaConnect.Component.IO
{
public class Stb2KElem:GH_Component
public class Convert2Karamba:GH_Component
{
private StbData _stbData;
private List<GH_Element> _k3ElemBe = new List<GH_Element>();
private readonly List<GH_Element> _k3ElemSh = new List<GH_Element>();

public Stb2KElem()
: base("Stb to Karamba", "S2K", "Read ST-Bridge file and display", "HoaryFox", "IO")
public Convert2Karamba()
: base("Convert to Karamba", "S2K", "Convert ST-Bridge file to Karamba.", "HoaryFox", "IO")
{
}

Expand Down Expand Up @@ -59,7 +56,7 @@ protected override void SolveInstance(IGH_DataAccess DA)
DA.SetDataList(1, k3CroSec);
}

protected override Bitmap Icon => karambaConnect.Properties.Resource.ToKaramba;
protected override Bitmap Icon => Resource.ToKaramba;
public override Guid ComponentGuid => new Guid("C57461DA-E79B-49A0-B44B-71CF32057709");
}
}
87 changes: 87 additions & 0 deletions KarambaConnect/Component/IO/Export.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using Grasshopper.Kernel;
using KarambaConnect.K2S;
using KarambaConnect.Properties;
using STBDotNet.Elements;
using STBDotNet.Elements.StbModel;
using STBDotNet.Elements.StbModel.StbMember;
using STBDotNet.Elements.StbModel.StbSection;
using STBDotNet.Serialization;

namespace KarambaConnect.Component.IO
{
public class Export:GH_Component
{
private readonly string _defaultOutPath =
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\model.stb";

public Export()
: base("Export STB file", "Export", "Export ST-Bridge data.", "HoaryFox", "IO")
{
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Node", "Node", "StbNode data", GH_ParamAccess.list);
pManager.AddGenericParameter("Axis", "Axis", "StbAxes data", GH_ParamAccess.list);
pManager.AddGenericParameter("Story", "Story", "StbStory data", GH_ParamAccess.list);
pManager.AddGenericParameter("Member", "Mem","StbMember data", GH_ParamAccess.item);
pManager.AddGenericParameter("Section", "Sec", "StbSection data", GH_ParamAccess.list);
pManager.AddTextParameter("Path", "Path", "Output path", GH_ParamAccess.item, _defaultOutPath);
pManager.AddBooleanParameter("Out?", "Out?", "If it is true, output stb file.", GH_ParamAccess.item, false);

}

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Stb", "Stb", "StbModel Data", GH_ParamAccess.item);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
var path = string.Empty;
var isOutput = false;
var node = new List<Node>();
var axis = new List<Axis>();
var story = new List<Story>();
var members = new Members();
var sections = new List<Section>();

if (!DA.GetDataList(0, node)) { return; }
if (!DA.GetDataList(1, axis)) { return; }
if (!DA.GetDataList(2, story)) { return; }
if (!DA.GetData(3, ref members)) { return; }
if (!DA.GetDataList(4, sections)) { return; }
if (!DA.GetData(5, ref path)) { return; }
if (!DA.GetData(6, ref isOutput)) { return; }


var elements = new StbElements
{
Version = "1.4.00",
Common = StbCommon.Set(),
Model = new Model
{
Axes = axis,
Members = members,
Nodes = node,
Sections = sections,
Stories = story
}
};

if (isOutput)
{
var sr = new Serializer();
sr.Serialize(elements, path);
}

DA.SetData(0, elements);
}

protected override Bitmap Icon => Resource.ExportStb;
public override Guid ComponentGuid => new Guid("41401A49-3552-4741-B8F9-4C8E0C689323");
}
}
114 changes: 114 additions & 0 deletions KarambaConnect/Component/StbBuilder/AxisBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
using System;
using System.Drawing;
using System.Collections.Generic;
using Grasshopper.Kernel;
using STBDotNet.Elements.StbModel;

namespace KarambaConnect.Component.StbBuilder
{
public class AxisBuilder:GH_Component
{
public AxisBuilder()
: base("AxisBuilder", "Axis", "Builder StbAxes data", "HoaryFox", "StbBuilder")
{
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Node", "Node", "StbNode data", GH_ParamAccess.list);
pManager.AddNumberParameter("Distance", "Dist", "Axis coordinates[mm] from origin.", GH_ParamAccess.list);
pManager.AddNumberParameter("Range", "Range", "The range of nodes to include in the axis. (Dist±Range)", GH_ParamAccess.list);
pManager.AddTextParameter("Name", "Name", "Axis Name", GH_ParamAccess.list);
pManager.AddIntegerParameter("Direction", "Dir", "0: X Axis, 1: Y Axis", GH_ParamAccess.list);
}

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Axis", "Axis", "StbAxis Data", GH_ParamAccess.list);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
var count = 0;
var nodes = new List<Node>();
var distance = new List<double>();
var range = new List<double>();
var names = new List<string>();
var dir = new List<int>();

if (!DA.GetDataList(0, nodes)) { return; }
if (!DA.GetDataList(1, distance)) { return; }
if (!DA.GetDataList(2, range)) { return; }
if (!DA.GetDataList(3, names)) { return; }
if (!DA.GetDataList(4, dir)) { return; }

var axes = new List<Axis>();

if (distance.Count != names.Count || distance.Count != range.Count || distance.Count != dir.Count ||
range.Count != names.Count || range.Count != dir.Count || names.Count != dir.Count)
{
throw new ArgumentOutOfRangeException("The number of items does not match.");
}

foreach (double dist in distance)
{
var nodeIds = new List<NodeId>();
if (dir[count] == 0)
{
var xAxis = new XAxis
{
Id = count + 1,
Name = names[count],
Distance = dist
};
foreach (Node node in nodes)
{
if (node.X > dist - range[count] && node.X < dist + range[count])
{
nodeIds.Add(new NodeId(node.Id));
}
}

if (nodeIds.Count == 0)
{
throw new ArgumentException("There are no nodes in the target distance range.");
}

xAxis.NodeIdList = nodeIds;
axes.Add(xAxis);
}
else if (dir[count] == 1)
{
var yAxis = new YAxis
{
Id = count + 1,
Name = names[count],
Distance = dist
};
foreach (Node node in nodes)
{
if (node.Y > dist - range[count] && node.Y < dist + range[count])
{
nodeIds.Add(new NodeId(node.Id));
}
}

if (nodeIds.Count == 0)
{
throw new ArgumentException("There are no nodes in the target distance range.");
}

yAxis.NodeIdList = nodeIds;
axes.Add(yAxis);
}

count++;
}

DA.SetDataList(0, axes);
}

protected override Bitmap Icon => Properties.Resource.AxisBuilder;
public override Guid ComponentGuid => new Guid("A09E1BF4-90FD-436D-8142-092894CE5D86");
}
}
51 changes: 51 additions & 0 deletions KarambaConnect/Component/StbBuilder/FrameBuilderUsingKaramba.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Drawing;
using Grasshopper.Kernel;
using Karamba.GHopper.Models;
using Karamba.Models;
using KarambaConnect.K2S;

namespace KarambaConnect.Component.StbBuilder
{
public class FrameBuilderUsingKaramba:GH_Component
{
public FrameBuilderUsingKaramba()
: base("FrameBuilder using Karamba", "FrameBuilder", "Convert Karamba model to ST-Bridge data.", "HoaryFox", "StbBuilder")
{
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddParameter(new Param_Model(), "Model", "Model", "Karamba model data", GH_ParamAccess.item);
}

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Node", "Node", "StbNode Data", GH_ParamAccess.list);
pManager.AddGenericParameter("Member", "Mem", "StbMember data", GH_ParamAccess.item);
pManager.AddGenericParameter("Section", "Sec", "StbSection data", GH_ParamAccess.list);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
var modelIn = new object();

if (!DA.GetData(0, ref modelIn)) { return; }

var ghKModel = modelIn as GH_Model;
if (ghKModel == null)
{
throw new ArgumentException("The input is not of type model!");
}
Model kModel = ghKModel.Value;
STBDotNet.Elements.StbModel.Model sModel = StbModel.Set(kModel);

DA.SetDataList(0, sModel.Nodes);
DA.SetData(1, sModel.Members);
DA.SetDataList(2, sModel.Sections);
}

protected override Bitmap Icon => Properties.Resource.FrameBuilder;
public override Guid ComponentGuid => new Guid("38296D06-E47A-403F-BFE8-00E873A99CF8");
}
}

0 comments on commit f9a8e7e

Please sign in to comment.