Engineering Calculations With C - Martin, David
Engineering Calculations With C - Martin, David
We can have our Creo Parametric parts and assemblies send inputs
to our PTC Mathcad Prime worksheets.
Our worksheets perform their calculations. Results designated as
outputs are sent back to the Creo Parametric models.
In Creo Parametric, Relations are used to drive model dimensions
and parameters.
Upon regeneration, the geometry updates accordingly.
Changes to inputs result in changes to outputs, updating our models. This
again is the heart of Design Intent.
1.6. Feedback
Thank you, and I hope you enjoy reading this book.
Feel free to reach out to me at [email protected] with any
questions, comments, and suggestions.
Figure 1‑1: Creo Parametric Help Mathcad Tutorial.
Chapter 2. Quick Example
2.1. Introduction
In this chapter we are going to dive right into a quick example that you can
perform to see the basics of Creo Parametric – Mathcad integration.
We are going to investigate optimizing the volume held by a container with
an open top for a given amount of material. Think of a brown paper shopping
bag like the kind you get at the grocery store. What would be the dimensions
of the bag that would optimize the volume the bag could hold, given a
specified amount of paper?
I performing this example in Creo Parametric 7.0 and Mathcad Prime 6.0
using English units. You can use any version of Creo Parametric with a
compatible version of Mathcad Prime using metric units. You can use
different dimension values than I do, since this is intended as a generic
problem to solve.
The exercise will go through the following:
2. Click File > New or the New icon to create a new part.
a. Ensure that the radio buttons for Part and Solid are
selected.
b. Enter a File name and Common name of your choosing.
c. Uncheck Use default template and click OK. (We are
doing this to use a start part in English units, but feel free
to use a model with metric units.)
3. In the New File Options dialog box, select a default template that
uses English units.
Figure 2‑2: Selecting the new part's template.
Note: this image depicts my personal start parts. You may need to use the
Browse button to select an appropriate start part. The start parts provided by
PTC are located in <loadpoint>\Common Files\templates.
4. Select the datum plane TOP (from the Model Tree or Graphics
8. Select the Extrude feature in the Model Tree and click the Edit
tool.
a. Select the top surface to remove.
Define values for surface area, length, width, and height. (The
surface area will later be tagged as an input to be received from
Creo Parametric.)
Define functions to calculate the surface area and volume.
Use the Solve Block construct to solve for the optimized volume.
Evaluate the results.
Tag the evaluated length, width, and height as outputs to be sent
back to Creo Parametric.
We will document our calculations and method as we create our worksheet. I
strongly recommend this. It will make your worksheets user friendly to
others. Trust me, I have opened worksheets I created years before, and
without documentation, I have wasted unnecessary time deciphering my
previous thought processes.
Perform the following steps to create the PTC Mathcad Prime worksheet:
Figure 2‑6: Mathcad worksheet Text Block and Text Box for documentation.
4. Create math regions to define the surface area, length, width, and
height. Type in the names of the variables and use the Definition
operator := from Math > Operators. The keyboard shortcut is the
colon key : on the keyboard. Add Text Boxes as necessary for
additional documentation.
Figure 2‑7: Mathcad Definitions.
5. Use math regions to define functions for the material surface area
and volume as a function of length, width, and height.
6. Click Math > Solve Block. This will place a Solve Block
construct on the sheet that we will use to calculate the values of the
length, width, and height that will result in a maximum volume.
a. Leave the Guess values area empty.
b. Click in the Constraints and Solver areas and type in the
following:
Figure 2‑9: Solve Block to optimize volume.
Hints:
7. Evaluate the results for length, width, and height. These values
will be sent back to Creo Parametric as outputs.
Figure 2‑11: The Mathcad Input/Output Designation dialog box with the length output.
Figure 2‑12: The Input/Output Designation dialog box with the renamed alias.
Note: the name of the alias cannot be the same as the name of
any variables in the Mathcad worksheet.
6. Repeat step 5 for the width and height evaluation math regions.
The Input/Output Designation dialog should look as follows:
Figure 2‑13: The Input/Output Designation dialog with all outputs and renamed aliases.
7. Click the Save and Push icon in the Quick Access Toolbar in
the upper right corner. The keyboard shortcut is CTRL and S.
Figure 2‑15: The Save and Push command in the Quick Access Toolbar.
11. Click Tools > Parameters. Change the Look In drop-down list
from Part to Embedded Mathcad. You should see the
height_opt, length_opt, and width_opt outputs from PTC Mathcad.
When finished reviewing them, click OK to close the dialog box.
Figure 2‑18: Creo Parametric Parameters dialog box with Mathcad outputs.
12. Click Tools > Relations. Select Extrude 1 from the Model Tree.
You should see the length, width, and height dimensions in the
Graphics Area.
Figure 2‑19: The Relations dialog box in Creo Parametric.
19. Select Show as List. The Input/Output Designation dialog box will
open. Review the information and close the Input/Output
Designation dialog box.
Figure 2‑25: The Input/Output Designation dialog box with inputs and outputs.
20. Click the Save and Push icon from the Quick Access
Toolbar, or use the keyboard shortcut CTRL-S.
21. Click OK from the Pushing values dialog box.
e. Click OK.
27. Click Input/Output > Update Inputs. Click Save and Push
.
28. Click OK from the Pushing values dialog box.
29. Close the worksheet.
Our Creo Parametric part model now has an embedded worksheet to drive its
geometry.
2.4.1. Updating the Model & Worksheet and Flexing the Model
Whenever you are working in Creo Parametric, and especially when you are
using Mathcad worksheets to drive your geometry, you want to test that your
model updates appropriately when you make changes. This is called “flexing
the model.”
The same process will be followed to update our models and worksheets.
Perform the following steps:
1. Launch Creo Parametric and open the part you created in section
2.2 if necessary.
2. Click Tools > Parameters. Change the SA parameter from 2500
to 3500. Click OK.
3. Click Model > Regenerate or CTRL-G.
4. Note the Model Notification in the lower left corner of the screen.
5. Click on the yellow flag. Optional: open and close the Notification
Center.
Feel free to test this process with additional values for the surface area.
10. Since our Mathcad worksheet already exists, click the Load File
button. In the Select Prime worksheet dialog box, navigate to
where you saved your worksheet from section 2.3, select it, and
click Open.
11. The PTC Mathcad Prime may come to the front of your computer
screen. Minimize it or move it to a second monitor if you have
one.
12. In the Prime Analysis dialog box in Creo Parametric, under the
“Creo Parametric to Prime” section, click the Auto-map button.
Since the Creo Parametric parameter and Mathcad input have the
same name, they are automatically mapped.
13. Under the “Prime to Creo Parametric” section, click the plus sign
14. Click the Compute button to ensure the inputs and outputs are up
to date.
15. Click the Add Feature button. Type in a name for the Prime
Analysis feature and hit the check mark or ENTER key.
16. Notice the feature is now in the Model Tree. Click the Close
button in the Prime Analysis dialog box. The PTC Mathcad Prime
application will close automatically.
17. Click Tools > Parameters. Change the Look In drop-down list
from Part to Feature and select the Prime Analysis feature you
just created from the Model Tree. Note the parameters that are now
available.
g. Click OK.
5. Optional: Select Extrude 1 in the Model Tree and click the Edit
3.2.2. Limitations
Mathcad Express lacks the following capabilities compared to the full
commercial license:
Spell checking.
The ability to add Hyperlinks to text.
Custom margins, headers, and footers.
A full list of the differences between PTC Mathcad Express and PTC
Mathcad Prime can be found at:
https://www.mathcad.com/en/capabilities/comparison-chart
The Graph Paper interface. This is where you create your math
and text regions. You can change this to a whiteboard interface
from the Document tab and de-selecting Show Grid.
Figure 3‑1: The Mathcad Prime interface toolbar.
These functions are also available in the Algebra group from the Operators
drop-down on the Math tab. Using the standard forward slash for division
will provide you with a numerator and denominator. You can use inline
division from the Operators drop-down or the keyboard shortcut of the
Control key CTRL and the forward slash.
To apply an exponent, use either the Exponentation operator in the Algebra
group from the Operators drop-down on the Math tab, or the keyboard
shortcut of the SHIFT key and 6 – which is also known as the caret or hat
key. Again, this is real, intuitive math notation.
To control the order of operations when performing math, you can use
parentheses. Typing an open parenthesis (the SHIFT key and 9) will generate
both the open and closed parentheses on your worksheet for typing your
mathematical expression.
Both Text Blocks and Text Boxes can be dragged and moved at any time.
Recommendation: use a Text Box to explain new variables and
functions that you introduce.
You can also use the Image command from the Regions group
on the Math tab to insert picture files in your worksheet to add another level
of clarity to your engineering calculations.
Figure 4‑3: Examples of the Definition Operator for variables and functions.
There are other kinds of equals signs, which are of less use when integrating
Mathcad with Creo Parametric. These include:
The ORIGIN special variable for defining the index of the first
column and row of a vector or matrix.
A custom unit.
A constant that you want used throughout your document.
The Symbolic Evaluation operator is available from Math > Operators and
is found in the Evaluation and Definition group. It looks like an arrow
pointing to the right and the keyboard shortcut is the CTRL key and a period.
The Symbolic Evaluation operator will not be used further in this book.
4.4. Variables
A variable is a placeholder for a number, mathematical evaluation, or other
expression to be evaluated or used in other expressions.
All variables have a name defined by the user, and the names must conform
to the following rules and conditions:
Variable names can consist of upper- and lower- case letters from
the English or Greek alphabets.
Variable names can also contain the Hebrew letters Alef, Bet,
Gimmel, and/or Dalet. These characters are available from the
Symbols drop-down in the Operators and Symbols group on the
Math tab. These characters do not have pre-defined shortcuts.
The numbers 0 through 9, as long as a number is not the first
character in the name of the variable.
The keyboard shortcut for the Matrix Index operator is the left bracket
character [, located next to the letter P on standard keyboards.
Avoid confusion by using different letters and names for different variables
with subscripts and matrix indices.
4.5. Functions
A function is a defined operation that performs math on inputs and returns an
output. The outputs can be real numbers, imaginary and complex numbers,
strings, vectors, and matrices.
In PTC Mathcad there are two different kinds of functions that you can use:
Differential Equations
File Access
Solving
Statistics
Vector and Matrix
If you click on the All Functions icon, a panel will open on the
left side of the screen listing all the functions grouped into 32 categories.
Popular categories include:
String editing.
Interpolation and Prediction
Log and Exponential
Trigonometric functions such as sine, cosine, and tangent.
The Functions bar can be switched to list functions alphabetically instead of
by category. It also contains a search field.
Equal to.
Not equal to.
Greater than.
Greater than or equal to.
Less than.
Less than or equal to.
In addition, you can use Logical AND, NOT, and OR operators from the
Comparison group in the Operators drop-down on the Math tab to modify
the conditions you are evaluating.
To specify the starting and stopping indices, use the Range Variable. Type in
the starting index and then hit the period key twice. A placeholder will be
created where you can enter the stopping index.
Lightest weight.
Maximum interior volume.
Thinnest walls for specified strength requirements.
Highest margins or factors of safety.
Minimum number of fasteners.
An optimized product can often be directly related to lower costs and higher
customer satisfactions. A plastic injection molded part optimized for lightest
weight means less material per unit, and therefore lower raw material costs
for our supply chain. When I was a business traveler, I had a 15-pound
laptop. I was much happier when my company upgraded me to a lighter yet
more powerful model.
6.2. Functions
The functions maximize and minimize are used for optimization. The values
passed to the function are:
6.3. Vectors
In the Solver field of the Solve Block, you will use a vector as part of the
optimization.
A vector is an array of values arranged in a single column. Vectors are
created from the Matrices/Tables > Insert Matrix command. (A vector is a
matrix with a single column.) Hover your mouse over the desired number of
elements and click the left mouse button.
For the purposes of optimization, the elements of our vector are the variables
to be optimized.
PTC Mathcad Prime contains extensive functionality for vectors and
matrices. That information is beyond the scope of this book.
6.4. Solve Blocks
To start a Solve Block, click Math > Solve Block. The following construct
will be created for you automatically on the sheet:
Given Values: Suggest guess values for the variables for which
you are trying to solve. If your variables already have values from
Definition math regions, you do not have to enter them here.
Constraints: Enter math regions using Comparison operators that
define the constraints for the optimization. This will include:
Variables or functions that have to achieve certain
values.
Output variables that have to be above, below, or within
certain values.
Solver: this part of the construct will have:
The variable or vector of variables for which you are
trying to solve.
A Definition operator.
The minimize or maximize functions. The inputs are the
function that you are trying to optimize and the
function’s input variables.
As seen in chapter 2, a Solve Block was used to find the maximum volume
that could be contained in an open top container with a given surface volume:
Over time. you will most likely memorize the keyboard shortcuts you use
most often.
You may want to use the rounding functions to change the outputs of certain
variables before you send them back to Creo Parametric. For example, you
may want to create a new variable that rounds the result of an optimization,
and then designate this new variable as the output to Creo Parametric.
Be careful using this functionality; if you forget the password, there are no
means to unlock the password protected areas.
Change from the Page View to the Draft View on the Document
tab.
Break the math region. (This was implemented in PTC Mathcad
Prime 4.0.)
To break an equation, you have a couple choices:
While writing the equation, use Math > Operators and select the
appropriate Equation Break operator. Each has its own keyboard
shortcut, which is the operation you are trying to perform
(addition, subtraction, multiplication, or division), but with the
CNTRL and SHIFT keys held down.
After clicking outside of the equation, select an addition,
subtraction, multiplication, or division operator in the math region
and click Math > Equation Break (located in the Style group).
Figure 7‑6: Location of the Equation Break operators.
The Help Center includes math regions that can be copied and
pasted directly into your worksheet.
Sample worksheets on the PTC website.
Starting in Mathcad Prime 4.0, users can purchase a library based
on Roark’s Formulas for Stress and Strain.
8.3. Parameters
In addition to dimensions, in Creo Parametric we can create parameters for
additional information that we want to capture in our models or that we want
to help drive our models. Examples of parameters include:
Integers. These are whole numbers. For example, you can use
integer parameters to control the number of instances in a pattern.
Real Numbers. These are numbers that can include a decimal
point.
String. These are parameters that can contain text.
Yes / No. For example, you could have a parameter for
Commercial Off The Shelf (COTS) components.
Only Integer and Real Number parameters can be passed from Creo
Parametric to PTC Mathcad Prime.
8.4. Relations
In Creo Parametric, often we want to write equations in our model so that if
some dimension or quantity changes, then other dimensions or quantities
change automatically. For example, we may want:
8.5. Regeneration
Creo Parametric models are history-based. Your geometry is dependent on
the order in which features appear in the Model Tree. That order determines
how your model regenerates, or how Creo Parametric builds your model.
Creo Parametric automatically regenerates your model in many situations:
Upon retrieval.
After creating or editing the definition of new features.
After editing the dimensions of features.
However, there are situations in which you will have to regenerate your
model manually. The potential causes are too varied to be listed here, but
often result when you have both properly- and improperly- constructed
dependencies between models and features. In these situations, you will see
the following indication in the lower left corner of the screen:
Figure 8‑4: Regeneration notification in the lower right corner.
The keyboard shortcut for regeneration is the Control key CTRL and the
letter G.
(In Mathcad, this keyboard shortcut will convert letters from the English
alphabet to their Greek letter equivalent. If you’re wondering why the
keyboard shortcut in Creo Parametric for regeneration is not the Control key
CTRL and the letter R, that’s because that combination is the shortcut for
repainting the screen. That updates the display of the Graphics Area, in cases
such as something still appears selected after you’ve de-selected it, or
dimensions are displayed on screen after you’ve completed an editing
operation.)
Sometimes changes to your model result in geometry that cannot be
constructed properly. This results in a regeneration failure. The features that
are failing appear in bold red in the Model Tree, and children of those
features appear in a fainter red.
Which notifications appear in the Notification Center and how they appear
can be configured during your session from File > Options > Notification
Center:
Each of these settings has a corresponding config.pro option. The one for
outdated embedded PTC Mathcad worksheet is nmgr_outdated_mathcad.
Chapter 9. Units
Key Points
Units are automatically built-in to PTC Mathcad Prime.
PTC Mathcad Prime performs engineering calculations in the units
of the worksheet.
When creating a Prime Analysis feature, the inputs between Creo
and Mathcad can be in different units. The outputs are returned in
the worksheet’s units, but in the Prime Analysis feature dialog box
you can specify the units for the resulting parameter and the value
will be converted.
Embedded worksheets output the results in the worksheet’s units.
The Unit Sensitive option in the Creo Parametric Relations dialog
box allows Creo to understand the output variable units.
If you are unaware of which units are available or what the abbreviation is,
simply click on the Units drop-down in the Units group on the Math tab:
Mathcad will also report an error when you attempt to perform math with
incompatible units, such as trying to add length, force, mass, time, and
current.
Mathcad will automatically correct the units if you attempt to evaluate to the
wrong quantity. For example, here I attempted to calculate force in units for
stress (N/mm2). Mathcad automatically added square meters to the units to
resolve to units for force. This is called units balancing.
The other additional base units for other quantities for the SI unit system
include:
Table 2: SI Units
Current Ampere (A)
Luminous Intensity Candela (cd)
Currency Dollar ($)
Substance Mole (mol)
Temperature Kelvin
However, to use the new variable as a unit, you have to change its label. By
default, PTC Mathcad Prime considers the new expression to define a
variable. If you click on the variable name and then on the Labels drop-down
list on the Math tab, you will see that the new expression is considered a
variable:
With the cursor still positioned on the name of the variable, select Unit from
the drop-down list.
The color of the furlongs per fortnight unit has changed to the default color
blue for units. Now the newly defined unit can be used in mathematical
expressions and results.
When creating a custom unit, you may want to use the Global Definition
operator. This enables you to use the new unit to evaluate other expressions
anywhere in the worksheet, including prior to where the unit itself is defined.
Here is an example:
Figure 9‑11: Using the Global Definition operator for a custom unit.
Click on the blue change hyperlink to the right of Units. This will open the
Units Manager dialog box. The actions you can perform here include:
It’s helpful to select a Unit Quantity first to narrow down the available units,
but this is not required.
Then you can select the appropriate unit for the parameter.
Figure 9‑16: Selecting the unit for Young's modulus.
In this case, the Voltage is calculated in terms of base units for mass, length,
time, and current, as opposed to the generally more familiar and intuitive
volts unit.
For the sake of integrating Mathcad worksheets with Creo Parametric,
make sure that the evaluation in the Base Units option is turned OFF!
Evaluating in the Base Units can cause problems when outputting results
from Mathcad to Creo Parametric.
Note that the drop-down list for Unit for the Creo Parametric output
parameter is empty. The Relations for converting inputs and outputs as well
as assigning the output to the model dimension are:
Figure 9‑20: Relations dialog box for converting radians and degrees.
Note that the conversion factor for converting the input from degrees to
radians is (pi / 180) and the conversion factor for the output from radians to
degrees is (180 / pi).
There are the Kelvin and Rankine scales, but Celsius and Fahrenheit have
additional Delta units for difference in temperature. There are problems with
trying to perform calculations in PTC Mathcad Prime with the Celsius and
Fahrenheit temperature scales.
Let’s take a look at an example. In this case, we’ll calculate the thermal
stresses in steel resulting from a temperature differential:
Our model is in inches but the worksheet uses the USCS unit for
length of feet.
The worksheet returns the result in feet.
Clicking on the Unit drop-down for the radius output parameter
under “Prime to Creo Parametric” provides a list of all available
length units in Creo Parametric:
Figure 9‑25: Length units available in Creo Parametric.
Figure 9‑27: Relations for driving model geometry from Prime Analysis feature outputs.
Let’s write Relations between our model dimension assuming that the output
parameter will be converted:
Figure 9‑31: Initial Relations for the test scenario.
The radius of the sphere is way too small (by a factor of 12). Therefore, the
volume is incorrect by a factor of 1728! (Shades of Mars Climate Orbiter.)
Let’s change the Relations to convert from feet to inches:
Figure 9‑33: Scaling to convert units in the Relations dialog box.
Note the initial results on the left are in the worksheet unit feet. The output
designated math regions both divide by the intended model unit of inches and
perform an inline evaluation. In this way, the results are converted to what
should be used in Creo Parametric.
The result will be a unitless quantity that can be used in Relations.
9.5.2.5. SIUnitsOf Function
There’s an interesting little function in PTC Mathcad Prime called SIUnitsOf.
It takes a variable as its argument and will return the unit of that variable in
the SI unit system.
This can be of use for determining:
Identify the units for the input and output variables in Creo
Parametric and PTC Mathcad Prime.
You can convert units of output variables in the Prime Analysis
dialog box.
Having the Unit Sensitive option turned on is highly
recommended for embedded worksheets so that Creo Parametric
takes units into account in Relations.
Chapter 10. Mathcad – Creo Integration Overview
Key Points
Proper planning is essential prior to embedding worksheets or
creating Prime Analysis features.
Changing the names of dimensions and parameters can enable you
to map your Creo inputs to your Mathcad input variables.
3D Annotations and columns added to the Model Tree can help
you understand your model better as you are building engineering
calculations into it.
How you feel about managing files external to your model or how
you manage your data (e.g., Windchill).
How often your models are changing and the level of automation
you need.
Which method you are more familiar or comfortable with.
How you prefer managing units between Creo Parametric and PTC
Mathcad Prime.
Personally, though, I prefer Prime Analyses. However, that doesn’t mean that
I recommend this choice for you. I recognize that a lot of this could be due to
the facts that the Behavioral Modeling Extension (BMX) is my favorite
module and I used it for well over a decade before embedded worksheets
functionality became available.
My best recommendation to you is to try and explore both methods and find
which one works best for your workflows.
10.2.1. Automapping
When creating a Prime Analysis feature, rather than manually designating
your inputs, Creo Parametric can do that for you. The requirements for
Automapping to work are:
10.3. 3D Annotations
It may be helpful to display some or all of your inputs and outputs in the
Graphics Area. This can be done using 3D Annotations. This functionality is
part of Model Based Definition (MBD), in which the Product and
Manufacturing Information (PMI) necessary to fabricate and inspect parts
and assemblies is contained in the models themselves. MBD reduces product
development time by:
Explode States.
Appearance States.
You may want to update your model templates (start parts and start
assemblies) to contain additional Combination States besides Default All.
You should develop a schema for how you want to organize your initial
Combination States. If you are unsure how to do so, take a look at MIL-STD-
31000, Department of Defense Standard Practice: Technical Data Packages.
A copy of this United States Military Standard can easily be found online via
a Google search.
To create a new Combination State for your 3D Annotations, click on the
Annotate tab and the New icon in the Combination States group.
Alternatively, you can create a new Combination State from the View
10.3.3. 3D Notes
A 3D Note can contain text, model dimensions, and model parameters. (3D
Notes that contain dimensions and parameters are often referred to as
parametric notes, since the note updates with changes to the model.)
To create a 3D Note, click on the Annotations tab and the Note
When placing this kind of note, first you will left click on the entity to which
you want the leader to be attached. By holding down the CTRL key you can
attached the leaders to multiple entities. Position your mouse where you want
the note text to appear and click the middle mouse button. Then type your
text. When finished, left click on an empty area of the Graphics Area.
In addition, you can add leaders to a note by selecting the note with the left
mouse button, holding down the right mouse button, and selecting Add
Leader from the pop-up menu.
Alternatively, you can select the 3D Annotation with the left mouse button,
click on the Annotate tab in the Ribbon, and select the Remove from State
Create a PTC Mathcad Prime worksheet with the input and output
variables designated. I find this easier to do outside of Creo
Parametric and I appreciate having a Mathcad worksheet I can
access on its own and share with others.
In Creo Parametric, embed this worksheet. Its contents will be
copied into the model and the copied worksheet will open in the
PTC Mathcad Prime application.
11.2. Setup
Before diving into PTC Mathcad Prime or Creo Parametric, you should have
a good idea of what the input and output variables are going to be.
Identify the units for the inputs and outputs for Creo Parametric dimensions
and parameters and the corresponding PTC Mathcad Prime variables.
Only Real Number and Integer values can be passed between Creo
Parametric and Mathcad. In other words, you cannot use Strings (words and
characters) or Yes No parameters.
11.3. Process
This section provides a detailed process that you can follow when embedding
a Mathcad worksheet into a Creo Parametric model. This workflow follows
my recommended process of creating the Mathcad worksheet first with inputs
and outputs designated. Be aware, though, that you can diverge from the
process laid out here significantly.
Generally, when embedding a worksheet, you will find that you will have to
Save and Push from PTC Mathcad Prime a couple times.
Save the worksheet. Now you are ready to embed the worksheet in your Creo
Parametric part or assembly.
11.3.2. Embedding the Worksheet
To connect a Creo Parametric model to a Mathcad Worksheet, perform the
following process:
This is the only indication that your model has an embedded Worksheet. Note
the following:
The Load File button allows you to select an existing Mathcad worksheet to
drive the Prime Analysis. This is the method I prefer and I recommend that
the Mathcad worksheet already have Definition math regions designated as
inputs and Evaluation math regions designated as outputs.
The New File button allows you to create a new Mathcad worksheet when
you create the Prime Analysis feature.
The Reload File button allows you to re-read the Mathcad worksheet in case
it has been changed since the last time the Prime Analysis feature was
updated.
The field underneath these buttons lists the name of the Mathcad Worksheet.
Creo Parametric: this field lists the name of the Creo Parametric
dimension or parameter to be sent to Mathcad and the name of the
model that owns the dimension or parameter.
Value: the current value of that dimension or parameter.
Unit: the unit for the Creo Parametric dimension or parameter.
Prime: the name of the Mathcad variable used as an input that will
receive the value of the dimension.
Unit: the unit of the Mathcad input variable.
In addition, after a row has been added, when you right click over the first
three columns, you have the following choices from the menu:
Add New.
Delete.
Select Prime input opens the Input Selection dialog box listing
any available Mathcad inputs.
Select inputs in Prime: this opens the Mathcad Select Menu
Manager. The user can select an input math region from the PTC
Mathcad Prime application, and it will be copied into the Prime
column.
Figure 12‑4: The Mathcad Select Menu Manager.
The plus sign button allows you to add a row for another input and
the minus sign button removes the currently selected row.
The Add Mapping drop-down list provides choices that control the actions
that occur when the end user clicks the plus sign icon to add a new row to the
list of inputs. With the default value of Add Mapping, the user right clicks
over cells to specify how they will select inputs from Creo Parametric and
Mathcad. The drop-down list contains the following choices, which result in
the following actions when the user clicks the plus sign button to add
a row:
The Clear All button will remove any dimensions or parameters that have
been added as inputs.
The Auto-map button will look for any Creo Parametric dimensions or
parameters that have the same name as a Mathcad input. If any are found,
they will be added to the list of inputs. Automapping is discussed in section
10.2.1.
Add New.
Delete.
Select Prime output opens the Input Selection dialog box listing
the math regions designated as outputs.
Select outputs in Prime opens the Mathcad Select Menu
Manager. The user can then select an output math region from the
PTC Mathcad Prime application and then Done Sel from the Menu
Manager to copy it into the Prime cell.
Right clicking over the last two columns only gives the Add New and Delete
choices.
The Add Mapping drop-down list has three choices that determine what
happens when the user clicks the plus sign button. With the default
choice Add Mapping, the user can right click over a table cell to select the
method for selecting an input. The other choices from the drop-down menu
The Saved Analyses section is initially collapsed. Click on the black triangle
to expand it.
To create a Saved Analysis, type a name in the Name field and click the Save
icon. The Prime Analysis will now be listed in the white field.
Figure 12‑8: Example Mathcad Saved Analysis.
Compute will run the Prime Analysis, sending the inputs to the
Mathcad worksheet and receive the outputs.
Add Feature will create the Prime Analysis as a feature in the
Model Tree.
Close closes the dialog box.
12.3. Process
Although you can create a new Mathcad worksheet inside of the Prime
Analysis Feature, I recommend that you create the worksheet first. The
process described here follows that recommendation.
2. Click the Load File button. In the Select Prime Worksheet dialog
box, navigate to your Mathcad Prime worksheet. Select it and click
Open. A PTC Mathcad Prime session will launch in the
background with the selected worksheet open. You can minimize
this.
3. Define inputs from Creo Parametric to PTC Mathcad Prime:
a. If names of dimensions or parameters in Creo Parametric
match names of Mathcad variables designated as inputs,
click the Auto-map button in the “Creo Parametric to
Prime” section.
b. To define additional mappings of Creo Parametric
dimensions or parameters to Mathcad variables, choose
the desired method:
Typically, the Regeneration Request is the only thing that would be changed
in this dialog box. The Regeneration Request is discussed in section 12.6.
Although you can change the name of the feature from here, you can always
do that from the Model Tree.
Clicking the Next button will take you to the dialog box that you used to
create the Prime Analysis feature. From there, you can:
Note that this particular Prime Analysis does not send any inputs to PTC
Mathcad. Also, the datums can be created with respect to a different
coordinate system than the default by unchecking the “Use Default Csys”
box.
Here are the resulting datum features in Creo Parametric:
Figure 12‑15: Datums generated in Creo Parametric.
The feature names are generated from the Mathcad Prime output aliases and
the feature identification number of the Prime Analysis feature.
1. Select the Prime Analysis feature in the Model Tree and select
Edit Definition from the Mini Toolbar.
2. In the Tree, expand Result datums and the CRV_ branch.
4. Click the green check mark at the bottom of the dialog box to
complete the Prime Analysis feature.
A curve will be generated as a spline through the points.
Figure 12‑18: Prime Analysis datum curve.
Alternatively, the Datum > Curve > Curve Through Points command can
be used to generate a datum curve with straight segments if desired.
Feature-level relations.
External references.
Circular references.
Since the Prime Analysis feature appears as a feature in the Model Tree, its
dimensional values are calculated based on where it appears. However, the
Relations that assign those outputs to model dimensions and parameters have
already been executed. Therefore, after the first regeneration performs the
Mathcad calculations, a second regeneration is needed to update model
geometry.
A possible solution to this is to use Post Regeneration Relations for assigning
the outputs of the Prime Analysis feature to model dimensions.
To change your Relations from Initial to Post Regeneration, perform the
following steps:
2. Change the drop-down list in the lower right corner of the dialog
box from Initial to Post Regeneration.
Your assignments will now be performed after the model has regenerated.
For some reason, even when using these Post Regeneration Relations, the
status in the lower right corner of the Message Area still shows that a
regeneration is needed:
However, when you check the values of the dimensions, the model is updated
and the outdated regeneration status goes away. I have no idea why this
happens.
Feasibility Studies.
Optimization Studies.
Multi-Objective Design Studies (MODS).
Statistical Design Studies.
These are parts of the Behavioral Modeling Extension (BMX), one of the
most powerful modules in Creo Parametric.
In a Feasibility Study, you specify:
We can set up our functions to calculate the volume and surface area, and
define initial values for the diameter and the length of the cylindrical portion.
We can use the Solve Block construct to find the diameter and length. We
can set up our requirements that include the volume function to be equal to
volume input from Creo Parametric. Note that this uses the Comparison
Equal To operator, not the Evaluation equal sign operator. We also put in
our requirement for the proportion of the main body length to the diameter.
The Solver section uses a vector of the values we want to calculate and the
minimize function.
Figure 13‑4: Scenario 1 Solve Block.
Then we can evaluate for the diameter and length and designate those as
outputs to Creo Parametric.
Next, we can set up variables for calculating the thickness based on ASME
guidelines.
Figure 13‑6: Scenario 1 thickness calculation setup.
The max function can select the worst case to be output back to Creo
Parametric.
13.1.4. Explorations
For additional practice, try the following:
Use the Ceil function to drive the thickness to the next quarter
inch or millimeter.
How can you change the worksheet to output the outer diameter
and the entire length?
How can you change the Creo Parametric model to use these
values?
13.2. Scenario 2: Square Key for a Gear
You are designing a shaft that will have a square key for connecting to a gear.
The inputs to the worksheet from Creo Parametric are the shaft
diameter, the hub length, and the material yield strength.
Assume the shear strength is half the yield strength. (Don’t forget
the factor of safety.)
Use the Ceil function to round the calculated width.
The inputs section could look like:
13.2.5. Explorations
See the results of changing the following:
Torque.
Material / yield strength.
Shaft diameter.
Mating gear hub length.
For outside of the box learning, create plots of the torque, shear stress, and/or
failure index (shear stress divided by the allowable shear stress) as a function
of different inputs like shaft diameter and key width. (Note: this involves use
of a Range Variable.)
13.3. Scenario 3: Solid Disk Flywheel Design
We need to calculate the diameter of a solid disk flywheel given the
following requirements:
Write a Relation to drive the diameter of the extrude from the output
parameter.
13.3.4. Explorations
Explore the following variations for this design scenario:
Note that the program uses if and also if statements as well as the Ceil
function.
13.4.4. Explorations
For additional exploration, try the following:
relations_unit_sensitive yes*, no
When set to yes, Relations will take into account the units of a parameter
when calculating the value of a Relation. When set to no, the units of an
output parameter will be ignored and the Relation will use the value of the
parameter only. This can be a huge problem with embedded Mathcad
worksheets.