|On this page…|
In the following procedures, replace:
matlabroot with the root of your MATLAB® installation.
ARCH with the specific operating system architecture abbreviation for your system (for example, win32 for 32-bit Windows).
To write your C/C++ custom exporter module, use the C header file located in matlabroot/toolbox/physmod/smlink/api/include/.
This header file contains the function definitions that you follow to call the SimMechanics™ Link API functions from your module. Include this header file in your module C/C++ source code.
In addition to linking your custom module to the SimMechanics Link API, consult your CAD platform's API documentation to determine requirements for linking to the platform's API.
OS-SPECIFIC-EXTENSION is the API file extension specific to your operating system.
To determine if you need to include your CAD platform API on the path, consult your CAD platform API documentation.
You can find API examples in this folder:
The subfolder, cadapi_example/, contains CAD-based examples.
The folder matlabroot/toolbox/physmod/smlink/api/example/cadapi_example/ contains a simple C++ example of a custom module based on the API, cadapi_example.cpp.
The example custom module converts two CAD parts with one constraint into two SimMechanics bodies and one joint and then writes the result to a Physical Modeling XML file.
The example program defines the CAD assembly data internally, rather than taking the data from a CAD platform through the platform API. Compared to the figure, Custom Exporter Module Communicates with APIs (Detail) preceding, the leftmost portion of the diagram is missing.
To extend the example module to process real assembly data, add code that calls a CAD platform's API for assembly data to replace the internally defined data.