Está en la página 1de 6

Solidworks – Mathcad User Guide

The Solidworks-Mathcad integration provides users with an opportunity to combine both
products, allowing Solidworks dimensions to drive Mathcad calculations. The results of
these Mathcad calculations can then be sent back to Solidworks to optimize the design.
The end users can select which configuration within the Design Table they wish to be
manipulating with these numbers.

This utility is a non-supported example of how Mathcad and Solidworks can be used in
conjunction, based upon each product’s supported API.

It was built and tested on windows XP-32, using Solidworks 2010 and Mathcad 15.It also
supports Solidworks 2011.

The integration is offered as a VB.NET DLL which implements the Solidworks AddIn
Class. This DLL uses both the Solidworks API and the Mathcad API to pass XML strings
between the 2 products.

Use Case Scenarios

1.) An engineer has design a model in Solidworks and wishes to do a quick analysis
to see if this design will buckle under a certain pressure. Mathcad is not an FEA
tool like Cosmos, but given height, width and length, Mathcad can do stress and
strain analysis to allow the designer to quickly understand if he/she has derailed
his design.

In this case the designer can send height, width and length dimensions to a pre-
built Mathcad worksheet. This worksheet will use the parameters to calculate the
allowable pressure and then perform a simple comparison to see if this allowable
pressure meets design criteria.

2.) This same designer would like to minimize or maximize the size of his/her model
while staying within the limits of buckling. The earlier Mathcad worksheet can be
extended to include constraint based optimization. The results of this optimization
would be a new height, width and length. These new dimension values can be sent
back to Solidworks to update the model.

3.) Many ad-hoc calculations are done throughout the course of a design. Mathcad is
the ultimate tool for documenting those calculations and even tying the results of
those calculations to the model in Solidworks. This documentation can be
submitted with the Solidworks model to whatever Document Management/PLM
system the user has installed.
4.) Some design engineers wish to use math equations to generate geometries. These
calculations can easily be done in Mathcad and the output data will be can be sent
to Solidworks.

How to install
1.) Register the Mathcad DLL using the regasm utility.

a. Open a command window.

b. Change the directory to your Microsoft.Net Framework version directory:

for example


c. At the command prompt, type the following command:

regasm C:\mathcad\mathcad_15.dll /codebase

where c:\mathcad represents the directory where your mathcad_15.dll file is


2.) Attach the Add-In to the Solidworks Interface through the Tools menu.

d. Using the Solidworks Tools  Add-Ins menu, check the box to select

e. Select “OK”.
3.) Verify that the Mathcad_15 menu item has been added to the Solidworks menu

How to prepare your Mathcad worksheet for use in the integration
The first step is to decide what model in Solidworks you want to tie to Mathcad

Once this is done, you need to think about what calculations you want to drive the model
you have in mind. Many pre-built calculations exist in Mathcad Libraries and Extension
Packs. Of course Mathcad allows you to build your own equations in natural math
notation with units on the terms or systems of linear and non-linear equations, or
optimization calculation and more.

OK, assume now we have our CAD model and we have our calculations in Mathcad.
Looking at the Mathcad worksheet, decide which variables you want to have driven by
the Solidworks model. Also decide which Mathcad variables you want to send to
Solidworks to modify the CAD model.

The Mathcad variables you want to have driven by Solidworks need to be tagged
as”SW2MC”. To do this simply right mouse click on the region, select properties. In the
TAG text box type (in capitols) SW2MC.

The dimensions you want to send to Solidworks from Mathcad need to be tagged
as”MC2SW”. To do this simply right mouse click on the region, select properties. In the
TAG text box type (in capitols) MC2SW.

Now your worksheet is prepped and the integration is ready to go. The tags must be set
before loading the Mathcad worksheet into the integration.

How to use the integration

To use the Solidworks-Mathcad integration, load the Solidworks model discussed earlier
into Solidworks. Under the Mathcad_15 toolbar menu select Mathcad and then launch the
Mathcad Properties Panel
Use the Load Mathcad Worksheet to launch Mathcad and load the appropriate worksheet.
Use the drop downs on the left to map values to the selected values in the drop down on
the right.

Use the Select Design Table dropdown to select which configuration of the loaded part
you wish have the integration interact with.

Use the 2 submit buttons to transfer from Solidworks to Mathcad or vice-versa.

With the example Mathcad worksheet and Solidworks CAD part provided try the
following mapping

Map : Solidworks Mathcad

D5@sketch1 w
D1@sketch1 d.b
D2@sketch1 d.r
D1@sketch4 z

Map : Mathcad Solidworks

new_db D1@sketch1
new_dr D2@sketch1
new_z D1@sketch4

Curves and Matrices

The curves and matrices you want to send to Solidworks from Mathcad need to be tagged
as”MC2SW”. To do this simply right mouse click on the region, select properties and in
the TAG text box type (in capitols) MC2SW.

Curves and Matrices need to be formatted into arrays of triplets.

Curves are simply 3 column matrices, each row being a xyz triplet The included
worksheet, matrix.xmcd, shows an example called sindata. You can see how we use the
Mathcad function augment to create the sindata 3 column matrix.

Curves with the TAG MC2SW will populate the “curves” drop down at the bottom of the
Mathcad Panel.

Matrices also need to be tagged MC2SW. Their formatting is a bit tricky. Each 3 columns
must represent a curve. You may have many columns depending on the number of
vertical lines in your surface. Each row must also represent x,y,z triplets representing the
horizontal lines in the surface.

You can see how we use an inline function called build_array to map your surface data
into spline triplets in the matrix.xmcd example included.

Select the curve or matrix you want created in Solidworks from the drop downs called
Curves and Matrices. After selecting a data set then click the send button.

When first trying curves and matrices, In Solidworks create a new part “3D
representation of a single design component”. Also use the zoom to fit or zoom to area in
Solidworks under View-<Modify to help see your data