SolidWorks Add-in DLL creation via Visual Basic

Hi there,

I'm working on an application in VB which will be an DLL add-in for SolidWorks. I've got my project set up with my class file holding all the menu creation stuff needed.

It all works fine. And then I decided to get creative. I'm developing an application that will be customized with an XML file and may or may not include interfaces for all three SolidWorks documents. So I decided to read the XML file in my class file, and then set up the menu's and tool bars per the settings in the XML file.

The DLL builds just fine, but when I try to load it in SolidWorks it tells me it cannot be loaded, Either the Add-in or one of it's components is missing.

So the question of the day (hour?) Is there a limitation to what you can do in the class file which sets up the menus and toolbars and then calls the form?

Thanks =========================================================================== Chris

Reply to
Chris Dubea
Loading thread data ...

The problem is that an unhandled error occurs either in the Class_Initialize or in SwAddin::ConnectToSW method. To find out what goes wrong you have to debug your application. Put a breakpoint in the mentioned methods, hit Run -> Start and start solidworks, then step through the code to find out what goes wrong.

You should perform error handling in every sub or function to prevent any unhandled errors.

-h-

Reply to
Heikki Leivo

Not much of a reply, but...

An example of how it is done.

Reply to
That70sTick

Okay that makes sense. Thanks.

Let's review the debugging issue a bit if we can. I've done this in the past but can't for the life of me get this to work.

Can you be MUCH more specific about how to make this work? =========================================================================== Chris

Reply to
Chris Dubea

Never mind. I got it sorted out.

Thanks =========================================================================== Chris

Reply to
Chris Dubea

And I got my functionality to work. It's amazing how hard it is to write code without being able to use the debugger ;>

Thanks a lot. =========================================================================== Chris

Reply to
Chris Dubea

Hello Chris,

Well I dont' know how much specific I can be, but I'll try. You just have a bug eg. erroneous line of code in your code and you have to fix it, there is no more sophisticated way than debugging. In your addin class module, find the function named ConnectToSW. Select the first statement eg. row of code in the function and hit F9 to toggle a breakpoint on that line. Then hit F5 to start the add-in. Start SolidWorks and the code execution breaks on the breakpoint, and after that you can run the code row by row by hitting F8. Select View -> Locals to see the current values of your local variables. Try to find the row which causes an error, and then fix the code. This process is called de-bugging. You can also right-click the code and select Toggle -> Break on all errors, so you don't have to put a breakpoint but instead the code breaks automatically on a row which causes an error.

Hope this helps!

-h-

Reply to
Heikki Leivo

Thanks. I got the debugger and my application working. I'm doing beta testing (with a few brave individuals) and then I will release my Custom Property tool on the world!!!

=========================================================================== Chris

Reply to
Chris Dubea

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.