SolidWorks Add-in DLL creation via Visual Basic

Discussion in 'SolidWorks' started by Chris Dubea, Feb 22, 2006.

  1. Chris Dubea

    Chris Dubea Guest

    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
     
    Chris Dubea, Feb 22, 2006
    #1
  2. Chris Dubea

    Heikki Leivo Guest

    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-
     
    Heikki Leivo, Feb 22, 2006
    #2
  3. Chris Dubea

    That70sTick Guest

    That70sTick, Feb 22, 2006
    #3
  4. Chris Dubea

    Chris Dubea Guest

    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
     
    Chris Dubea, Feb 22, 2006
    #4
  5. Chris Dubea

    Chris Dubea Guest

    Never mind. I got it sorted out.

    Thanks
    ===========================================================================
    Chris
     
    Chris Dubea, Feb 22, 2006
    #5
  6. Chris Dubea

    Chris Dubea Guest

    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
     
    Chris Dubea, Feb 22, 2006
    #6
  7. Chris Dubea

    Heikki Leivo Guest

    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-
     
    Heikki Leivo, Feb 22, 2006
    #7
  8. Chris Dubea

    Chris Dubea Guest

    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
     
    Chris Dubea, Feb 23, 2006
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.