Skip to content

Commit

Permalink
Ajoutez des fichiers projet.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycab committed Jan 6, 2025
1 parent 7e6cf17 commit 83e0695
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 0 deletions.
25 changes: 25 additions & 0 deletions EnableDisableCollision.sln
Original file line number Diff line number Diff line change
@@ -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
191 changes: 191 additions & 0 deletions EnableDisableCollision/CodeBehind.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Code-behind class for the EnableDisableCollision Smart Component.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
public class CodeBehind : SmartComponentCodeBehind
{

CollisionSet collisionSet1;
CollisionSet collisionSet2;
CollisionSet collisionSet3;
CollisionSet collisionSet4;
CollisionSet collisionSet5;
CollisionSet collisionSet6;



/// <summary>
/// Called when the value of a dynamic property value has changed.
/// </summary>
/// <param name="component"> Component that owns the changed property. </param>
/// <param name="changedProperty"> Changed property. </param>
/// <param name="oldValue"> Previous value of the changed property. </param>
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 { }

}

/// <summary>
/// Called when the value of an I/O signal value has changed.
/// </summary>
/// <param name="component"> Component that owns the changed signal. </param>
/// <param name="changedSignal"> Changed signal. </param>
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);
}


/// <summary>
/// Called during simulation.
/// </summary>
/// <param name="component"> Simulated component. </param>
/// <param name="simulationTime"> Time (in ms) for the current simulation step. </param>
/// <param name="previousTime"> Time (in ms) for the previous simulation step. </param>
/// <remarks>
/// For this method to be called, the component must be marked with
/// simulate="true" in the xml file.
/// </remarks>
public override void OnSimulationStep(SmartComponent component, double simulationTime, double previousTime)
{

}
}
}
79 changes: 79 additions & 0 deletions EnableDisableCollision/EnableDisableCollision.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{996EBE59-7EC1-49CD-BDB4-7F09D1F41378}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EnableDisableCollision</RootNamespace>
<AssemblyName>EnableDisableCollision</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<StartAction>Program</StartAction>
<StartProgram>$(MSBuildProgramFiles32)\ABB\RobotStudio 2024\Bin\RobotStudio.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<StartAction>Program</StartAction>
<StartProgram>$(MSBuildProgramFiles32)\ABB\RobotStudio 2024\Bin\RobotStudio.exe</StartProgram>
</PropertyGroup>
<ItemGroup>
<Reference Include="ABB.Robotics.Math">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(MSBuildProgramFiles32)\ABB\SDK\RobotStudio 2024 SDK\ABB.Robotics.Math.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ABB.Robotics.RobotStudio">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(MSBuildProgramFiles32)\ABB\SDK\RobotStudio 2024 SDK\ABB.Robotics.RobotStudio.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ABB.Robotics.RobotStudio.Stations">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(MSBuildProgramFiles32)\ABB\SDK\RobotStudio 2024 SDK\ABB.Robotics.RobotStudio.Stations.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CodeBehind.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="EnableDisableCollision.xml" />
<None Include="EnableDisableCollision.en.xml" />
<None Include="EnableDisableCollision.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>copy /y "$(TargetPath)" "$(ProjectDir)"
"$(MSBuildProgramFiles32)\ABB\RobotStudio 2024\bin\LibraryCompiler.exe" "$(ProjectDir)\EnableDisableCollision.xml"</PostBuildEvent>
</PropertyGroup>
</Project>
Binary file not shown.
9 changes: 9 additions & 0 deletions EnableDisableCollision/EnableDisableCollision.en.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LibraryResource xmlns="urn:abb-robotics-robotstudio-libraryresource"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-robotstudio-libraryresource file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\LibraryResourceSchema.xsd">
<SmartComponent name="EnableDisableCollision" description="Sample Component Description">
<DynamicProperty name="SampleProperty" description="Sample Property Description"/>
<IOSignal name="SampleSignal" description="Sample Signal Description"/>
</SmartComponent>
</LibraryResource>
Binary file added EnableDisableCollision/EnableDisableCollision.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
35 changes: 35 additions & 0 deletions EnableDisableCollision/EnableDisableCollision.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
<lc:LibraryCompiler xmlns:lc="urn:abb-robotics-robotstudio-librarycompiler"
xmlns="urn:abb-robotics-robotstudio-graphiccomponent"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-robotstudio-librarycompiler file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\LibraryCompilerSchema.xsd
urn:abb-robotics-robotstudio-graphiccomponent file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\GraphicComponentSchema.xsd">
<lc:Library fileName="EnableDisableCollision.rslib">
<lc:DocumentProperties>
<lc:Author>alecabellec</lc:Author>
<lc:Image source="EnableDisableCollision.png"/>
</lc:DocumentProperties>
<SmartComponent name="EnableDisableCollision" icon="EnableDisableCollision.png"
codeBehind="EnableDisableCollision.CodeBehind,EnableDisableCollision.dll"
canBeSimulated="true">
<Properties>
<DynamicProperty name="Collision1" valueType="ABB.Robotics.RobotStudio.ProjectObject"></DynamicProperty>
<DynamicProperty name="Collision2" valueType="ABB.Robotics.RobotStudio.ProjectObject"></DynamicProperty>
<DynamicProperty name="Collision3" valueType="ABB.Robotics.RobotStudio.ProjectObject"></DynamicProperty>
<DynamicProperty name="Collision4" valueType="ABB.Robotics.RobotStudio.ProjectObject"></DynamicProperty>
<DynamicProperty name="Collision5" valueType="ABB.Robotics.RobotStudio.ProjectObject"></DynamicProperty>
<DynamicProperty name="Collision6" valueType="ABB.Robotics.RobotStudio.ProjectObject"></DynamicProperty>
</Properties>
<Bindings>
</Bindings>
<Signals>
<IOSignal name="ToolCollisionEnable" signalType="DigitalGroupInput"/>
</Signals>
<GraphicComponents>
</GraphicComponents>
<Assets>
<Asset source="EnableDisableCollision.dll"/>
</Assets>
</SmartComponent>
</lc:Library>
</lc:LibraryCompiler>
36 changes: 36 additions & 0 deletions EnableDisableCollision/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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")]

0 comments on commit 83e0695

Please sign in to comment.