Addins

Discussion in 'SolidWorks' started by fred, Dec 15, 2003.

  1. fred

    fred Guest

    I have just used the Solidworks wizard to try and create an addin for
    Solidworks but I think I need some help.

    I created a VB.Net Add-in using the SolidWorks VB.Net Add-in Wizard in
    Visual Studio 2003. It created the Addin just fine. I have added a Windows
    form to that Addin and so far so good. But what now.

    The Wizard has created the an Addin folder under the SolidWorks folder and
    has added the DLL to that directory.
    How do I get that form to run in Solidworks?
    I tried to register the DLL using regsvr32 but I get an error saying that no
    entry point was found in the DLL. Am I supposed to register this DLL?
    Again what do I need to do to get the form to run in solidworks.

    Thanks
    Fred
     
    fred, Dec 15, 2003
    #1
  2. SW needs some registry entries to identify & load your addin.
    Check "Using SwAddin to Create a SolidWorks Add-In" in apihelp 2004
    SW creates the entries for you automatically if you:
    - load the addin dll in SW (yes, there is a *.dll file type you can
    "load"...)
    -or- drag & drop the .dll file on an empty SW frame
    You'll need to do this only once, of course.
    If you intend to distribute your addin, your installer program will have to
    create the entries.
     
    Philippe Guglielmetti, Dec 15, 2003
    #2
  3. fred

    fred Guest

    Thanks Philippe,

    I managed to get to work on my computer by dragging the dll into Solidworks.
    It now works fine on my PC but now I want to run it on one other PC.

    I tried copying all of the files created by the wizard that were in my
    ..\solidworks\Addins folder to the other PC, also in its .\SolidWorks\Addins
    folder. I then dragged the dll into SolidWorks but it didn't work. I also
    tried File|Open the dll file but it did not register, nor did I get any
    error message.
    I tried using: regsvr32 "C:\Program Files\SolidWorks\Addins\SwVBAddin1.dll"
    but that failed as well.

    Any Ideas why this would fail.

    Also, how do I unregister an Addin from Solidworks? I know I can uncheck the
    checkbox to prevent it from loading but how do I remove it from the Addin
    list.

    Thanks
    Fred
     
    fred, Dec 16, 2003
    #3
  4. As I said :
    "SW needs some registry entries to identify & load your addin.
    Check "Using SwAddin to Create a SolidWorks Add-In" in apihelp (...)
    If you intend to distribute your addin, your installer program will have
    to create the entries."

    If you deploy your add-in in your own organization, maybe a .reg file is
    enough :
    Below is an example : copy the lines between the ---- in a text file. Name
    it "something.reg"
    Replace the E1769... code with the CLSID of your own add-in, change the
    description and title. Double click the file to insert its content in
    registry...
    To remove the add-in, you'd need to remove the entries. This is typically
    done with an installer/uninstaller program. I use www.ginstall.com .
    Remember that .NET add-ins require .NET Framework to be installed on target
    machines...
    ------------
    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Solidworks\AddIns\{E1769FB3-7CFE-4882-A739-CEF9
    250AF7D0}]
    @=dword:00000001
    "Description"="SolidPlus AddIn"
    "Title"="SolidPlus"
     
    Philippe Guglielmetti, Dec 16, 2003
    #4
  5. fred

    fred Guest

    Thanks again Philippe. I only want to install this on two PCs so I am not
    too interested in buying an installer.

    To get the CLSID I presume I still need to register it using regsvr32 which
    does not seem to work for me.
    Perhaps this is because of the .NET Framework. I am installing on a PC
    running XPPro. Doesn't XPPro come with the .NET Framework installed?

    Sorry for my ignorance but this is all new to me.

    Thanks
    Fred
     
    fred, Dec 16, 2003
    #5
  6. some are free... and you'll need one to do clean uninstalls...
    the CLSID is the same as the "Guid" which is generated by the sw addin
    wizard and can be found in your source code.
    ..NET uses regasm.exe instead of refsvr32. Use a command like:

    regasm myTest.dll /regfile:myTest.reg

    to generate a .reg file that you can merge with the one I described earlier.
    All you have to do then is to "run" this .reg file on the target machine.
    No, it doesn't. Use "Windows Update" or the 1st disk of your VisualStudio to
    install the Framework.
    Note that your simple add-in will weight at least 37 Mb only because of
    this, which partly explains why .NET is not widely used for SW add-ins yet.
    "Smile, tomorrow will be worse..."
     
    Philippe Guglielmetti, Dec 16, 2003
    #6
  7. fred

    fred Guest

    Thanks again for all of your help Philippe, but I still haven't had much
    luck.
    I installed the .NET Framework on the other PC then tried to add the addin
    to Solidworks by just dragging in the addin.
    This time it did seem to register something but nothing that works. In the
    SW Addin list I now have an extra check box without a title. If I check that
    check box I get an error message saying that SW can't run the addin yet this
    is the same addin I am using on my PC.
    Any other ideas.

    Thanks
    Fred
     
    fred, Dec 17, 2003
    #7
  8. well, if your addin works fine on once PC and not on the other one, it can
    be:
    - differences in the registry. check with regedit, make sure you used
    regasm...
    - differences in used DLLs (.NET was supposed to avoid the dll-hell...)
    That's why addins are installed by installers, and why it is a (hard) job to
    develop addins...
    Sorry, maybe someone else knows better, but your posts confirm my intuition
    that .NET isn't ready for such uses...
     
    Philippe Guglielmetti, Dec 17, 2003
    #8
  9. You could try using Windows Installer to distribute your dll with the
    supporting libraries and files. I think if you already have Visual Studio
    (.NET or other) you can download and use WI for free from Microsoft. There
    is a help file that comes with it, but basically it should automatically
    determine what supporting files are needed (in some cases you have to help
    it a little). It can register not just your dll but also the supporting ones
    that your project references without hassling with registrations on the
    target computer.

    http://www.microsoft.com/msdownload...download/platformsdk/sdkupdate/psdkredist.htm

    Make sure that all the files you need are in the list. Those that are part
    of the "protected" windows system files will not get copied to the new
    machine, but the others should be. Make sure that anything special or
    unusual that your project references gets included in this list. You might
    also want to check the register property of each of these files if the first
    attempt doesn't seem to do it. Click build and it will create an
    installation file in the location you chose. You will end up with a file
    that has an msi extension. The other user double-clicks this file to
    install, and it should be automatic from there.

    Another approach to try anyway...
    Brenda
     
    Brenda D. Bosley, Dec 17, 2003
    #9
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.