The SolidWorks Document Manager is a standalone software component that allows SolidWorks documents to be read and written. Interfaces and configurations for the document are included with the software. Both read-only and read-write methods and properties are available on these interfaces. You can create software using the SolidWorks Document Manager API to rename, replace, and copy SolidWorks documents, among other file management tasks. Only data types that comply with automation standards are supported by COM-compliant software. It enables you to create your application without directly reading or writing binary data to the SolidWorks file header. Using this API does not require that SolidWorks be installed on your computer. The SolidWorks Document Manager API does, however, require acquiring a license key. Continue reading to learn more about what is and how to use the SolidWorks Document Manager API.
Remember that the SolidWorks Document Manager API is only intended to be used as an example in all the sample code provided, which is given as-is. Neither SolidWorks nor its affiliates make any claims or guarantees regarding these samples. A royalty-free, non-exclusive license is granted for these samples, in whole or part, to any licensed user of the SolidWorks Document Manager API to use any or all of them in connection with developing applications that use the SolidWorks Document Manager API. SolidWorks retains ownership of the samples’ intellectual property rights. The models are subject to confidentiality provisions of the SolidWorks Document Manager API license. Some sample codes may use outdated APIs.
You also need to pay attention since the SolidWorks Document Manager API is a robust programming tool that, if misused, may corrupt your data. The SolidWorks Document Manager API should only be used by experienced API programmers familiar with SolidWorks document references. Before running your application, it is recommended that you make a backup copy of any files that it will access.
Getting Started on Solidworks Document Manager API
The SolidWorks Document Manager API is included by default with the SolidWorks installation. This article will help you understand what is and how to use the SolidWorks Document Manager API.
Only SolidWorks customers enrolled in a subscription can access the license key needed for the SolidWorks Document Manager API via the SolidWorks customer portal. A license key is necessary for every SolidWorks Document Manager API user. When installing any new major version of SolidWorks or the SolidWorks Document Manager API, current users must apply for new SolidWorks Document Manager API license keys.
The Document Manager API verifies the file version. If you create a file with the same or an older iteration of SolidWorks than the license key, the SolidWorks Document Manager API could access it. The SolidWorks Document Manager API cannot access a file created using a later version of SolidWorks than the version for which the license key was issued. The user is informed that the latest SolidWorks Document Manager API license key has expired.
When you apply for or renew a SolidWorks Document Manager API license key, a dialog box displays a list of checkboxes indicating the functional categories that the license key controls appear. You can choose more than one category.
- Basic: Except for those listed below, all interfaces, methods, and properties are basic.
- Previews: On all ISwDMConfiguration, ISwDMDocument, and ISwDMSheet interfaces, you can preview and stream methods and properties.
- DimXpert methods and properties are available on all ISwDMConfiguration and DimXpert-related interfaces.
- Geometry Streams: On all ISwDMConfiguration interfaces, you can preview, stream, and import body methods and properties.
- XML Streams: All ISwDMDocument interfaces have XML stream methods.
- Tesselation: Despite not being a part of the SolidWorks Document Manager API, the Display List DLL (previously known as the Display List Sample) is accessible with a license key.
To obtain a SolidWorks Document Manager API license key, follow the steps below:
- Enter the SolidWorks customer portal.
- In My Support, select API Support.
- Select Document Manager Key Request from the drop-down menu.
- Get your license key by following the online instructions.
After your request is approved, the SolidWorks organization will email you a SolidWorks Document Manager API license key. You mustn’t give this license key to anyone outside your business or ship it with any other software. You must include the license key when creating a SolidWorks Document Manager API connection. For more information, see Application Fundamentals.
The SolidWorks Document Manager API requires the following requirements or specifications from your computer or workstation:
- The Visual C++ Redistributable 2015 version installs the runtime components of the Visual C++ libraries. The SolidWorks Document Manager 2018 DLL, created using Visual Studio 2015, must be successfully registered for it to function.
- MSXML 4.0 or later; the first MSXML version to support 64-bit processors is MSXML 6.0. The only requirement for using ISwDMComponent or ISwDMComponent2 is MSXML. MSXML can be downloaded at www.microsoft.com.
A complete SolidWorks 2018 installation includes MSXML and the Visual C++ Redistributable for 2015 Visual Studio. The Visual C++ Redistributable and MSXML must also be installed, or they must already be installed, if the client is installing SolidWorks Document Manager on a system without a complete SolidWorks installation.
Before beginning the software installation process, you should read the software requirements and confirm that your computer complies with them. The SolidWorks Document Manager DLLs must be successfully registered, which requires the installation of MSXML and the Visual C++ Redistributable for 2015 Visual Studio.
SwDocumentMgr.dll contains the COM object SolidWorks Document Manager API. DimXpert.dll contains the API for the SolidWorks Document Manager. If you put the SolidWorks program on your computer, the zlib.dll DLL is automatically put in the following folder:
<disk>:\Program Files\Common Files\SolidWorks Shared
If you installed the SolidWorks software, SwDocumentMgr.dll and dimxpert.dll were also automatically registered.
You can manually register these APIs if you still need to install SolidWorks on the system where you wish to use them.
Zlib.dll and SwDocumentMgr.dll must be in the same folder or found on the Windows search path.
Manually registering SwDocumentMgr.dll requires
- Start, then Run.
- Enter regsvr32 in the dialog box “<disk>: SolidWorks SharedSwDocumentMgr.dll in Program FilesCommon Files”
- Select OK.
- Click OK once more.
NOTE: Installing software can register the DLL for you automatically. An example of this is InstallShield. You can use the same steps above for registering SwDocumentMgr.dll to unregister it manually.
Follow these steps to register dimxpert.dll manually:
- Choose Start and select Run.
- In the dialog box, you should type (vX.X is the name of a version directory that contains RegAsm.exe):
- C:\WINDOWS\Microsoft.NET\Framework\vX.X\regasm /codebase “<disk>:\Program Files\Common Files\SOLIDWORKS Shared\dimxpert.dll
- Select OK.
Writing a SolidWorks Document Manager application typically entails the following steps:
- Setting up a connection to SolidWorks Document Manager. For the application object to be instantiated, you must have a license key from SolidWorks Corporation.
- Opening a document.
- Searching the file for unique properties, settings, references, and usage information
- You can extract XML data and Parasolid bodies from assemblies.
- Analyzing DimXpert parts to extract features and annotations.
Your applications will work more efficiently once you understand what is and how to use the SolidWorks Document Manager API. SolidWorks files can be accessed using the SolidWorks Document Manager APIs without opening the files in SolidWorks. You should be aware that versions affect how the SolidWorks Document Manager API functions. The SolidWorks Document Manager API could access the file if made with the same or an earlier version of SolidWorks than the license key for that version.