SolidWorks Add-in DLL creation via Visual Basic

SolidWorks Add-in DLL creation via Visual Basic

Post by Chris Dube » Fri, 24 Feb 2006 00:05:20


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
 
 
 

SolidWorks Add-in DLL creation via Visual Basic

Post by Heikki Lei » Fri, 24 Feb 2006 01:01:21

> So the question of the day (hour?) Is there a limitation to what you

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-

 
 
 

SolidWorks Add-in DLL creation via Visual Basic

Post by That70sTic » Fri, 24 Feb 2006 01:07:23

Not much of a reply, but...

< http://www.yqcomputer.com/ ;
An example of how it is done.
 
 
 

SolidWorks Add-in DLL creation via Visual Basic

Post by Chris Dube » Fri, 24 Feb 2006 02:00:51

On Wed, 22 Feb 2006 18:01:21 +0200, "Heikki Leivo"



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
 
 
 

SolidWorks Add-in DLL creation via Visual Basic

Post by Chris Dube » Fri, 24 Feb 2006 04:27:51

On Wed, 22 Feb 2006 11:00:51 -0600, Chris Dubea



Never mind. I got it sorted out.

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

SolidWorks Add-in DLL creation via Visual Basic

Post by Chris Dube » Fri, 24 Feb 2006 04:46:11

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

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

SolidWorks Add-in DLL creation via Visual Basic

Post by Heikki Lei » Fri, 24 Feb 2006 05:33:28

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-
 
 
 

SolidWorks Add-in DLL creation via Visual Basic

Post by Chris Dube » Fri, 24 Feb 2006 22:43:15

On Wed, 22 Feb 2006 22:33:28 +0200, "Heikki Leivo"




Thanks. I got the de *** 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