From 64de64b729c51f53acd2cdb7c7b96c812f44b657 Mon Sep 17 00:00:00 2001 From: Yu Chieh Victor Lin Date: Mon, 11 Mar 2024 18:05:35 +0800 Subject: [PATCH] 0311 --- src/Kuka/CVEL.cs | 2 +- src/Util/DeconstructTool.cs | 2 +- src/Util/DefineJoints.cs | 2 +- src/Util/LoadCommand.cs | 5 ++-- src/Util/RenderColour.cs | 51 +++++++++---------------------------- src/Util/RobotLibrary.cs | 2 +- src/Util/UpdateFrame.cs | 2 +- src/Util/UpdateTool.cs | 2 +- 8 files changed, 20 insertions(+), 48 deletions(-) diff --git a/src/Kuka/CVEL.cs b/src/Kuka/CVEL.cs index 88b6652..a130f41 100644 --- a/src/Kuka/CVEL.cs +++ b/src/Kuka/CVEL.cs @@ -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") { } diff --git a/src/Util/DeconstructTool.cs b/src/Util/DeconstructTool.cs index 93a8814..37d5d2a 100644 --- a/src/Util/DeconstructTool.cs +++ b/src/Util/DeconstructTool.cs @@ -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); diff --git a/src/Util/DefineJoints.cs b/src/Util/DefineJoints.cs index 3065c4c..3a9ebe6 100644 --- a/src/Util/DefineJoints.cs +++ b/src/Util/DefineJoints.cs @@ -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") { } diff --git a/src/Util/LoadCommand.cs b/src/Util/LoadCommand.cs index e51b3ee..db057ca 100644 --- a/src/Util/LoadCommand.cs +++ b/src/Util/LoadCommand.cs @@ -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) { @@ -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); } diff --git a/src/Util/RenderColour.cs b/src/Util/RenderColour.cs index 30b5780..b46b17d 100644 --- a/src/Util/RenderColour.cs +++ b/src/Util/RenderColour.cs @@ -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"; } @@ -53,7 +53,6 @@ protected override void BeforeSolveInstance() { _items = []; _boundingBox = BoundingBox.Empty; - //meshes.Clear(); //base.BeforeSolveInstance(); } override protected void AfterSolveInstance() @@ -141,26 +140,26 @@ 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) @@ -168,41 +167,15 @@ public override void DrawViewportMeshes(IGH_PreviewArgs args) 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 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; diff --git a/src/Util/UpdateFrame.cs b/src/Util/UpdateFrame.cs index 60dc6e9..c21e27d 100644 --- a/src/Util/UpdateFrame.cs +++ b/src/Util/UpdateFrame.cs @@ -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; diff --git a/src/Util/UpdateTool.cs b/src/Util/UpdateTool.cs index b804fda..f629736 100644 --- a/src/Util/UpdateTool.cs +++ b/src/Util/UpdateTool.cs @@ -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");