Hi guys,
I'm trying to create a SW Add-In in C#.
Here is my C# code :
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swcommands; using SolidWorks.Interop.swconst; using SolidWorks.Interop.swpublished; using SolidWorksTools; using System.Runtime.InteropServices; namespace ClassLibrary1_testsw { public class SWIntegration : ISwAddin { public SldWorks mSWApplication; private int mSWCookie; public bool ConnectToSW(object ThisSW, int Cookie) { mSWApplication = (SldWorks)ThisSW; mSWCookie = Cookie; // Set-up add-in call back info bool result = mSWApplication.SetAddinCallbackInfo(0, this, Cookie); this.UISetup(); return true; } public bool DisconnectFromSW() { this.UITeardown(); return true; } private void UISetup() { } private void UITeardown() { } [ComRegisterFunction()] private static void ComRegister(Type t) { string keyPath = String.Format(@"SOFTWARE\solidworks\AddIns\{0:b}", t.GUID); using (Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(keyPath)) { rk.SetValue(null, 1); // Load at startup rk.SetValue("Title", "My SwAddin"); // Title rk.SetValue("Description", "All your pixels are belong to us"); // Description } } [ComUnregisterFunction()] private static void ComUnregister(Type t) { string keyPath = String.Format(@"SOFTWARE\solidworks\AddIns\{0:b}", t.GUID); Microsoft.Win32.Registry.LocalMachine.DeleteSubKeyTree(keyPath); } } }
The problem is that I can't see anything in my register after having clicked on "build"...
And then after having created this class, how can i create my add-in ?
I'm so lost... Help please
Thanks in advance,
Seb
Hi, take a look at this tutorial: Create and register SolidWoks C# and VB.NET AddIns in 3 Steps - YouTube