Debugging & reloading Addins

Dec 06, 2008 7 Replies

I'm trying to write some addins in C# for SW 2009 but I'm having some difficultly. (besides the absolute lack of information/documentation)



What I need to be able to do is debug the addin and/or be able to reload it without restarting solidworks every time.



Anyone have any experience with this?



Thanks, Jon


By the way, I'm using VS.NET 2k8

As long as the addin is loaded into SW, I don't think you'll be able to change the DLL. If you turn the addin off (under Tools -->

Addins), you migh be able to swap DLLs.

Usually I start with writing an EXE. When I get the code running the way I want, I migrate the modules to an addin DLL.

My addin class modules typically don't have code that does the actual "work". I structure addin projectss such that the addin class module is simply a portal to the other forms and modules. The addin class module just does the SolidWorks housekeping such as connecting, getting cookies, and settin up menus and toolbars.

I've got the exe to work but I'm having problems passing arrays. DispatchWrapper wraps them but for some reason the data doesn't get solid works(ends up with 0's).

I can, for example, do a table pattern using a file but not passing points directly. If I just pass the double array it gets just the y values(strangely) and the x values are 0. If I wrap them then it just gets

0's ;/

Have you had any problems with passing arrays?

Some, usually with variants returned from functions.

I work in VB, and I'm not .NET yet. Don't know how much I can help.

Strangly enough it works now ;/ I just pass the array directly just as I did the first time ;/

Feature p = FeatureManager.InsertTableDrivenPattern("", points, true, false);

where points is simply a double array.

I had solidworks crash at one point and maybe that somehow corrupted something. In any case it seems to work. I did get the holes at least.

Thanks,

Jon

Hi jon. You can debug an add-in by simply putting a break line. When VS.Net 2008 breaks, make the changes you want and then press the play button again. Works on my machine.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required