Skip to content

Commit

Permalink
0311
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-ycv committed Mar 11, 2024
1 parent 5b9091d commit 64de64b
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/Kuka/CVEL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class CVEL : GH_Component
{
public CVEL()
: base("Speed Approximation", "CVEL",
: base("Speed approximation", "CVEL",
"Commands the robot to maintain defined speed percentage by zoning (Custom Command)\r\nShould be the first command if in a command group",
"Robots", "Commands")
{ }
Expand Down
2 changes: 1 addition & 1 deletion src/Util/DeconstructTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public class DeconstructTool : GH_Component
{
public DeconstructTool() : base("Deconstruct Tool", "DeTool", "Retrieves properties of an exsisting tool", "Robots", "Utility") { }
public DeconstructTool() : base("Deconstruct tool", "DeTool", "Retrieves properties of an exsisting tool", "Robots", "Utility") { }
protected override Bitmap Icon => Properties.Resources.DeTool;
public override Guid ComponentGuid => new("753CDC90-7278-45C4-91D4-B476BA34D396");
readonly string tName = nameof(tName);
Expand Down
2 changes: 1 addition & 1 deletion src/Util/DefineJoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class DefJoints : GH_Component, IGH_VariableParameterComponent
{
public DefJoints()
: base("Define Joints", "DefJoints",
: base("Define joints", "DefJoints",
"Define joint angle of each axis of the robot in degrees and outputs it as string of radians",
"Robots", "Utility")
{ }
Expand Down
5 changes: 2 additions & 3 deletions src/Util/LoadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ namespace RobotsExtended.Util
{
public class LoadCommand : GH_Component
{
public LoadCommand() : base("Load Command", "Com", "Load predefined commands on the xml config", "Robots", "Utility") { }
public LoadCommand() : base("Load command", "Com", "Load predefined commands on the xml config", "Robots", "Components") { }
public override Guid ComponentGuid => new("{56C786AD-B863-4D81-87FE-6B7F233295A1}");
protected override Bitmap Icon => Properties.Resources.Command;
private static readonly int _Type = 3;

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
Expand Down Expand Up @@ -121,7 +120,7 @@ static RC.Custom Load(string name, string val)
var manu = command.Attribute(XName.Get("manufacturer"))?.Value;
if (input == "true")
{
name += val;
name += val ?? throw new Exception("Value (V) requires input");
code = code.Replace("?", val);
}

Expand Down
51 changes: 12 additions & 39 deletions src/Util/RenderColour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public RenderColour()
//{ }
: base()
{
Name = "Render Colour";
Name = "Render colour";
NickName = "Colour";
Description = "Creates colour list for custom preview";
Description = "Adds colour to robot mesh";
Category = "Robots";
SubCategory = "Utility";
}
Expand Down Expand Up @@ -53,7 +53,6 @@ protected override void BeforeSolveInstance()
{
_items = [];
_boundingBox = BoundingBox.Empty;
//meshes.Clear();
//base.BeforeSolveInstance();
}
override protected void AfterSolveInstance()
Expand Down Expand Up @@ -141,68 +140,42 @@ void Append(GH_Mesh m, Color c)
{
if (!m.IsValid) return;
GH_Material material = new(c);
GH_CustomPreviewItem item = default;
item.Geometry = m;
item.Shader = material.Value;
item.Colour = material.Value.Diffuse;
item.Material = material;
GH_CustomPreviewItem item = new()
{
Geometry = m,
Shader = material.Value,
Colour = material.Value.Diffuse,
Material = material,
};
_items.Add(item);
_boundingBox.Union(m.Boundingbox);
}
}
public override void DrawViewportMeshes(IGH_PreviewArgs args)
{
if (this.Locked || _items.Count == 0 || args.Document.IsRenderMeshPipelineViewport(args.Display))
if (this.Locked || _items.Count == 0)
return;
if (this.Attributes.Selected)
{
GH_PreviewMeshArgs args2 = new(args.Viewport, args.Display, args.ShadeMaterial_Selected, args.MeshingParameters);
foreach (GH_CustomPreviewItem item in _items)
item.Geometry.DrawViewportMeshes(args2);
//for (int i = 0; i < meshes.Count; i++)
// meshes[i].DrawViewportMeshes(args2);
return;
}
foreach (GH_CustomPreviewItem item in _items)
{
GH_PreviewMeshArgs args2 = new(args.Viewport, args.Display, item.Shader, args.MeshingParameters);
item.Geometry.DrawViewportMeshes(args2);
}
//for (int i = 0; i < meshes.Count; i++)
//{
// GH_PreviewMeshArgs args2 = new(args.Viewport, args.Display, new DisplayMaterial(colors[i]), args.MeshingParameters);
// meshes[i].DrawViewportMeshes(args2);
//}
//for(int i = 0; i<meshes.Count; i++)
// args.Display.DrawMeshShaded(meshes[i].Value, new DisplayMaterial(colors[i]));
//base.DrawViewportMeshes(args);
}
//public void AppendCustomGeometry(GH_RenderArgs args)
//{
// if (_items == null || _items.Count == 0)
// {
// return;
// }

// GH_Document gH_Document = OnPingDocument();
// if (gH_Document != null && (gH_Document.PreviewMode == GH_PreviewMode.Disabled || _items.Count == 0 || gH_Document.PreviewMode == GH_PreviewMode.Wireframe))
// return;

// foreach (var item in _items)
// item.PushToRenderPipeline(args);
//}

[Obsolete] // For Rhino 7
[Obsolete]
public override void AppendRenderGeometry(GH_RenderArgs args)
{
GH_Document gH_Document = OnPingDocument();
if (gH_Document != null && (gH_Document.PreviewMode == GH_PreviewMode.Disabled || _items.Count == 0 || gH_Document.PreviewMode == GH_PreviewMode.Wireframe))
if (_items != null || _items.Count == 0)
return;
foreach (var item in _items)
item.PushToRenderPipeline(args);
//args.Geomety.Add(item.Value,args.MaterialNormal);
//base.AppendRenderGeometry(args);
}

}
}
2 changes: 1 addition & 1 deletion src/Util/RobotLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class RobotLibrary : GH_Component
public override Guid ComponentGuid => new("{73D053CD-4013-40D2-BE10-C62F999AB60C}");
override public GH_Exposure Exposure => GH_Exposure.secondary;
protected override Bitmap Icon => Properties.Resources.Library;
public RobotLibrary() : base("Robot Library", "Library", "Double click to open Robot Library directory", "Robots", "Utility") { }
public RobotLibrary() : base("Robot library", "Library", "Double click to open Robot Library directory", "Robots", "Utility") { }
bool Open = false;
private static readonly string localPath = FileIO.LocalLibraryPath, downloadPath = FileIO.OnlineLibraryPath;

Expand Down
2 changes: 1 addition & 1 deletion src/Util/UpdateFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public class UpdateFrame : GH_Component
{
public UpdateFrame() : base("Update Frame", "newBase", "Update frame info", "Robots", "Utility") { }
public UpdateFrame() : base("Update frame", "newBase", "Update frame info", "Robots", "Utility") { }
public override Guid ComponentGuid => new("{3BAA462A-7D1B-401A-B789-2E12B878B6AD}");
protected override System.Drawing.Bitmap Icon => Properties.Resources.UpdateFrame;

Expand Down
2 changes: 1 addition & 1 deletion src/Util/UpdateTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public class UpdateTool : GH_Component, IGH_VariableParameterComponent
{
public UpdateTool() : base("Update Tool", "newTCP", "Update the TCP of an exsisting tool", "Robots", "Utility") { }
public UpdateTool() : base("Update tool", "newTCP", "Update the TCP of an exsisting tool", "Robots", "Utility") { }
//public override GH_Exposure Exposure => GH_Exposure.hidden;
protected override System.Drawing.Bitmap Icon => Properties.Resources.UpdateTool;
public override Guid ComponentGuid => new("92915A29-8636-4670-B21C-756D681789E4");
Expand Down

0 comments on commit 64de64b

Please sign in to comment.