solidworks >> SolidWorks Add-in DLL creation via Visual Basic

by Chris Dubea » Wed, 22 Feb 2006 23:05:20 GMT

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 >> SolidWorks Add-in DLL creation via Visual Basic

by Heikki Leivo » Thu, 23 Feb 2006 00:01:21 GMT


> 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 >> SolidWorks Add-in DLL creation via Visual Basic

by That70sTick » Thu, 23 Feb 2006 00:07:23 GMT

Not much of a reply, but...

< http://www.esoxrepublic.com/devtools> ;
An example of how it is done.

solidworks >> SolidWorks Add-in DLL creation via Visual Basic

by Chris Dubea » Thu, 23 Feb 2006 01:00:51 GMT

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 >> SolidWorks Add-in DLL creation via Visual Basic

by Chris Dubea » Thu, 23 Feb 2006 03:27:51 GMT

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



Never mind. I got it sorted out.

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

solidworks >> SolidWorks Add-in DLL creation via Visual Basic

by Chris Dubea » Thu, 23 Feb 2006 03:46:11 GMT

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

solidworks >> SolidWorks Add-in DLL creation via Visual Basic

by Heikki Leivo » Thu, 23 Feb 2006 04:33:28 GMT

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 >> SolidWorks Add-in DLL creation via Visual Basic

by Chris Dubea » Thu, 23 Feb 2006 21:43:15 GMT

On Wed, 22 Feb 2006 22:33:28 +0200, "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

Similar Threads

1. C++ DLL in visual basic 6 project

2. Converting SolidWorks VBA Forms to Visual Basic.NET Forms

Hi All,
Just wondering if anyone has had some experience with this that they
may be able to share.
I have moved VBA forms into VB6 before without any problems, but
VB.NET does not seem to recognise the frm or the frx files.
I am a novice at VB.NET so I'm hoping that I may be missing something.
I'm using SolidWorks 2003 & VB.NET Standard 2003.
TIA.
Shane

3. C/C++ calling via COM ActiveX Visual Basic DLL

4. How to add a mergefield to a blank document via visual basic

Hello,

I am trying to write an add-in with visual studio 2008 (visual basic) for 
Word2007 to let users build a mailmerg document template. In the second steo 
these mergefields should handle values from an active directory. To do this I 
would like to have a ribbongroup with some buttons in it. By pressing a 
button a mail merge field e.g. {MERGEFIELD firstname} should be inserted at 
the current cursor position.

I don't know how to use the Filed.Add method. Maybe someone has an example 
for me?

5. Adding Resource Assignments to a Task via MS Visual Basic .NET

6. How to convert Visual basic Macro in Project to a .dll/.exe as COM add-in

Can anyone help me on how to 

Take a Visual Basic set of macros currently stored in 
MSProject and convert them to a .ddl or .exe to then use 
as a COM add-in?

Do I need additional MS products over abd above the Visual 
Basic 6 that comes with MS Project.

I am running with MSProject 2000.

many thanks,

//ian

7. Programmatic access to visual basic project via Visual FoxPro - Excel

8. Editing the creation date in visual basic

Hello, first question, but I've been lurking for a while.  This is a great 
resource for people learning how to code by the way.

We receive an email every day and I've set up a VB script to run that saves 
the file with the creation date in the file name.  The problem is the 
creation date is T+1 the actual date of the attached file.  For example the 
script will save a file with 08.17.07 in the file name, but I actually want 
08.16.07.

Is there a way to edit the code to name the file with the creation date -1 
day to properly name the file?

Thanks a lot