diff --git a/EnableDisableCollision.sln b/EnableDisableCollision.sln new file mode 100644 index 0000000..132c76e --- /dev/null +++ b/EnableDisableCollision.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35303.130 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnableDisableCollision", "EnableDisableCollision\EnableDisableCollision.csproj", "{996EBE59-7EC1-49CD-BDB4-7F09D1F41378}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {996EBE59-7EC1-49CD-BDB4-7F09D1F41378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {996EBE59-7EC1-49CD-BDB4-7F09D1F41378}.Debug|Any CPU.Build.0 = Debug|Any CPU + {996EBE59-7EC1-49CD-BDB4-7F09D1F41378}.Release|Any CPU.ActiveCfg = Release|Any CPU + {996EBE59-7EC1-49CD-BDB4-7F09D1F41378}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {972582B9-BA72-492C-AC5E-A697D79958CF} + EndGlobalSection +EndGlobal diff --git a/EnableDisableCollision/CodeBehind.cs b/EnableDisableCollision/CodeBehind.cs new file mode 100644 index 0000000..82af439 --- /dev/null +++ b/EnableDisableCollision/CodeBehind.cs @@ -0,0 +1,191 @@ +using ABB.Robotics.Math; +using ABB.Robotics.RobotStudio; +using ABB.Robotics.RobotStudio.Stations; +using System; +using System.Collections.Generic; +using System.Security.Principal; +using System.Text; +using System.Windows.Forms; + +namespace EnableDisableCollision +{ + /// + /// Code-behind class for the EnableDisableCollision Smart Component. + /// + /// + /// The code-behind class should be seen as a service provider used by the + /// Smart Component runtime. Only one instance of the code-behind class + /// is created, regardless of how many instances there are of the associated + /// Smart Component. + /// Therefore, the code-behind class should not store any state information. + /// Instead, use the SmartComponent.StateCache collection. + /// + public class CodeBehind : SmartComponentCodeBehind + { + + CollisionSet collisionSet1; + CollisionSet collisionSet2; + CollisionSet collisionSet3; + CollisionSet collisionSet4; + CollisionSet collisionSet5; + CollisionSet collisionSet6; + + + + /// + /// Called when the value of a dynamic property value has changed. + /// + /// Component that owns the changed property. + /// Changed property. + /// Previous value of the changed property. + public override void OnPropertyValueChanged(SmartComponent component, DynamicProperty changedProperty, Object oldValue) + { + + + try + { + collisionSet1 = (CollisionSet)component.Properties["Collision1"].Value; + } + catch { } + + try + { + collisionSet2 = (CollisionSet)component.Properties["Collision2"].Value; + } + catch { } + try + { + collisionSet3 = (CollisionSet)component.Properties["Collision3"].Value; + } + catch { } + try + { + collisionSet4 = (CollisionSet)component.Properties["Collision4"].Value; + } + catch { } + try + { + collisionSet5 = (CollisionSet)component.Properties["Collision5"].Value; + } + catch { } + try + { + collisionSet6 = (CollisionSet)component.Properties["Collision6"].Value; + } + catch { } + + } + + /// + /// Called when the value of an I/O signal value has changed. + /// + /// Component that owns the changed signal. + /// Changed signal. + public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal) + { + try + { + this.OnLoad(component); + + if (changedSignal.Name == "ToolCollisionEnable") + { + + if (collisionSet1 != null) collisionSet1.Active = false; + if (collisionSet2 != null) collisionSet2.Active = false; + if (collisionSet3 != null) collisionSet3.Active = false; + if (collisionSet4 != null) collisionSet4.Active = false; + if (collisionSet5 != null) collisionSet5.Active = false; + if (collisionSet6 != null) collisionSet6.Active = false; + + + + if ((uint)component.IOSignals["ToolCollisionEnable"].Value == 1) + { + collisionSet1.Active = true; + + } + if ((uint)component.IOSignals["ToolCollisionEnable"].Value == 2) + { + collisionSet2.Active = true; + + } + if ((uint)component.IOSignals["ToolCollisionEnable"].Value == 3) + { + collisionSet3.Active = true; + } + if ((uint)component.IOSignals["ToolCollisionEnable"].Value == 4) + { + collisionSet4.Active = true; + } + if ((uint)component.IOSignals["ToolCollisionEnable"].Value == 5) + { + collisionSet5.Active = true; + } + if ((uint)component.IOSignals["ToolCollisionEnable"].Value == 6) + { + collisionSet6.Active = true; + } + + Logger.AddMessage(new LogMessage("CollisionSet " + (uint)component.IOSignals["ToolCollisionEnable"].Value + " : " + collisionSet1.Active)); + } + } + catch (Exception ex) + { + } + } + public override void OnLoad(SmartComponent component) + { + base.OnLoad(component); + + try + { + collisionSet1 = (CollisionSet)component.Properties["Collision1"].Value; + } + catch { } + + try + { + collisionSet2 = (CollisionSet)component.Properties["Collision2"].Value; + } + catch { } + try + { + collisionSet3 = (CollisionSet)component.Properties["Collision3"].Value; + } + catch { } + try + { + collisionSet4 = (CollisionSet)component.Properties["Collision4"].Value; + } + catch { } + try + { + collisionSet5 = (CollisionSet)component.Properties["Collision5"].Value; + } + catch { } + try + { + collisionSet6 = (CollisionSet)component.Properties["Collision6"].Value; + } + catch { } + + base.OnLoad(component); + } + + + /// + /// Called during simulation. + /// + /// Simulated component. + /// Time (in ms) for the current simulation step. + /// Time (in ms) for the previous simulation step. + /// + /// For this method to be called, the component must be marked with + /// simulate="true" in the xml file. + /// + public override void OnSimulationStep(SmartComponent component, double simulationTime, double previousTime) + { + + } + } +} diff --git a/EnableDisableCollision/EnableDisableCollision.csproj b/EnableDisableCollision/EnableDisableCollision.csproj new file mode 100644 index 0000000..d546506 --- /dev/null +++ b/EnableDisableCollision/EnableDisableCollision.csproj @@ -0,0 +1,79 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {996EBE59-7EC1-49CD-BDB4-7F09D1F41378} + Library + Properties + EnableDisableCollision + EnableDisableCollision + v4.8 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + Program + $(MSBuildProgramFiles32)\ABB\RobotStudio 2024\Bin\RobotStudio.exe + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + Program + $(MSBuildProgramFiles32)\ABB\RobotStudio 2024\Bin\RobotStudio.exe + + + + False + $(MSBuildProgramFiles32)\ABB\SDK\RobotStudio 2024 SDK\ABB.Robotics.Math.dll + False + + + False + $(MSBuildProgramFiles32)\ABB\SDK\RobotStudio 2024 SDK\ABB.Robotics.RobotStudio.dll + False + + + False + $(MSBuildProgramFiles32)\ABB\SDK\RobotStudio 2024 SDK\ABB.Robotics.RobotStudio.Stations.dll + False + + + + + + + + + + + + + + + + + + + copy /y "$(TargetPath)" "$(ProjectDir)" +"$(MSBuildProgramFiles32)\ABB\RobotStudio 2024\bin\LibraryCompiler.exe" "$(ProjectDir)\EnableDisableCollision.xml" + + \ No newline at end of file diff --git a/EnableDisableCollision/EnableDisableCollision.dll b/EnableDisableCollision/EnableDisableCollision.dll new file mode 100644 index 0000000..bc018da Binary files /dev/null and b/EnableDisableCollision/EnableDisableCollision.dll differ diff --git a/EnableDisableCollision/EnableDisableCollision.en.xml b/EnableDisableCollision/EnableDisableCollision.en.xml new file mode 100644 index 0000000..0e7100a --- /dev/null +++ b/EnableDisableCollision/EnableDisableCollision.en.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/EnableDisableCollision/EnableDisableCollision.png b/EnableDisableCollision/EnableDisableCollision.png new file mode 100644 index 0000000..d5c4ae2 Binary files /dev/null and b/EnableDisableCollision/EnableDisableCollision.png differ diff --git a/EnableDisableCollision/EnableDisableCollision.rslib b/EnableDisableCollision/EnableDisableCollision.rslib new file mode 100644 index 0000000..f288477 Binary files /dev/null and b/EnableDisableCollision/EnableDisableCollision.rslib differ diff --git a/EnableDisableCollision/EnableDisableCollision.xml b/EnableDisableCollision/EnableDisableCollision.xml new file mode 100644 index 0000000..42396bc --- /dev/null +++ b/EnableDisableCollision/EnableDisableCollision.xml @@ -0,0 +1,35 @@ + + + + + alecabellec + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/EnableDisableCollision/Properties/AssemblyInfo.cs b/EnableDisableCollision/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0d5a8e1 --- /dev/null +++ b/EnableDisableCollision/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("EnableDisableCollision")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("EnableDisableCollision")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("e60f2004-8473-400b-867c-5165065f5339")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]