Hide Table of Contents
Getting Started

Glossary Item Box

The SOLIDWORKS Toolbox Browser API is designed specifically to allow third-party PDMs to interact with the SOLIDWORKS Toolbox Browser and the Toolbox Configurator. The SOLIDWORKS Toolbox Browser API includes:

  

Use the SOLIDWORKS Toolbox Browser API to Access the SOLIDWORKS Toolbox Browser
  1. Set up a third-party PDM vault to contain the SOLIDWORKS Toolbox. See the PDM Administration Guide and the SOLIDWORKS Toolbox Help.
  2. Create a SOLIDWORKS add-in using one of the add-in templates in the SOLIDWORKS API SDK.
  3. In the add-in's ConnectToSW():
    1. Call ISldWorks::GetAddInObject, passing in the GUID of the SOLIDWORKS Toolbox Browser add-in type library (Registry Editor > Computer\HKEY_CLASSES_ROOT\TypeLib\{ED783340-D5DB-11d4-BD5A-00C04F019809}), to get a Dispatch pointer to the IApplication object and connect to the SOLIDWORKS Toolbox Browser.

      For example, in COM:

      LPDISPATCH pDisp = NULL;
      HRESULT hres = pSldWorks->GetAddInObject("{ED783340-D5DB-11d4-BD5A-00C04F019809}" , &pDisp); 

    2. Cast the Dispatch pointer to SOLIDWORKS.Interop.swbrowser.IApplication to gain access to the SOLIDWORKS Toolbox Browser API.
  4. Implement and attach to PDMDocManager event handlers that control access to the PDM-managed SOLIDWORKS Toolbox Browser part documents.
  5. Run the add-in. The SOLIDWORKS Toolbox Browser add-in is registered and loaded.
  6. Open a document in SOLIDWORKS.
  7. To open the SOLIDWORKS Toolbox Browser, select Toolbox from the SOLIDWORKS menu.
  8. The add-in connects to the SOLIDWORKS Toolbox Browser.

 

Use the SOLIDWORKS Toolbox Browser API to Access the SOLIDWORKS Toolbox Configurator
  1. Set up a third-party PDM vault to contain the SOLIDWORKS Toolbox. See the PDM Administration Guide and the SOLIDWORKS Toolbox Help.
  2. Create a SOLIDWORKS add-in using one of the add-in templates in the SOLIDWORKS API SDK.
  3. Use Microsoft Visual Studio 2010 Tools > Create GUID to create a GUID. 
  4. Add a class of type IToolboxConfiguratorAddin to the add-in, assigning the new GUID to the class.
  5. Implement all of the methods of IToolboxConfiguratorAddin.
  6. Implement and attach to PDMDocManager event handlers that control access to the PDM-managed SOLIDWORKS Toolbox Configurator part documents.
  7. In the add-in's Connect(), cast the return variable, pTbcApplication, to SOLIDWORKS.Interop.sldtoolboxconfigureaddin.IToolBoxConfiguratorApplication to gain access to the SOLIDWORKS Toolbox Configurator API.
  8. Debug the add-in. The Toolbox Configurator add-in is registered and loaded. 
  9. To open the Toolbox Configurator from SOLIDWORKS, select Tools > Options > Hole Wizard/Toolbox > Configure.
  10. The add-in connects to the Toolbox Configurator.
  11. In Visual Studio 2010 select Debug > Attach to Process > SldToolboxConfigure.exe.
Examples

Download from the SOLIDWORKS API Forum working add-ins that show how to use the SOLIDWORKS Toolbox Browser API to access the SOLIDWORKS Toolbox Browser, access the Toolbox Configurator, and handle PDM-managed documents. You must be a SOLIDWORKS subscription customer to access the SOLIDWORKS API Forum documents.

  1. Open https://forum.solidworks.com/docs/DOC-2301.
  2. Log in.
  3. Click API/Macros in the SPACES/GROUPS sidebar.
  4. Click API Examples in the QUICK LINKS sidebar.
  5. Click the Documents tab.
  6. Type "Toolbox Manager" in the search field.
  7. Locate and download the SOLIDWORKS Toolbox Manager Example (VB.NET, C#).

Back to top

SOLIDWORKS Toolbox Browser API Use Cases
Drag and Drop Standard SOLIDWORKS Toolbox Parts
  1. After the user releases the mouse button to drop a SOLIDWORKS Toolbox Browser part onto the assembly, SOLIDWORKS fires the FileDropPreNotify event, passing the path name of the dropped file.
  2. In the FileDropPreNotify event handler, the PDM application must call IAssemblyDoc::SetDroppedFileName, passing the path name of the PDM-managed version of the document (if it can be made writable) or a copy of the managed document that can be written to by SOLIDWORKS Toolbox Browser (if it cannot be made writable).
  3. If SOLIDWORKS Toolbox Browser determines that the dropped file needs to be written to, it fires the BeforeWritingToDocument event, passing the path name of the PDM-managed version of the dropped file.
  4. In the BeforeWritingToDocument event handler, the PDM application must ensure that the file that was previously passed to IAssemblyDoc::SetDroppedFileName is writable and call IPDMDocManager::SetDocumentStatus, passing swPDMStatus_e.swPDMStatusKnownAndAvailable. If the application passes any other status value, SOLIDWORKS Toolbox Browser generates an error and stops the file drop.
  5. After the application updates the document, SOLIDWORKS Toolbox Browser fires the AfterWritingToDocument event, passing the path name of the PDM-managed version of the document that was written to.
  6. In the AfterWritingToDocument event handler, the PDM application must copy the working document back to the PDM-managed location and change the file attribute of the PDM-managed version to read-only.
  7. SOLIDWORKS continues the file drop as usual.

Back to top

Insert SmartFastener
  1. After the user inserts a SmartFastener, SOLIDWORKS Toolbox Browser fires the PreInsertDocument event, passing the path name of the PDM-managed version of the SmartFastener.
  2. In the PreInsertDocument event handler, the PDM application must call IPDMDocManager::SetManagedDocument, passing the path name of the PDM-managed version of the document (if it can be made writable) or a copy of the managed document that can be written to by SOLIDWORKS Toolbox Browser (if it cannot be made writable).
  3. If it determines that the file needs to be written to, SOLIDWORKS Toolbox Browser fires the BeforeWritingToDocument event, passing the path name of the PDM-managed version of the file.
  4. In the BeforeWritingToDocument event handler, the PDM application must ensure that the file that was previously passed to IAssemblyDoc::SetDroppedFileName is writable and call IPDMDocManager::SetDocumentStatus, passing swPDMStatus_e.swPDMStatusKnownAndAvailable. If the application passes any other status value, SOLIDWORKS Toolbox Browser generates an error and stops the file drop.
  5. After the document is updated, SOLIDWORKS Toolbox Browser fires the AfterWritingToDocument event, passing the path name of the PDM-managed version of the file.
  6. In the AfterWritingToDocument event handler, the PDM application must copy the working document back to the PDM-managed location and change the file attribute of the PDM-managed version to read-only.
  7. SOLIDWORKS continues the insert as usual.

Back to top

SOLIDWORKS Toolbox Configurator API Use Case
Welcome to Toolbox Setup - Modify a Toolbox Part
  1. After the user clicks the Save button, SOLIDWORKS Toolbox Configurator fires the BeforeWritingToDocument event, passing the path name of the PDM-managed version of the SOLIDWORKS Toolbox part being edited.
  2. In the BeforeWritingToDocument event handler, the PDM application must try to unset the read-only attribute of the PDM-managed version of the Toolbox part. (If it can't, it must copy the part to a working file that can be written to and call IPDMDocManager::SetManagedDocument, passing the path name of the working document.) It must then call IPDMDocManager::SetDocumentStatus, passing swPDMStatus_e.swPDMStatusKnownAndAvailable before returning. If any other status value is passed, the SOLIDWORKS Toolbox Configurator generates an error.
  3. After SOLIDWORKS Toolbox Configurator updates the document, it fires the AfterWritingToDocument event, passing the path name of the PDM-managed version of the SOLIDWORKS Toolbox part being edited.
  4. In the AfterWritingToDocument event handler, the PDM application must copy the working document back to the PDM-managed location. It must also change the file attribute of the PDM-managed version back to read-only.  

Back to top



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Getting Started
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:




x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2019 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.