-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
119 changed files
with
7,273 additions
and
7,581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,49 @@ | ||
using System; | ||
using Grasshopper.Kernel; | ||
using Grasshopper.Kernel; | ||
|
||
namespace Robots.Grasshopper.Commands | ||
{ | ||
public class CustomCommand : GH_Component | ||
{ | ||
public CustomCommand() : base("Custom command", "CustomCmd", "Custom command written in the manufacturer specific language", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.primary; | ||
public override Guid ComponentGuid => new Guid("{713A6DF0-6C73-477F-8CA5-2FE18F3DE7C4}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconCustomCommand; | ||
namespace Robots.Grasshopper.Commands; | ||
|
||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddTextParameter("Name", "N", "Name", GH_ParamAccess.item, "Custom command"); | ||
pManager.AddTextParameter("Manufacturer", "M", "Robot manufacturer, options: ABB, KUKA, UR, FANUC, Staubli, Other, All. If you select 'All', the command will always be included irrespective of the manufacturer.", GH_ParamAccess.item, "All"); | ||
pManager.AddTextParameter("Code", "C", "Command code", GH_ParamAccess.item); | ||
pManager.AddTextParameter("Declaration", "D", "Variable declaration and assignment", GH_ParamAccess.item); | ||
pManager[2].Optional = true; | ||
pManager[3].Optional = true; | ||
} | ||
public class CustomCommand : GH_Component | ||
{ | ||
public CustomCommand() : base("Custom command", "CustomCmd", "Custom command written in the manufacturer specific language", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.primary; | ||
public override Guid ComponentGuid => new("{713A6DF0-6C73-477F-8CA5-2FE18F3DE7C4}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconCustomCommand; | ||
|
||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddTextParameter("Name", "N", "Name", GH_ParamAccess.item, "Custom command"); | ||
pManager.AddTextParameter("Manufacturer", "M", "Robot manufacturer, options: ABB, KUKA, UR, FANUC, Staubli, Other, All. If you select 'All', the command will always be included irrespective of the manufacturer.", GH_ParamAccess.item, "All"); | ||
pManager.AddTextParameter("Code", "C", "Command code", GH_ParamAccess.item); | ||
pManager.AddTextParameter("Declaration", "D", "Variable declaration and assignment", GH_ParamAccess.item); | ||
pManager[2].Optional = true; | ||
pManager[3].Optional = true; | ||
} | ||
|
||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
string? name = null; | ||
string? manufacturerText = null; | ||
string? code = null, declaration = null; | ||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
|
||
if (!DA.GetData(0, ref name) || name is null) { return; } | ||
if (!DA.GetData(1, ref manufacturerText) || manufacturerText is null) { return; } | ||
DA.GetData(2, ref code); | ||
DA.GetData(3, ref declaration); | ||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
string? name = null; | ||
string? manufacturerText = null; | ||
string? code = null, declaration = null; | ||
|
||
var command = new Robots.Commands.Custom(name); | ||
if (!DA.GetData(0, ref name) || name is null) { return; } | ||
if (!DA.GetData(1, ref manufacturerText) || manufacturerText is null) { return; } | ||
DA.GetData(2, ref code); | ||
DA.GetData(3, ref declaration); | ||
|
||
if(!Enum.TryParse<Manufacturers>(manufacturerText, out var manufacturer)) | ||
{ | ||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $" Manufacturer '{manufacturerText}' not valid."); | ||
return; | ||
} | ||
var command = new Robots.Commands.Custom(name); | ||
|
||
command.AddCommand(manufacturer, code, declaration); | ||
DA.SetData(0, new GH_Command(command)); | ||
if (!Enum.TryParse<Manufacturers>(manufacturerText, out var manufacturer)) | ||
{ | ||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $" Manufacturer '{manufacturerText}' not valid."); | ||
return; | ||
} | ||
|
||
command.AddCommand(manufacturer, code, declaration); | ||
DA.SetData(0, new GH_Command(command)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Grasshopper.Kernel; | ||
using Grasshopper.Kernel; | ||
|
||
namespace Robots.Grasshopper.Commands | ||
namespace Robots.Grasshopper.Commands; | ||
|
||
public class Group : GH_Component | ||
{ | ||
public class Group : GH_Component | ||
{ | ||
public Group() : base("Group command", "GroupCmd", "Group of commands", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.primary; | ||
public override Guid ComponentGuid => new Guid("{17485955-818B-4D0E-9986-26264E1F86DC}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconGroupCommand; | ||
public Group() : base("Group command", "GroupCmd", "Group of commands", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.primary; | ||
public override Guid ComponentGuid => new("{17485955-818B-4D0E-9986-26264E1F86DC}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconGroupCommand; | ||
|
||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Commands", "C", "Group of commands", GH_ParamAccess.list); | ||
} | ||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Commands", "C", "Group of commands", GH_ParamAccess.list); | ||
} | ||
|
||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
|
||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
var commands = new List<GH_Command>(); | ||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
var commands = new List<GH_Command>(); | ||
|
||
if (!DA.GetDataList(0, commands)) { return; } | ||
if (!DA.GetDataList(0, commands)) { return; } | ||
|
||
var command = new Robots.Commands.Group(); | ||
command.AddRange(commands.Select(x => x.Value)); | ||
DA.SetData(0, new GH_Command(command)); | ||
} | ||
var command = new Robots.Commands.Group(); | ||
command.AddRange(commands.Select(x => x.Value)); | ||
DA.SetData(0, new GH_Command(command)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
using System; | ||
using Grasshopper.Kernel; | ||
using Grasshopper.Kernel; | ||
|
||
namespace Robots.Grasshopper.Commands | ||
namespace Robots.Grasshopper.Commands; | ||
|
||
public class Message : GH_Component | ||
{ | ||
public class Message : GH_Component | ||
{ | ||
public Message() : base("Message", "Message", "Sends a text message to the teach pendant", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.secondary; | ||
public override Guid ComponentGuid => new Guid("{CFAABB24-CAEE-49FC-850F-BE9F70F070CA}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconMessage; | ||
public Message() : base("Message", "Message", "Sends a text message to the teach pendant", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.secondary; | ||
public override Guid ComponentGuid => new("{CFAABB24-CAEE-49FC-850F-BE9F70F070CA}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconMessage; | ||
|
||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddTextParameter("Message", "M", "Message to display in teach pendant", GH_ParamAccess.item); | ||
} | ||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddTextParameter("Message", "M", "Message to display in teach pendant", GH_ParamAccess.item); | ||
} | ||
|
||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
|
||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
string message = string.Empty; | ||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
string message = string.Empty; | ||
|
||
if (!DA.GetData(0, ref message)) { return; } | ||
if (!DA.GetData(0, ref message)) { return; } | ||
|
||
var command = new Robots.Commands.Message(message); | ||
DA.SetData(0, new GH_Command(command)); | ||
} | ||
var command = new Robots.Commands.Message(message); | ||
DA.SetData(0, new GH_Command(command)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
using System; | ||
using Grasshopper.Kernel; | ||
using Grasshopper.Kernel; | ||
|
||
namespace Robots.Grasshopper.Commands | ||
namespace Robots.Grasshopper.Commands; | ||
|
||
public class PulseDO : GH_Component | ||
{ | ||
public class PulseDO : GH_Component | ||
{ | ||
public PulseDO() : base("Pulse DO", "PulseDO", "Send a pulse to a digital output", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.secondary; | ||
public override Guid ComponentGuid => new Guid("{3CBDCD59-9621-4A0F-86BF-F4CC876E360D}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconPulseDO; | ||
public PulseDO() : base("Pulse DO", "PulseDO", "Send a pulse to a digital output", "Robots", "Commands") { } | ||
public override GH_Exposure Exposure => GH_Exposure.secondary; | ||
public override Guid ComponentGuid => new("{3CBDCD59-9621-4A0F-86BF-F4CC876E360D}"); | ||
protected override System.Drawing.Bitmap Icon => Properties.Resources.iconPulseDO; | ||
|
||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddIntegerParameter("DO", "D", "Digital output number", GH_ParamAccess.item); | ||
pManager.AddNumberParameter("Time", "T", "Duration of pulse", GH_ParamAccess.item, 0.2); | ||
} | ||
protected override void RegisterInputParams(GH_InputParamManager pManager) | ||
{ | ||
pManager.AddIntegerParameter("DO", "D", "Digital output number", GH_ParamAccess.item); | ||
pManager.AddNumberParameter("Time", "T", "Duration of pulse", GH_ParamAccess.item, 0.2); | ||
} | ||
|
||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddParameter(new CommandParameter(), "Command", "C", "Command", GH_ParamAccess.item); | ||
} | ||
|
||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
int DO = 0; | ||
double length = 0; | ||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
int DO = 0; | ||
double length = 0; | ||
|
||
if (!DA.GetData(0, ref DO)) return; | ||
if (!DA.GetData(1, ref length)) return; | ||
if (!DA.GetData(0, ref DO)) return; | ||
if (!DA.GetData(1, ref length)) return; | ||
|
||
var command = new Robots.Commands.PulseDO(DO, length); | ||
DA.SetData(0, new GH_Command(command)); | ||
} | ||
var command = new Robots.Commands.PulseDO(DO, length); | ||
DA.SetData(0, new GH_Command(command)); | ||
} | ||
} | ||
} |
Oops, something went wrong.