Skip to content

Commit 2162143

Browse files
committed
DefJoints, RenderColor
Define joints now converts KUKA angles to robots New compiled render color that doesn't use aditional plugins for baking Downgraded SDK target for maximum compatibility
1 parent 8125475 commit 2162143

File tree

8 files changed

+341
-104
lines changed

8 files changed

+341
-104
lines changed

Properties/AssemblyInfo.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#endif
1515
[assembly: AssemblyCompany("Yu Chieh (Victor) Lin")]
1616
[assembly: AssemblyProduct("RobotsExtended")]
17-
[assembly: AssemblyCopyright("Copyright © 2023")]
17+
[assembly: AssemblyCopyright("Copyright © 2024")]
1818
[assembly: AssemblyTrademark("")]
1919
[assembly: AssemblyCulture("")]
2020

@@ -36,7 +36,5 @@
3636
// You can specify all the values or you can default the Build and Revision Numbers
3737
// by using the '*' as shown below:
3838
// [assembly: AssemblyVersion("1.0.*")]
39-
[assembly: AssemblyVersion("1.6.5")]
40-
#pragma warning disable CS7035 // The specified version string does not conform to the recommended format - major.minor.build.revision
41-
[assembly: AssemblyFileVersion("1.6.5")]
42-
#pragma warning restore CS7035 // The specified version string does not conform to the recommended format - major.minor.build.revision
39+
[assembly: AssemblyVersion("1.6.7")]
40+
[assembly: AssemblyFileVersion("1.6.7.0")]

RobotsExtended.csproj

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<RootNamespace>RobotsExtended</RootNamespace>
1212
<AssemblyName>RobotsExtended</AssemblyName>
1313
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
14+
<LangVersion>9.0</LangVersion>
1415
<FileAlignment>512</FileAlignment>
1516
<IsWebBootstrapper>false</IsWebBootstrapper>
1617
<TargetFrameworkProfile />
@@ -48,6 +49,7 @@
4849
<Compile Include="RobotsExtendedInfo.cs" />
4950
<Compile Include="Properties\AssemblyInfo.cs" />
5051
<Compile Include="src\Kuka\MxAutomation.cs" />
52+
<Compile Include="src\Util\Obsolete_RenderColour.cs" />
5153
<Compile Include="src\Util\RenderColour.cs" />
5254
<Compile Include="src\Util\RotateEuler.cs" />
5355
<Compile Include="src\Util\UpdateFrame.cs" />
@@ -89,33 +91,33 @@
8991
<None Include="Resources\DeTool.png" />
9092
</ItemGroup>
9193
<ItemGroup>
92-
<Reference Include="Eto, Version=2.6.0.0, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
93-
<HintPath>packages\RhinoCommon.7.14.22010.17001\lib\net48\Eto.dll</HintPath>
94+
<Reference Include="Eto, Version=2.5.0.0, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
95+
<HintPath>packages\RhinoCommon.7.0.20314.3001\lib\net45\Eto.dll</HintPath>
9496
<Private>False</Private>
9597
</Reference>
96-
<Reference Include="GH_IO, Version=7.14.22010.17000, Culture=neutral, PublicKeyToken=6a29997d2e6b4f97, processorArchitecture=MSIL">
97-
<HintPath>packages\Grasshopper.7.14.22010.17001\lib\net48\GH_IO.dll</HintPath>
98+
<Reference Include="GH_IO, Version=7.0.20314.3000, Culture=neutral, PublicKeyToken=6a29997d2e6b4f97, processorArchitecture=MSIL">
99+
<HintPath>packages\Grasshopper.7.0.20314.3001\lib\net45\GH_IO.dll</HintPath>
98100
<Private>False</Private>
99101
</Reference>
100-
<Reference Include="Grasshopper, Version=7.14.22010.17000, Culture=neutral, PublicKeyToken=dda4f5ec2cd80803, processorArchitecture=MSIL">
101-
<HintPath>packages\Grasshopper.7.14.22010.17001\lib\net48\Grasshopper.dll</HintPath>
102+
<Reference Include="Grasshopper, Version=7.0.20314.3000, Culture=neutral, PublicKeyToken=dda4f5ec2cd80803, processorArchitecture=MSIL">
103+
<HintPath>packages\Grasshopper.7.0.20314.3001\lib\net45\Grasshopper.dll</HintPath>
102104
<Private>False</Private>
103105
</Reference>
104106
<Reference Include="Microsoft.CSharp" />
105-
<Reference Include="Rhino.UI, Version=7.14.22010.17000, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
106-
<HintPath>packages\RhinoCommon.7.14.22010.17001\lib\net48\Rhino.UI.dll</HintPath>
107+
<Reference Include="Rhino.UI, Version=7.0.20314.3000, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
108+
<HintPath>packages\RhinoCommon.7.0.20314.3001\lib\net45\Rhino.UI.dll</HintPath>
107109
<Private>False</Private>
108110
</Reference>
109-
<Reference Include="RhinoCommon, Version=7.14.22010.17000, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
110-
<HintPath>packages\RhinoCommon.7.14.22010.17001\lib\net48\RhinoCommon.dll</HintPath>
111+
<Reference Include="RhinoCommon, Version=7.0.20314.3000, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
112+
<HintPath>packages\RhinoCommon.7.0.20314.3001\lib\net45\RhinoCommon.dll</HintPath>
111113
<Private>False</Private>
112114
</Reference>
113-
<Reference Include="Robots, Version=1.6.5.0, Culture=neutral, processorArchitecture=MSIL">
114-
<HintPath>packages\Robots.Rhino.1.6.5\lib\net48\Robots.dll</HintPath>
115+
<Reference Include="Robots, Version=1.6.7.0, Culture=neutral, processorArchitecture=MSIL">
116+
<HintPath>packages\Robots.Rhino.1.6.7\lib\net48\Robots.dll</HintPath>
115117
<Private>False</Private>
116118
</Reference>
117-
<Reference Include="Robots.Grasshopper, Version=1.6.5.0, Culture=neutral, processorArchitecture=MSIL">
118-
<HintPath>packages\Robots.Rhino.1.6.5\lib\net48\Robots.Grasshopper.dll</HintPath>
119+
<Reference Include="Robots.Grasshopper, Version=1.6.7.0, Culture=neutral, processorArchitecture=MSIL">
120+
<HintPath>packages\Robots.Rhino.1.6.7\lib\net48\Robots.Grasshopper.dll</HintPath>
119121
<Private>False</Private>
120122
</Reference>
121123
<Reference Include="System" />
@@ -152,13 +154,13 @@ if $(ConfigurationName) == Release (
152154
<StartAction>Program</StartAction>
153155
<PlatformTarget>x64</PlatformTarget>
154156
</PropertyGroup>
155-
<Import Project="packages\RhinoCommon.7.14.22010.17001\build\RhinoCommon.targets" Condition="Exists('packages\RhinoCommon.7.14.22010.17001\build\RhinoCommon.targets')" />
157+
<Import Project="packages\RhinoCommon.7.0.20314.3001\build\RhinoCommon.targets" Condition="Exists('packages\RhinoCommon.7.0.20314.3001\build\RhinoCommon.targets')" />
156158
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
157159
<PropertyGroup>
158160
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
159161
</PropertyGroup>
160-
<Error Condition="!Exists('packages\RhinoCommon.7.14.22010.17001\build\RhinoCommon.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\RhinoCommon.7.14.22010.17001\build\RhinoCommon.targets'))" />
161-
<Error Condition="!Exists('packages\Grasshopper.7.14.22010.17001\build\Grasshopper.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Grasshopper.7.14.22010.17001\build\Grasshopper.targets'))" />
162+
<Error Condition="!Exists('packages\RhinoCommon.7.0.20314.3001\build\RhinoCommon.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\RhinoCommon.7.0.20314.3001\build\RhinoCommon.targets'))" />
163+
<Error Condition="!Exists('packages\Grasshopper.7.0.20314.3001\build\Grasshopper.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Grasshopper.7.0.20314.3001\build\Grasshopper.targets'))" />
162164
</Target>
163-
<Import Project="packages\Grasshopper.7.14.22010.17001\build\Grasshopper.targets" Condition="Exists('packages\Grasshopper.7.14.22010.17001\build\Grasshopper.targets')" />
165+
<Import Project="packages\Grasshopper.7.0.20314.3001\build\Grasshopper.targets" Condition="Exists('packages\Grasshopper.7.0.20314.3001\build\Grasshopper.targets')" />
164166
</Project>

RobotsExtended.csproj.user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
4-
<StartProgram>C:\Program Files\Rhino 7\System\Rhino.exe</StartProgram>
5-
<StartArguments>/nosplash /notemplate /runscript="_-Grasshopper Banner Disable Window Load Window Show _Enter"</StartArguments>
4+
<StartProgram>C:\Program Files\Rhino 8\System\Rhino.exe</StartProgram>
5+
<StartArguments>/netfx /nosplash /notemplate /runscript="_-Grasshopper Banner Disable Window Load Window Show _Enter"</StartArguments>
66
</PropertyGroup>
77
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
88
<StartAction>Program</StartAction>

packages.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Grasshopper" version="7.14.22010.17001" targetFramework="net48" />
4-
<package id="RhinoCommon" version="7.14.22010.17001" targetFramework="net48" />
5-
<package id="Robots.Rhino" version="1.6.5" targetFramework="net48" />
3+
<package id="Grasshopper" version="7.0.20314.3001" targetFramework="net48" />
4+
<package id="RhinoCommon" version="7.0.20314.3001" targetFramework="net48" />
5+
<package id="Robots.Rhino" version="1.6.7" targetFramework="net48" />
66
</packages>

src/Kuka/MxAutomation.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88

99
namespace RobotsExtended.Kuka
1010
{
11-
public class MxAutomation : GH_Component
12-
{
13-
public MxAutomation() : base("mxAutomation","KUKA.mxA","KUKA mxAutomation. [Requires mxA package]", "Robots", "Components") { }
14-
public override GH_Exposure Exposure => GH_Exposure.senary; //| GH_Exposure.obscure;
15-
protected override Bitmap Icon => Properties.Resources.KukaVarProxyConnect;
16-
public override Guid ComponentGuid => new Guid("{30263A03-866C-4BBF-A90A-5C3F0DC62926}");
11+
//public class MxAutomation : GH_Component
12+
//{
13+
// public MxAutomation() : base("mxAutomation","KUKA.mxA","KUKA mxAutomation. [Requires mxA package]", "Robots", "Components") { }
14+
// public override GH_Exposure Exposure => GH_Exposure.senary; //| GH_Exposure.obscure;
15+
// protected override Bitmap Icon => Properties.Resources.KukaVarProxyConnect;
16+
// public override Guid ComponentGuid => new Guid("{30263A03-866C-4BBF-A90A-5C3F0DC62926}");
1717

18-
protected override void RegisterInputParams(GH_InputParamManager pManager)
19-
{
20-
pManager.AddTextParameter("", "IP", "IP Address of the controller to communicate with", GH_ParamAccess.item);
18+
// protected override void RegisterInputParams(GH_InputParamManager pManager)
19+
// {
20+
// pManager.AddTextParameter("", "IP", "IP Address of the controller to communicate with", GH_ParamAccess.item);
2121

22-
}
22+
// }
2323

24-
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
25-
{
26-
}
24+
// protected override void RegisterOutputParams(GH_OutputParamManager pManager)
25+
// {
26+
// }
2727

28-
protected override void SolveInstance(IGH_DataAccess DA)
29-
{
30-
// TO BE IMPLEMENTED
31-
}
32-
}
28+
// protected override void SolveInstance(IGH_DataAccess DA)
29+
// {
30+
// // TO BE IMPLEMENTED
31+
// }
32+
//}
3333
}

src/Util/DefineJoints.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
using System.Text;
1010
using System.Threading.Tasks;
1111
using System.Windows.Forms;
12+
using Grasshopper.Kernel.Geometry;
13+
using Robots;
1214

1315
namespace RobotsExtended.Util
1416
{
@@ -19,7 +21,7 @@ public DefJoints()
1921
"Define joint angle of each axis of the robot in degrees and outputs it as string of radians",
2022
"Robots", "Utility")
2123
{ }
22-
public override Guid ComponentGuid => new Guid("cd62f0e9-b8bc-49d9-b423-5e181b71f22f");
24+
public override Guid ComponentGuid => new("cd62f0e9-b8bc-49d9-b423-5e181b71f22f");
2325
protected override System.Drawing.Bitmap Icon => Properties.Resources.Define_Joints;
2426
protected override void RegisterInputParams(GH_InputParamManager pManager)
2527
{
@@ -45,7 +47,7 @@ public override void AddedToDocument(GH_Document doc)
4547
{
4648
if (p.SourceCount == 0)
4749
{
48-
GH_NumberSlider slider = new GH_NumberSlider();
50+
GH_NumberSlider slider = new();
4951
slider.CreateAttributes();
5052

5153
slider.Attributes.Pivot = new System.Drawing.PointF(
@@ -54,7 +56,7 @@ public override void AddedToDocument(GH_Document doc)
5456
slider.Slider.Maximum = limits[1, i];
5557
slider.Slider.Minimum = limits[0, i];
5658
slider.Slider.DecimalPlaces = 0;
57-
slider.SetSliderValue(0);
59+
slider.SetSliderValue(limits[2, i]);
5860
OnPingDocument().AddObject(slider, false);
5961
p.AddSource(slider);
6062
p.CollectData();
@@ -71,14 +73,23 @@ protected override void SolveInstance(IGH_DataAccess DA)
7173
double deg;
7274
try { deg = Convert.ToDouble(theta[i]); }
7375
catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input not a number."); return; }
74-
theta[i] = (deg % 45 == 0 && deg != 0) ? (deg == 180 ? "Pi" : (deg / 180 + " * Pi")) : RhinoMath.ToRadians(deg).ToString();
76+
77+
double rad = deg * (Math.PI / 180.0);
78+
if (!external && i == 2) rad -= 0.5 * Math.PI;
79+
rad = -rad;
80+
theta[i] = rad % Math.PI == 0 && rad != 0
81+
? rad / Math.PI + "*Pi"
82+
: (rad % Math.PI == 0.5 * Math.PI
83+
? rad / Math.PI + "*Pi"
84+
: rad.ToString());
85+
7586
}
76-
StringBuilder str = new StringBuilder(theta[0].ToString() + ", " + theta[1].ToString());
87+
StringBuilder str = new($"{theta[0]},{theta[1]}");
7788
if (!external)
7889
{
7990
for (int i = 2; i < 6; i++)
8091
{
81-
str.Append(", " + theta[i]);
92+
str.Append("," + theta[i]);
8293
}
8394
}
8495
DA.SetData(0, str);
@@ -141,10 +152,11 @@ void IGH_VariableParameterComponent.VariableParameterMaintenance() { }
141152
new Param_String { Name = "Axis 5", NickName = "A5", Description = "Degree of rotation for Axis 5", Optional = false },
142153
new Param_String { Name = "Axis 6", NickName = "A6", Description = "Degree of rotation for Axis 6", Optional = false }
143154
};
144-
readonly int[,] limits = new int[2, 6]
155+
readonly int[,] limits = new int[3, 6]
145156
{
146-
{-185,-35,-68,-185,-119,-350},
147-
{ 185, 135, 210, 185, 119, 350},
157+
{-185,-190,-120,-350,-119,-350},
158+
{ 185, 45, 158, 350, 119, 350},
159+
{ 0, -120, 140, 0, -20, 0},
148160
};
149161
}
150162

src/Util/Obsolete_RenderColour.cs

Lines changed: 75 additions & 0 deletions
Large diffs are not rendered by default.

src/Util/RenderColour.cs

Lines changed: 199 additions & 49 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)