Engineering Calculations with Creo Parametric and PTC Mathcad Prime (Creo Power Users) 9798649196673

This book will teach you how to integrate your engineering calculations into your Creo Parametric Computer Aided Design

3,397 408 22MB

English Pages 204 [210] Year 2020

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Engineering Calculations with Creo Parametric and PTC Mathcad Prime (Creo Power Users)
 9798649196673

  • Categories
  • Art

Table of contents :
Chapter 1 . Engineering Calculations Overview
Chapter 2 . Quick Example
Part I – Mathcad
Chapter 3 . Mathcad Overview
Chapter 4 . Mathcad Basics
Chapter 5 . Programming
Chapter 6 . Optimization
Chapter 7 . Mathcad Tips and Tricks
Part II – Creo Parametric Integration
Chapter 8 . Creo Parametric Overview
Chapter 9 . Units
Chapter 10 . Mathcad – Creo Integration Overview
Chapter 11 . Embedded Worksheets
Chapter 12 . Prime Analyses
Part III – Exercises
Chapter 13 . Sample Problems
Chapter 14 . Conclusions

Citation preview

ENGINEERING CALCULATIONS WITH CREO PARAMETRIC AND PTC MATHCAD PRIME By David Randolph Martin II

© 2020 David Randolph Martin II All rights reserved. This book or any portion thereof may not be reproduced or used in any manner whatsoever without the express written permission of the publisher except for the use of brief quotations in a book review.

TABLE OF CONTENTS Table of Contents Table of Figures Table of Tables Chapter 1. Engineering Calculations Overview 1.1. Computer Aided Engineering 1.2. Structure of This Book 1.3. Design Intent 1.4. Terminology and Version 1.5. Assumptions 1.6. Feedback Chapter 2. Quick Example 2.1. Introduction 2.2. Starting the Creo Parametric Model 2.3. Creating the Mathcad Worksheet 2.4. Embed a Worksheet in the Creo Parametric Model 2.4.1. Updating the Model & Worksheet and Flexing the Model 2.4.2. Remove the Worksheet 2.5. Create a Prime Analysis Feature 2.5.1. Flexing the Model 2.5.2. Delete a Prime Analysis Feature 2.6. Onward and Upward! Chapter 3. Mathcad Overview 3.1. Benefits of PTC Mathcad for Engineering Calculations 3.2. Mathcad Express 3.2.1. How to Get It 3.2.2. Limitations 3.3. The Mathcad Interface 3.4. Plots and Charts 3.5. Windchill Integration

Chapter 4. Mathcad Basics 4.1. Basic Math 4.2. Text Regions 4.3. Equals Signs in PTC Mathcad 4.3.1. Global Definition Operator 4.3.2. Comparison Equal To Operator 4.3.3. Symbolic Evaluation 4.4. Variables 4.4.1. Greek Letters 4.4.2. Pre-Defined Constants 4.4.3. Subscripts vs. Vector and Matrix Indices 4.4.4. Implied Multiplication 4.4.5. Imaginary Numbers 4.5. Functions 4.5.1. Built-In Functions 4.5.2. User-Defined Functions Chapter 5. Programming 5.1. Essentials of Programs 5.2. Initiating a Program 5.3. Initializing the Return Variable 5.4. Local Assignment Operator 5.5. If-Then-Else Constructs 5.6. For Loops 5.7. While Loops 5.8. The Break Operator 5.9. The Continue Operator 5.10. The Return Operator 5.11. Calling the Program 5.12. Example Program Chapter 6. Optimization 6.1. Optimization Concept

6.2. Functions 6.3. Vectors 6.4. Solve Blocks 6.5. Evaluation of Results Chapter 7. Mathcad Tips and Tricks 7.1. Keyboard Shortcuts 7.2. Rounding Values 7.3. Password Protected Areas 7.4. Equation Wrapping 7.5. Additional Resources 7.5.1. PTC Community 7.5.2. YouTube Creo Parametric Channel Chapter 8. Creo Parametric Overview 8.1. Computer Aided Design with Creo Parametric 8.2. Features and Dimensions 8.3. Parameters 8.4. Relations 8.5. Regeneration 8.6. Notification Center Chapter 9. Units 9.1. Importance of Units Compatibility 9.2. Units in Mathcad 9.2.1. Mathcad Default Units Systems 9.2.2. Defining a New Custom Unit in Mathcad 9.3. Units Systems in Creo Parametric 9.3.1. Units for Dimensions 9.3.2. Units for Parameters 9.4. Units Compatibility Between Creo Parametric and PTC Mathcad 9.4.1. Fundamental Units 9.4.2. Derived Units 9.4.3. Mathcad Evaluation in Base Units

9.4.4. Angle Dimensions 9.4.5. Temperature Units 9.5. Mathcad and Creo Parametric Integration 9.5.1. Prime Analyses 9.5.2. Embedded Worksheets 9.6. A Final Word Chapter 10. Mathcad – Creo Integration Overview 10.1. Integration Options and Comparison 10.2. Planning for Integration 10.2.1. Automapping 10.2.2. Changing Dimension Names in Creo Parametric 10.3. 3D Annotations 10.3.1. Combination States 10.3.2. Annotation Planes 10.3.3. 3D Notes 10.3.4. Adding 3D Annotations to a Combination State 10.4. Adding a Column to the Model Tree Chapter 11. Embedded Worksheets 11.1. Embedded Worksheets Overview 11.2. Setup 11.3. Process 11.3.1. Creating the PTC Mathcad Prime Worksheet 11.3.2. Embedding the Worksheet 11.4. Updating the PTC Mathcad Prime Worksheet 11.5. Updating the Model 11.6. Regeneration Failures 11.7. Identifying Mathcad Connected Models 11.7.1. Graphics Area Icon 11.7.2. Model Tree Filter 11.8. Removing a Worksheet Chapter 12. Prime Analyses

12.1. Background: Datum Analysis Features 12.2. The Prime Analysis Dialog Box 12.2.1. The File Section 12.2.2. The Inputs Section: Creo Parametric to Prime 12.2.3. The Outputs Section: Prime to Creo Parametric 12.2.4. Saved Analyses Section 12.2.5. Action Buttons 12.3. Process 12.3.1. Develop the Mathcad Prime Worksheet 12.3.2. Set Up the Prime Analysis Feature 12.3.3. Define Relations 12.3.4. Edit Definition of the Prime Analysis Feature 12.4. Creating Datums in a Prime Analysis 12.4.1. Datum Coordinate Systems 12.4.2. Datum Points 12.4.3. Datum Curves 12.5. Double Regeneration Problem 12.6. Regeneration Request 12.7. Mathcad Analysis Feature Chapter 13. Sample Problems 13.1. Scenario 1: Designing and Optimizing a Pressure Vessel 13.1.1. Developing the Worksheet 13.1.2. Developing the CAD Model 13.1.3. Connecting the Part to the Worksheet 13.1.4. Explorations 13.2. Scenario 2: Square Key for a Gear 13.2.1. Developing the Worksheet 13.2.2. Developing the CAD Model 13.2.3. Prime Analysis Feature 13.2.4. Model Relations 13.2.5. Explorations

13.3. Scenario 3: Solid Disk Flywheel Design 13.3.1. Developing the CAD Model 13.3.2. Developing the Worksheet 13.3.3. Connecting the Worksheet and CAD Model 13.3.4. Explorations 13.4. Scenario 4: Designing a Shaft 13.4.1. Developing the Worksheet 13.4.2. Developing the CAD Model 13.4.3. Connecting the CAD Model and Worksheet 13.4.4. Explorations Chapter 14. Conclusions Appendix A. Creo Parametric Configuration Options Appendix B. Acronyms

TABLE OF FIGURES Figure 1‑1: Creo Parametric Help Mathcad Tutorial. Figure 2‑1: Creating a new part. Figure 2‑2: Selecting the new part's template. Figure 2‑3: Sketch for the part. Figure 2‑4: The extrude feature for the part. Figure 2‑5: Changing the names of dimensions. Figure 2‑6: Mathcad worksheet Text Block and Text Box for documentation. Figure 2‑7: Mathcad Definitions. Figure 2‑8: Functions for Surface Area and Volume. Figure 2‑9: Solve Block to optimize volume. Figure 2‑10: Evaluate the results of the optimization. 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. Figure 2‑13: The Input/Output Designation dialog with all outputs and renamed aliases. Figure 2‑14: Mathcad worksheet with outputs. Figure 2‑15: The Save and Push command in the Quick Access Toolbar. Figure 2‑16: The Pushing values dialog box. Figure 2‑17: The indication of an embedded worksheet in Creo Parametric. Figure 2‑18: Creo Parametric Parameters dialog box with Mathcad outputs. Figure 2‑19: The Relations dialog box in Creo Parametric. Figure 2‑20: Inserting an output parameter into a Relation. Figure 2‑21: Driving a model dimension from a Mathcad output. Figure 2‑22: Relations driving model dimensions from Mathcad outputs. Figure 2‑23: Dimensions updated from Mathcad outputs. Figure 2‑24: Designating an input in Mathcad. Figure 2‑25: The Input/Output Designation dialog box with inputs and outputs. Figure 2‑26: The Pushing Values dialog box. Figure 2‑27: Adding a comment line to the Relations. Figure 2‑28: Inserting the Mathcad input. Figure 2‑29: Inserting the model parameter. Figure 2‑30: The driving input Relation.

Figure 2‑31: Model Notifications. Figure 2‑32: Outdated Mathcad Notification. Figure 2‑33: Creo Parametric interface indication of embedded worksheet. Figure 2‑34: Updated results in Mathcad worksheet. Figure 2‑35: Updated model dimensions. Figure 2‑36: Relations errors after removing embedded worksheet. Figure 2‑37: Mathcad Input/Output Designation dialog box. Figure 2‑38: The Prime Analysis feature dialog box. Figure 2‑39: Input defined for Prime Analysis. Figure 2‑40: Right mouse button for selecting outputs. Figure 2‑41: The Output Selection dialog box. Figure 2‑42: First output specified. Figure 2‑43: All outputs specified. Figure 2‑44: Entering the name of the Prime Analysis feature. Figure 2‑45: The Mathcad outputs as parameters. Figure 2‑46: Selecting model dimensions for a Relation. Figure 2‑47: Inserting a Mathcad output into a Relation. Figure 2‑48: Relations driving model geometry from Mathcad outputs. Figure 2‑49: Updated model dimensions. Figure 2‑50: Regeneration indication. Figure 2‑51: Updated Mathcad outputs. Figure 2‑52: Model geometry NOT updated. Figure 2‑53: Model geometry updated after second regeneration. Figure 2‑54: Warning dialog box when deleting a feature. Figure 3‑1: The Mathcad Prime interface toolbar. Figure 4‑1: Basic math in PTC Mathcad Prime. Figure 4‑2: Text Boxes and Text Blocks. Figure 4‑3: Examples of the Definition Operator for variables and functions. Figure 4‑4: The Global Definition operator. Figure 4‑5: Using the Comparison Equal To operator for documentation. Figure 4‑6: Symbolic evaluation of derivatives and integrals. Figure 4‑7: Mathcad Constants. Figure 4‑8: Evaluation of the pre-defined constants. Figure 4‑9: Overriding a pre-defined constant. Figure 4‑10: Matrix Index Operator. Figure 4‑11: Imaginary Numbers and Implied Multiplication. Figure 5‑1: Recursion in a program to calculate Fibonacci numbers.

Figure 5‑2: Program Operator. Figure 5‑3: Initializing a new result for a program. Figure 5‑4: Calling a program. Figure 5‑5: Prime numbers program. Figure 5‑6: Results of the prime number program. Figure 6‑1. Inserting a 5 by 1 vector. Figure 6‑2. How the vector appears when initially created. Figure 6‑3: Solve Block construct. Figure 6‑4: Example Solve Block for optimization. Figure 6‑5: Evaluation of the Solve Block results to use as outputs. Figure 7‑1: Accessing Help for keyboard shortcuts. Figure 7‑2: Sample of the help for keyboard shortcuts. Figure 7‑3: Mathcad functions for rounding. Figure 7‑4: Rounding functions with units. Figure 7‑5: Password protecting an area. Figure 7‑6: Location of the Equation Break operators. Figure 8‑1: The Parameters dialog box. Figure 8‑2: The Relations dialog box. Figure 8‑3: Relations using Mathcad inputs and outputs. Figure 8‑4: Regeneration notification in the lower right corner. Figure 9‑1: Applying units to numbers. Figure 9‑2: The Units drop-down menu. Figure 9‑3: Evaluating in the worksheet units. Figure 9‑4: Resolving math to the worksheet units. Figure 9‑5: Error for incompatible units. Figure 9‑6: Automatic units balancing. Figure 9‑7: Changing the worksheet unit system. Figure 9‑8: Furlongs per fortnight. Figure 9‑9: The Labels drop-down menu. Figure 9‑10: Changing the region label to Unit. Figure 9‑11: Using the Global Definition operator for a custom unit. Figure 9‑12: The Model Properties dialog box. Figure 9‑13: The Units Manager dialog box. Figure 9‑14: The Parameters dialog box. Figure 9‑15: Specifying a unit quantity for a parameter. Figure 9‑16: Selecting the unit for Young's modulus. Figure 9‑17: Part model for angle conversion.

Figure 9‑18: Mathcad worksheet for angles. Figure 9‑19: Prime Analysis feature for angle conversion. Figure 9‑20: Relations dialog box for converting radians and degrees. Figure 9‑21: Temperature units in Mathcad. Figure 9‑22: Temperature units example. Figure 9‑23: Calculations with Kelvin and Rankine. Figure 9‑24: Prime Analysis with dimension inputs. Figure 9‑25: Length units available in Creo Parametric. Figure 9‑26: Prime Analysis with parameter inputs. Figure 9‑27: Relations for driving model geometry from Prime Analysis feature outputs. Figure 9‑35: Unit Sensitive Option. Figure 9‑28: Test scenario for embedded worksheets. Figure 9‑29: Mathcad worksheet for the test scenario. Figure 9‑30: Embedded Mathcad output parameters for test scenario. Figure 9‑31: Initial Relations for the test scenario. Figure 9‑32: Incorrect results for the test scenario. Figure 9‑33: Scaling to convert units in the Relations dialog box. Figure 9‑34: Test scenario working correctly. Figure 9‑36: Dividing by Units. Figure 9‑37: Dividing by Unit. Figure 9‑38: SIUnitsOf Function Figure 10‑1: The In Graphics Toolbar. Figure 10‑2: The Annotate Ribbon tab. Figure 10‑3: Annotation Plane Manager. Figure 10‑4: Annotation Plane Definition dialog box. Figure 10‑5: The Note command. Figure 10‑6: Assign to States dialog box. Figure 10‑7: Mini Toolbar for 3D Annotations. Figure 10‑8: Adding a column to the Model Tree. Figure 11‑1: Assigning inputs in the worksheet. Figure 11‑2: Assigning and renaming outputs. Figure 11‑3: The PTC Mathcad Pushing values dialog box. Figure 11‑4: Embedded worksheet indication in the Creo Parametric Graphics Area. Figure 11‑5: Notification Center warning. Figure 11‑6: Indication of an embedded Mathcad worksheet.

Figure 11‑7: Filtering Model Tree by embedded worksheets. Figure 11‑8: Warning when removing an embedded worksheet. Figure 11‑9: Relations after removing an embedded worksheet. Figure 12‑1: The Prime Analysis feature dialog box. Figure 12‑2: The Prime Analysis feature File section. Figure 12‑3: The Prime Analysis feature Inputs section. Figure 12‑4: The Mathcad Select Menu Manager. Figure 12‑5: The Mathcad Select Menu Manager. Figure 12‑6: The Prime Analysis Feature Outputs section. Figure 12‑7: The Prime Analysis feature Saved Analyses section. Figure 12‑8: Example Mathcad Saved Analysis. Figure 12‑9: The Saved Analysis dialog box. Figure 12‑10: The Prime Analysis feature dialog box. Figure 12‑11: Parameters generated from a Prime Analysis. Figure 12‑12: Edit Definition of a Prime Analysis feature. Figure 12‑13: Mathcad worksheet for creating datums. Figure 12‑14: Prime Analysis feature for generating datums. Figure 12‑15: Datums generated in Creo Parametric. Figure 12‑16: Resulting Datums of the Prime Analysis feature. Figure 12‑17: Resulting datums of the Prime Analysis feature. Figure 12‑18: Prime Analysis datum curve. Figure 12‑19: Datum Curve Through Points. Figure 12‑20: Cutting the Relations. Figure 12‑21: Accessing Post Regeneration Relations. Figure 12‑22: Pasting the Relations. Figure 12‑23: Regeneration status in the lower right corner. Figure 13‑1: Pressure vessel model. Figure 13‑2: Scenario 1 worksheet inputs. Figure 13‑3: Scenario 1 functions and initial values. Figure 13‑4: Scenario 1 Solve Block. Figure 13‑5: Scenario 1 initial results. Figure 13‑6: Scenario 1 thickness calculation setup. Figure 13‑7: Scenario 1 thickness calculations. Figure 13‑8: Scenario 1 thickness output. Figure 13‑9: Model for scenario 2. Figure 13‑10: Scenario 2 worksheet inputs. Figure 13‑11: Scenario 2 worksheet calculations.

Figure 13‑12: Scenario 2 worksheet outputs. Figure 13‑13: Scenario 2 Prime Analysis feature. Figure 13‑14: Relations to drive model. Figure 13‑15: Scenario 3 worksheet inputs. Figure 13‑16: Scenario 3 worksheet calculations. Figure 13‑17: Scenario 3 worksheet outputs. Figure 13‑18: Scenario 3 Prime Analysis feature. Figure 13‑19: Scenario 4 worksheet inputs. Figure 13‑20: Scenario 4 worksheet calculations. Figure 13‑21: Scenario 4 worksheet outputs.

TABLE OF TABLES Table 1: Units Systems Base Units Table 2: SI Units Table 3: Fundamental Units in Creo and Mathcad Table 4: Derived Quantities.

Chapter 1.

Engineering Calculations Overview

Key Points Math makes the difference between design and engineering in product development. The application of math to design allows us to develop products that meet their requirements and are optimized for their operating environments. Design Intent is the process of building additional information and intelligence into our models so that when we need to implement changes, our parts and assemblies update in ways that we planned for and expect. Connecting Creo Parametric models to worksheets containing engineering calculations from PTC Mathcad Prime is an excellent way to build Design Intent into your products. PTC Mathcad Prime worksheets can be connected to Creo Parametric models either by embedding them into the model or via a Prime Analysis feature.

1.1. Computer Aided Engineering Why do we need engineering calculations? You can certainly design many products without performing engineering calculations. There are quite a few inventors who don’t have formal engineering backgrounds. When I taught CAD, occasionally I would have students who had no previous engineering education and experience. They would struggle with concepts like datums and tolerances, but they had ideas for products that they wanted to develop. It is entirely possible to design a product without the need for engineering calculations or software. But how do you know your product will survive its operating environment? Of course, you can build the product and test it in the operating environment. But here’s the rub: Prototyping is expensive. Testing is expensive. Often it’s impossible to perform all the tests necessary to validate a product in its operating environment. (Think about undersea vessels and spacecraft.)

Also, for companies to make money and for products to be successful, you often want to iterate the design to be best possible variation in the solution space. Some of the considerations that we turn into product requirements include: Weight. We may want it be below a certain weight or as light as possible. Strength. We may want it to meet certain loads or be as strong as possible. Longest possible battery life or lowest electrical load. Operating cycles. We may want the highest number possible, or for engineered obsolescence, we may want a maximum number. These are examples of ways that we might want to optimize our products. Optimization is pretty much impossible without software. It certainly is expensive, tedious, and time-consuming to perform without software. Over centuries, engineering has developed a large body of knowledge that helps guide the design, analysis, and manufacturing of parts, assemblies, mechanisms, and products. This body of knowledge facilitates both validating and optimizing our products. Through the language of math, this body of knowledge has resulted in formulas and engineering calculations that we can apply to product development. Math is the difference between Computer Aided Design (CAD) and Computer Aided Engineering (CAE). Math enables us to develop better products faster and at lower cost than without it. Historically, our calculations have often been kept separate from our CAD models. Any engineer worth his or her salt has actual notebooks or notepads filled with sketches, notes, calculations, and so on. You may have Microsoft Excel spreadsheets used to determine certain model values. You may even use Relations in Creo Parametric models. Today, we have the ability to connect our engineering calculations with our CAD models. Our CAD models can send inputs to the engineering calculations, and our engineering calculation software can send outputs back to the model for driving geometry. This book will show you how to do that.

1.2. Structure of This Book By reading this book, you will learn how to use worksheets from PTC Mathcad Prime containing engineering calculations to drive parts and assemblies created in Creo Parametric. Chapter 2 will go through a quick example to demonstrate the basics of integrating Creo Parametric models with Mathcad worksheets. The following chapters are divided into three major sections: Mathcad functionality for engineering calculations is covered in chapters 3 through 7. Integrating PTC Mathcad with Creo Parametric models is covered in chapters 8 through 12. Example problems are in Chapter 13. There are two methods of connecting Creo Parametric models with PTC Mathcad Prime worksheets: Embedding the worksheets in the parts or assemblies. These embedded worksheets are also known as Engineering Notebooks. Connecting the worksheets to parts and assemblies via Prime Analysis features. The sample problems in chapter 13 are designed to be simple enough that you can create the models and worksheets in a matter of minutes. That way you can focus on the concepts described in this book rather than part modeling and worksheet creation.

1.3. Design Intent The initial design phase is a very small portion of the lifecycle of a product. You might spend a few hours, days, weeks, or months designing your parts and assemblies. Depending on complexity, the design phase of your entire product could be months or years. The following phases – prototype, test, manufacturing, production, sustainment, and retirement – typically are several times longer than the design phase, depending on the success of your product.

Because of this, you actually spend most of your time making changes to your parts and models. Changes will result from design reviews, testing, prototyping, manufacturing reviews, customer feedback, and maintenance, repair, and overhaul (MRO) operations. When you have to implement changes, you want to avoid throwing out your parts, assemblies, and drawings, and starting over from scratch. We want to build additional information and intelligence into our models, so that when we need to implement changes, we have the flexibility to do so. We have the right dimensions, parameters, features, and components that allow us to make those changes, and the other entities in our model update appropriately to those changes. Creo Parametric contains a variety of tools at different levels for building our Design Intent into our models. For example, at the part level, we can build Design Intent via: The types of features we choose to build. The options and attributes for those features. The order in which the features appear in the Model Tree. The parent-child relationships for our features. The Relations – mathematical expressions – we write between different dimensions and parameters. Datum Analysis, Feasibility, and Optimization features via a module called the Behavioral Modeling Extension (BMX). At the assembly level, we can build Design Intent via: The choice of the first component in an assembly (also known as the base component). The organization of our assemblies into subassemblies. This is known as the Product Structure. The choices of constraints and mechanism connections to define the positioning and movement of components relative to one another. The use of the Top Down Design (TDD) methodology to control complex products via central resources known as Notebooks and Skeletons and building interdependencies between components.

There are other methods of building Design Intent into our models, and some of these techniques will be touched on in later chapters. Building our engineering calculations into our models adds another level of Design Intent. Using PTC Mathcad Prime, we can write – and document – more complex calculations than are possible with Creo Parametric’s Relations editor. The general process for building Design Intent via engineering calculations is as follows: 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.4. Terminology and Version I have attempted to be consistent using the term PTC Mathcad Prime to refer to the engineering calculation software. However, the terms Mathcad, PTC Mathcad, and Mathcad Prime can and may be used interchangeably throughout. This book and the screenshots were generated in PTC Mathcad Prime 6.0 and Creo Parametric 7.0. However, Prime Analyses can be created with PTC Mathcad Prime 1.0 or later and Creo Parametric 1.0 or later. Embedded worksheets functionality is fully compatible back to PTC Mathcad Prime 3.0 and build codes M130 and later of Creo Parametric 3.0. Keys on your computer keyboard like SHIFT and ENTER are capitalized. CTRL refers to the Control key. Specific commands or selections in Creo Parametric and PTC Mathcad Prime appear in bold type. Procedure steps that call for you to switch between Creo Parametric and PTC Mathcad Prime, and vice versa, appear in all bold to call your attention to those steps.

1.5. Assumptions This book assumes you have working knowledge of Creo Parametric for part design in the following areas: The Creo Parametric user interface. Spinning, panning, and zooming models in the Graphics Area. Creating new parts. Sketching. Basic feature creation including Extrudes, Revolves, Holes, Rounds, and Chamfers. Parameters. Relations. If you are not familiar with these areas, I highly recommend that you develop your knowledge in these areas. Potential methods of developing these skills include: Taking an Instructor Led Training class from PTC or one of its Value Added Resellers. Taking a Web Based Training class via Precision LMS. Viewing some of my videos on the Creo Parametric YouTube channel. This channel contains a playlist for PTC Mathcad Prime videos as well. These can be found at: https://www.youtube.com/CreoParametric PTC Help for Creo Parametric, available at https://help.ptc.cpm, contains tutorials, including one for PTC Mathcad integration with models and worksheets you can download. You can access these by expanding Creo Tutorials in the left pane. See Figure 1-1 for more information.

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: 1. Building a simple part model in Creo Parametric (section 2.2). 2. Creating a new worksheet in PTC Mathcad Prime (section 2.3). 3. Embedding the worksheet to drive the model dimensions (section 2.4). 4. Using a Prime Analysis feature to drive the model dimensions (section 2.5). Note that you do not have to create the worksheet before embedding it or making a Prime Analysis feature. We are doing so in order to explore both methods.

2.2. Starting the Creo Parametric Model The general process to create our part is as follows: Start a new part. Create a sketch and extrude it. Shell the part.

Define a parameter for the surface area to be sent to PTC Mathcad Prime as an input. Perform the following steps to create your Creo Parametric model: 1. Launch Creo Parametric if you have not already done so.

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.)

Figure 2‑1: Creating a new part.

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 \Common Files\templates. 4. Select the datum plane TOP (from the Model Tree or Graphics

Area). Click the Sketch tool from the Mini Toolbar or the ribbon. This will place you in Sketch Mode. 5. Create a Center Rectangle located at the intersection of the Sketch References. Make the dimensions 15 and 20.

Figure 2‑3: Sketch for the part.

6. Hit the green check mark

to complete the Sketch.

7. With the sketch still selected, click the Extrude

Change the depth to 25 and click the green check mark complete the feature.

tool.

to

Figure 2‑4: The extrude feature for the part.

Note: these dimensions are initial values only. The worksheet will drive their actual values. 8. Select the Extrude feature in the Model Tree and click the Edit

Dimensions icon from the Mini Toolbar. 9. Select the dimensions and use the Dimension tab in the Ribbon to change the names as follows: a. Change the 15 dimension to width. b. Change the 20 dimension to length. c. Change the 25 dimension to height.

Figure 2‑5: Changing the names of dimensions.

10. Since these dimensions control the volume, to make the box we are going to use a Shell feature with a negative value; we’re going to add material to the outside of the Extrude. Click the Shell tool. a. Select the top surface to remove. b. Use the Flip icon to change the material direction to the outside. c. Change the thickness to 0.25. (Note: for the sake of this exercise, the thickness does not matter.)

d. Click the green check mark feature. 11. Click Tools > Parameters

to complete the

.

a. Click the plus sign icon to create a new parameter. b. Change the name to SA (for surface area). c. The type should be Real Number. Change the value to 2500. 12. Click the Save icon. We now have everything we need for our part geometry. We are going to use 2500 as the target surface area of our starting material. Units will be covered in depth Chapter 9. We could pass parameters to and receive parameters back from Mathcad that utilize dimensions, but we will save that for later.

2.3. Creating the Mathcad Worksheet Our PTC Mathcad Prime worksheet will perform the following calculations: 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: 1. Launch PTC Mathcad Prime if it is not already open. 2. Create a new worksheet if desired, or use an existing empty worksheet if one is open. 3. Use the Text Box and Text Block tools from the Math tab to document the title and intent of the 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.

Note: we do not have to use the same names as dimensions and parameters from Creo Parametric. But this can simplify later steps by enabling us to use something called automapping, which will be described in Chapter 10. 5. Use math regions to define functions for the material surface area and volume as a function of length, width, and height.

Figure 2‑8: Functions for Surface Area and Volume.

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: The first constraint uses the Comparison Equal To equals sign, which is the keyboard shortcut of the CTRL key and the equals sign. Create the 3x1 matrix from Matrices/Tables > Insert Matrix. 7. Evaluate the results for length, width, and height. These values will be sent back to Creo Parametric as outputs.

Figure 2‑10: Evaluate the results of the optimization.

Now we have a worksheet that we are ready to use either as an embedded worksheet or in a Prime Analysis.

2.4. Embed a Worksheet in the Creo Parametric Model To embed a worksheet in our Creo Parametric model, perform the following steps: 1. Return to Creo Parametric and the model you created in section 2.2. 2. Click Applications > PTC Mathcad > Insert Worksheet. 3. A File Open dialog box will open. Navigate to the folder where you stored your worksheet. Select it and click Open. 4. The PTC Mathcad Prime application will be activated on your computer screen. You will be on a tab with the name of your Creo Parametric model. 5. Scroll down to the end where the length, width, and height results are evaluated. Select the length evaluation math region and click Input/Output > Assign Outputs. a. Click Show as List from the Input/Output tab. This will open the Input/Output Designation dialog box. It will list a single output with the alias “out.”

Figure 2‑11: The Mathcad Input/Output Designation dialog box with the length output.

b. Double click “out” under Alias and change the name to

“length_opt.”

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.

a. Close the Input/Output Designation dialog box. b. Select the Show in Worksheet button from the Input/Output tab. The evaluation math regions should look as follows:

Figure 2‑14: Mathcad worksheet with outputs.

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.

8. Click OK to close the Pushing values dialog box.

Figure 2‑16: The Pushing values dialog box.

9. Minimize PTC Mathcad Prime and return to Creo Parametric. 10. In the upper right corner of the Graphics Area in the Creo Parametric interface, you will see the Mathcad Prime symbol indicating an embedded worksheet:

Figure 2‑17: The indication of an embedded worksheet in Creo Parametric.

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.

a. Type in the following comment line starting with a forward slash and an asterisk: /* Drive model dimensions from volume optimization in embedded worksheet b. Select the length dimension in the Graphics Area. The dimension name will be copied into the Relations dialog box. c. Type in an equals sign. Use spaces for clarity. d. In the Relations dialog box, click the Insert Parameter icon from the horizontal toolbar. In the Select Parameter dialog box, change the Look In drop-down list from Part to Embedded Mathcad. Select the length_opt parameters and click Insert Selected.

Figure 2‑20: Inserting an output parameter into a Relation.

e. The Relations dialog box should look as follows:

Figure 2‑21: Driving a model dimension from a Mathcad output.

f.

Repeat steps b through d for the width and height dimensions.

Figure 2‑22: Relations driving model dimensions from Mathcad outputs.

g. Click OK to close the Relations dialog box.

13. Click Model > Regenerate . The part geometry will update to the new dimensions. 14. Select Extrude 1 in the Model Tree and the Edit Dimensions

icon from the Mini Toolbar. The updated dimension values will appear in the Graphics Area. 15. Double click on a dimension to change its value. Note the warning in the Message Area that the dimension is now driven by a Relation.

Figure 2‑23: Dimensions updated from Mathcad outputs.

16. Save the model. 17. Minimize Creo Parametric and return to PTC Mathcad Prime. 18. Scroll to the top of the worksheet. Select the SA definition math region and select Input/Output > Assign Inputs. If Show in Worksheet is still selected, it should appear as follows:

Figure 2‑24: Designating an input in Mathcad.

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.

Figure 2‑26: The Pushing Values dialog box.

22. Minimize PTC Mathcad Prime and return to the Creo Parametric interface. 23. Click Tools > Parameters. Change the Look In drop-down list from Part to Embedded Mathcad. The list contains the SA parameter as an input. Click OK. 24. Click Tools > Relations. Position your cursor at the top of the editing field and hit the ENTER key a couple times to add empty lines. Use a forward slash and an asterisk to type in a comment line: /* Use Surface Area model parameter as an input to Mathcad.

Figure 2‑27: Adding a comment line to the Relations.

a. Click the Insert Parameter icon from the horizontal toolbar. In the Select Parameter dialog box, change the Look In drop-down list from Part to Embedded Mathcad. Select the SA input from the list and click Insert Selected.

Figure 2‑28: Inserting the Mathcad input.

b. After the inserted parameter, type in an equals sign. Use spaces for clarity. c. Click the Insert Parameter icon. In the Select Parameter dialog box, select the SA part parameter and click Insert Selected.

Figure 2‑29: Inserting the model parameter.

d. The Relations dialog box should look as follows.

Figure 2‑30: The driving input Relation.

e. Click OK. 25. Save the model. 26. Minimize Creo Parametric and return to PTC Mathcad Prime. 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.

Figure 2‑31: Model Notifications.

5. Click on the yellow flag. Optional: open and close the Notification Center.

Figure 2‑32: Outdated Mathcad Notification.

6. To open the embedded worksheet, click either Applications > PTC Mathcad > Open/Create Worksheet or the Mathcad Prime icon in the upper right corner of the Graphics Area.

Figure 2‑33: Creo Parametric interface indication of embedded worksheet.

7. In the Mathcad worksheet, click Input/Output > Update Inputs. Scroll down to the bottom of the worksheet and note the updated outputs.

Figure 2‑34: Updated results in Mathcad worksheet.

8. Click Save and Push and OK from the Pushing values dialog box. Close the worksheet. 9. Minimize PTC Mathcad Prime and return to Creo Parametric. 10. Click Model > Regenerate. Check the updates to the model geometry by clicking Extrude 1 in the Model Tree and Edit

Dimensions

from the Mini Toolbar.

Figure 2‑35: Updated model dimensions.

Feel free to test this process with additional values for the surface area.

2.4.2. Remove the Worksheet There are times when you may want to remove an embedded worksheet from your Creo Parametric model. To do so, click Applications > PTC Mathcad > Remove Worksheet. Be aware that this will delete the worksheet. If you want to keep a copy of the model with the embedded worksheet, use File > Save As > Save a Copy. Perform the following steps to remove the worksheet: 1. In the model with the embedded worksheet in Creo Parametric, click Applications > PTC Mathcad > Open/Create Worksheet. 2. In the PTC Mathcad worksheet, click the Mathcad button > Save As > Worksheet. 3. Close the worksheet. Click Don’t Save. 4. Return to Creo Parametric and click Applications > PTC Mathcad > Remove Worksheet. Note the warning and click OK.

5. Click Tools > Parameters. Change the Look In drop-down list from Part to Embedded Mathcad. Note all the input and output parameters have been deleted. 6. Click Tools > Relations. Note the error messages.

Figure 2‑36: Relations errors after removing embedded worksheet.

7. Delete all the Relations and click OK.

2.5. Create a Prime Analysis Feature Now we will connect our Creo Parametric model to a PTC Mathcad Prime worksheet, but this time using a Prime Analysis feature. Perform the following steps:

1. If necessary, launch the PTC Mathcad Prime application and open the worksheet you created in section 2.3. 2. Select the SA definition math region and click Input/Output > Assign Inputs. 3. Click Show as List from the Input/Output tab. 4. Scroll down to the bottom of the worksheet. a. Select the length evaluation math region and click Input/Output > Assign Outputs. b. In the Input/Output Designation dialog box, change the Alias for the output from “out” to “opt_length.”

Figure 2‑37: Mathcad Input/Output Designation dialog box.

c. Repeat steps a and b for the width and height outputs. d. Close the Input/Output Designation dialog box. 5. Save the worksheet. 6. Exit from the PTC Mathcad Prime application. 7. If necessary, launch Creo Parametric and open the part model you created in section 2.2. 8. If necessary, use Tools > Parameters to change the SA parameter back to 2500. 9. Click Analysis > Prime Analysis . This will open the Prime Analysis dialog box and PTC Mathcad Prime will launch in the background.

Note: The Prime Analysis feature dialog box will be explained in detail in section 12.2.

Figure 2‑38: The Prime Analysis feature dialog box.

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.

Figure 2‑39: Input defined for Prime Analysis.

13. Under the “Prime to Creo Parametric” section, click the plus sign icon to add an empty row. Position your mouse in the cell in the new row below “Prime,” hold down the right mouse button, and click Select Prime output.

Figure 2‑40: Right mouse button for selecting outputs.

a. In the Outputs Selection dialog box, select opt_length and click OK.

Figure 2‑41: The Output Selection dialog box.

b. Note that Creo Parametric parameter will be created with the name MCP_ appended to the front of the output variable name. (As you can probably guess, MCP stands for Math Cad Prime.)

Figure 2‑42: First output specified.

c. Repeat these steps in step 10 to add mapping for the opt_width and opt_length output variables.

Figure 2‑43: All outputs specified.

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.

Figure 2‑44: Entering the name of the Prime Analysis feature.

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.

Figure 2‑45: The Mathcad outputs as parameters.

18. Click Tools > Relations. a. Write a comment line using forward slash and an asterisk: /* Drive model dimensions from Prime Analysis volume optimization b. Select Extrude 1 from the Model Tree. The screen should look something like:

Figure 2‑46: Selecting model dimensions for a Relation.

c. Select the length dimension in the Graphics Area. d. Type in the equals sign with spaces for clarity. e. Click the Insert Parameter icon from the horizontal toolbar. In the Select Parameter dialog box, change the Look In drop-down list from Part to Feature and select the Prime Analysis feature you created from the Model Tree. Select the MCP_OPT_LENGTH parameter and click Insert Selected.

Figure 2‑47: Inserting a Mathcad output into a Relation.

f.

Repeat steps c through e for the width and height dimensions. Your Relations dialog box should look like:

Figure 2‑48: Relations driving model geometry from Mathcad outputs.

g. Click OK.

19. Click Model > Regenerate . 20. Select Extrude 1 in the Model Tree and click the Edit Dimensions

icon from the Mini Toolbar. Note the updated model dimensions.

Figure 2‑49: Updated model dimensions.

21. Click the Save button. Now we have a Prime Analysis feature that calls a Mathcad worksheet for implementing our engineering calculations.

2.5.1. Flexing the Model As described in section 2.4.1, whenever we make changes to our models, especially complicated changes like driving our model from engineering calculations, we want to flex the part to ensure it updates properly. To update the model with a Prime Analysis feature, perform the following steps: 1. Click Tools > Parameters. Change the SA surface area parameter from 2500 to 4000.

2. Click Model > Regenerate or CTRL-G. 3. Notice the model status in the lower right corner indicates our model is not fully updated.

Figure 2‑50: Regeneration indication.

4. Optional: Click Tools > Parameters. Change the Look In dropdown list from Part to Feature and in the Model Tree select the Prime Analysis feature you created. Note the values of the output dimensions.

Figure 2‑51: Updated Mathcad outputs.

5. Optional: Select Extrude 1 in the Model Tree and click the Edit

Dimensions icon from Mini Toolbar. Note the length, width, and height dimensions. We must perform a second regeneration.

Figure 2‑52: Model geometry NOT updated.

6. Click Model > Regenerate now fully updated.

or CTRL-G. Our model is

Figure 2‑53: Model geometry updated after second regeneration.

This is an important thing to note about Prime Analysis features: updating your model often requires two regenerations. This will be discussed further in section 12.5. Feel free to continue experimenting with flexing the model by changing the

Surface Area to different values.

2.5.2. Delete a Prime Analysis Feature If for whatever reason you no longer want your Creo Parametric model driven by a Prime Analysis feature, simply select it in the Model Tree, hold down the right mouse button, and click Delete. Then click OK in the warning dialog box.

Figure 2‑54: Warning dialog box when deleting a feature.

2.6. Onward and Upward! Now that you have created both an embedded worksheet and a Prime Analysis feature, you can learn more by experimenting with the geometry and constraints in the worksheet. Some explorations you can try include: Change from an open-topped box to closed or open on the top and bottom. Change from a box to a cylinder. Force the length to be 2 times or three times the width. Put a hole of a known diameter through one or more walls. How does your model change? How do your engineering calculations change? The rest of this book will go into great detail regarding additional aspects of this process in both PTC Mathcad Prime and Creo Parametric. If you feel confident to attempt driving additional Creo Parametric models with PTC Mathcad Prime worksheets, please jump to Chapter 13.

Part I – Mathcad Chapter 3.

Mathcad Overview

Key Points Mathcad Express is a free lite version of PTC Mathcad Prime that you can download from Mathcad.com.

3.1. Benefits of PTC Mathcad for Engineering Calculations PTC Mathcad Prime is a software application that allows you to perform and document engineering calculations. The power of PTC Mathcad comes from the following: It has a simple graph paper (or whiteboard) interface. There are over 400 predefined functions that you can use in your math expressions. Mathcad uses real math notation as opposed to a special programming language. Units are built into PTC Mathcad Prime. You can document your math with text and images. Mathcad integrates (no pun intended) with Microsoft Excel in addition to Creo Parametric. You can: Read from Excel spreadsheets using the READEXCEL function. Create an Excel Component within a worksheet. Write to an Excel spreadsheet. As described in the previous chapter, Mathcad worksheets can be connected to Creo Parametric models in the following manner: Dimensions and parameters are passed from Creo Parametric to Mathcad.

Mathcad can perform basic and advanced calculations using those dimensions and parameters. Values are then passed back to Creo Parametric. Relations can then assign those values to other model dimensions and parameters.

3.2. Mathcad Express All PTC customers have access to Mathcad Express, which is the free version of the software. This lite version of the software provides enough functionality to use for embedded worksheets and Prime Analysis features in Creo Parametric.

3.2.1. How to Get It At the time of the writing of this book, Mathcad Express is available from the following URL: https://www.mathcad.com/en/try-and-buy/mathcad-express-free-download After submitting your information, you will be able to download the software. During the first 30 days, you will have access to the full functionality available from a commercial license. After that initial month, the software will downgrade to the Express version.

3.2.2. Limitations Mathcad Express lacks the following capabilities compared to the full commercial license: Ability to use templates when creating new worksheets. The Solve Block construct available from the Math tab for solving systems of linear, non-linear, and differential equations. This prevents you from being able to perform optimizations as described in Chapter 6. Programming, which is covered in Chapter 5. Advanced Engineering Mathematics, including Calculus, Optimizations, and Design of Experiments (DOE).

Create the following plot types from Plot > Insert Plot: Polar Plot, Contour Plot, and 3D Plot. Symbolic evaluation of math expressions, which is discussed in section 4.3.3. Embed Microsoft Excel spreadsheets in your Mathcad worksheets. Add passwords to Areas created from the Document tab. (Areas are regions in your worksheet that can be collapsed or expanded to hide and show your work. Be careful using the Protect Area functionality – if you forget the password you defined, there’s nothing anyone can do to help you!) Wrapping equations that go beyond the width of the sheet. (You can get around this by using the Math Formatting tab to change the font size of your math regions so that they will fit. If you’re okay with your math regions going beyond your page width, you can also use the Document tab to change your view from Page to Draft.) Furthermore, Mathcad Express lacks the following enhancements that were made available in PTC Mathcad Prime 6.0: 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

3.3. The Mathcad Interface Let’s review various parts of the PTC Mathcad Prime interface relevant to Creo Parametric integration: 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.

The Mathcad button in the upper left corner. This opens a menu with commands for managing your Mathcad worksheets as well as your recently used worksheets. When embedding a worksheet, this menu will also contain the Save and Push command. The Ribbon. This part of the interface contains the various tabs for creating and managing your math expressions and plots. The tabs that will be used a lot for Creo Parametric integration are the Math, Input/Output, and Functions tabs, so you should become familiar with them. The Quick Access toolbar in the upper left corner. The Save icon becomes the Save and Push icon when embedding a worksheet. The Learning Connector and Help icons in the upper right corner.

The bottom bar, which includes page number of total pages information; the light indicating whether Auto Calculation is enabled; text search and options; zoom; and the toggle between the Page View and the Draft View.

3.4. Plots and Charts In PTC Mathcad Prime you can graphically depict your math functions and results using plots and charts. Plots are created from the Plots tab. The available types are:

X-Y Polar Contour 3D The Chart Component was introduced in PTC Mathcad Prime 5.0 and provides additional capability for creating high-end X-Y plots. It provides functionality for controlling all aspects of the display of your graph and allows you to generate images that are suitable for publication in reports, articles, books, and web pages. Plots and Charts are great tools for checking the results of your engineering calculations. But since they aren’t necessary for integration Creo Parametric models with PTC Mathcad Prime worksheets, they are beyond the scope of this book. For more information on Plots and Charts, please visit https://help.ptc.com or click the F1 key inside PTC Mathcad Prime.

3.5. Windchill Integration Your Mathcad worksheets can be stored in Windchill PDMLink. This is recommended especially if you are going to use Prime Analysis features, in which the Mathcad worksheet is external to your CAD models. PTC Mathcad Prime does not integrate directly with Windchill; there is no embedded browser like in Creo Parametric. Therefore, to manage Mathcad worksheets in Windchill, you will need to install and configure a separate application called the Windchill Workgroup Manager. Integrating PTC Mathcad Prime with Windchill is beyond the scope of this book.

Chapter 4.

Mathcad Basics

Key Points: PTC Mathcad Prime uses real math notation so we can type in math expressions with our keyboard. We can document our calculations using Text Blocks and Text Boxes. There are different kinds of equals signs in Mathcad. For Creo Parametric integration the ones that we will use the most are the Evaluation and Definition operators. We can create variables that stand for different quantities of interest. Mathcad has over 400 built-in functions that we can use for our engineering calculations. We can also create our own custom math functions.

4.1. Basic Math Mathcad has more functionality than can be covered in this book. But in this chapter, we’ll cover the functionality most relevant to connecting Creo Parametric parts and assemblies to Mathcad worksheets. As mentioned in the previous chapter, one of the benefits of PTC Mathcad Prime is that it uses real math notation and you don’t have to learn any kind of special programming language. To perform math, simply start typing in your values, constants, and variables. (More about the latter two later.) Then simply use addition, subtraction, multiplication, and division using the standard keys on the keyboard.

Figure 4‑1: Basic math in PTC Mathcad Prime.

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.

4.2. Text Regions Another advantage of PTC Mathcad Prime is the ability to document your process as you perform calculations. This is critical to ensure that you and others can understand your thinking, logic, and processes later. In Mathcad you can use Text Regions for documenting your calculations, or whatever information you want to capture about your product. A Text Block A Text Box moved.

spans across the width of the page. has drag handles and can be resized and

Both commands are available from the Regions group on the Math tab. Here are examples of Text Blocks and Text Boxes on a worksheet:

Figure 4‑2: Text Boxes and Text Blocks.

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.

4.3. Equals Signs in PTC Mathcad There are a variety of different kinds of equals signs in PTC Mathcad Prime that have different uses. The two that come into play most often with integrating Creo Parametric models to Mathcad Worksheets are: The Evaluation operator, to calculate and show the value of a variable, a function, vector, matrix, or program. This is a simple equals sign (=). The Definition operator, which defines a variable, function,

vector, matrix, or program. This is a colon followed by an equals sign (:=). The keyboard shortcut is the colon : key.

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 Global Definition operator discussed in the next section. The Local Assignment operator, which is used inside of programs. These are discussed in Chapter 5. The Comparison Equal To operator for evaluating whether a condition is true. This operator is also used in Solve Blocks. This is discussed in section 4.3.2. The Symbolic Evaluation operator, which is discussed in section 4.3.3.

4.3.1. Global Definition Operator Mathcad worksheets are evaluated the same way that people read in the Western world: from right to left and then top-to-bottom. Sometimes, though, you may be several sheets deep and want to define a variable or set of units that can be used anywhere in the worksheet. To do this, you can use the Global Definition operator, which appears as three horizontal bars. The command is available from Math > Operators and is located in the Definition and Evaluation group. The keyboard shortcut is the CTRL and SHIFT keys with the tilde character ~. Any mathematical expressions that use the Global Operator are evaluations at

the beginning of the calculation cycle. Uses for the Global Definition operator 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.

Figure 4‑4: The Global Definition operator.

4.3.2. Comparison Equal To Operator The Comparison Equal To operator is used in the following ways: Evaluating expressions used in conditionals and loops inside of programs. Conditionals include If-Then-Else constructs, and loops include For and While constructs. These are used inside of programs in Mathcad, which can be thought of as a complex version of a user-defined function. Programs are covered in Chapter 5. Establishing Constraints in Solve Blocks, which are used to solve systems of equations and perform optimizations. The latter is covered in Chapter 6. Documenting your calculations, as shown in Figure 4‑5. The Comparison Equal To operator can be entered from Math > Operators and is found in the Comparison group. The keyboard shortcut is the CTRL key and the equals sign.

Figure 4‑5: Using the Comparison Equal To operator for documentation.

4.3.3. Symbolic Evaluation As the name states, the Symbolic Evaluation operator allows you to evaluate expressions symbolically as opposed to numerically:

Figure 4‑6: Symbolic evaluation of derivatives and integrals.

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. They are case-sensitive. There is no limit to the length of a variable name. Tip: When defining a variable for the first time, use a Text Box to explain the variable. Document as you go. The rules for naming a variable apply to functions as well. See section 4.5 for more information about functions.

4.4.1. Greek Letters Upper- and lower- case Greek letters can be accessed from the Symbols drop-down menu in the Operators and Symbols group on the Math tab:

You can also convert upper- and lower- case English alphabet letter to Greek by typing the keyboard shortcut of the Control key CTRL and the letter G on the keyboard. This will convert the immediately previously typed character into its Greek equivalent. Do not use Greek letters in the names of variables used as inputs or outputs for Creo Parametric integration! Creo Parametric does not support Greek letters.

4.4.2. Pre-Defined Constants Mathcad has several pre-defined constants from math and physics. The math constants include: Infinity ∞, which is evaluated as 10 to the 307th power. The logarithm base e (approximately 2.71828). The so-called “circle constant” pi or π, which is the ratio of a circle’s circumference to its diameter. Note: As a circle is defined as the set of points in twodimensional space that are the same distance from a center

point. This distance is the radius of the circle. Therefore, Tauists such as me consider the true circle constant to the ratio of a circle’s diameter to its radius to be the true circle constant. This constant tau, or τ, is approximately 6.28318 and equal to 2π. Notice how often 2π appears in equations and integrals. The physics constants include, but are not limited to: The speed of light c. Planck’s constant h and Planck’s reduced constant h-bar, which is h divided by 2π. The atomic mass unit m.u. Avogadro’s Number N.A. Note the use of 2π, or τ, in Planck’s reduced constant. These can be accessed from the Constants drop-down in the Operators and Symbols group on the Math tab:

Figure 4‑7: Mathcad Constants.

Many of these have a keyboard shortcut, which as always can be viewed from the tool tip when hovering your mouse over the icon. When evaluated or used in expressions, these constants will appear by default in a dark green color:

Figure 4‑8: Evaluation of the pre-defined constants.

You can override these pre-defined constants with a definition operator:

Figure 4‑9: Overriding a pre-defined constant.

4.4.3. Subscripts vs. Vector and Matrix Indices Variable names can include subscripts. For example, you may want to have variables vi and vf to denote initial and final velocity respectively. To create a subscript, when typing in a variable name, click the Subscript icon in the Style group on the Math tab. Alternatively, you can use the keyboard shortcut of the CTRL key and the minus sign to define a subscript as you are typing the variable name in the graph paper interface.

A variable name can include more than one subscript if so desired. However, vectors and matrices also use subscripts to indicate individual elements in the vector or matrix. To define an element in a vector or matrix, you can use the Matrix Index operator from the Vector / Matrix Operators drop-down command on the Matrices / Tables tab:

Figure 4‑10: Matrix Index Operator.

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.4.4. Implied Multiplication Mathcad also supports implied multiplication. For example, 100x is evaluated as 100 multiplied by the variable x, and 2π is evaluated as 2 times pi. There is no need to use the multiplication operator when typing in these expressions. (Numbers are not allowed as the first character in the name of a variable or function for this reason.)

4.4.5. Imaginary Numbers Mathcad supports the use of complex- and imaginary- numbers, which are denoted by the letters i and j. Both are evaluated to the square root of -1. If i and j are used as variable names, implied multiplication is not supported. That is, if you want to evaluate 3 times the variable i, you will have to type the multiplication operator after typing in the number 3. Otherwise, 3i is

evaluated as 3 times the square root of -1.

Figure 4‑11: Imaginary Numbers and Implied Multiplication.

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: Over 400 different built-in functions from a variety of different areas of mathematics. User-defined functions that combine math and built-in functions.

4.5.1. Built-In Functions PTC Mathcad Prime contains over 400 built-in functions that you can use in math regions, functions, programs, solve blocks, and any other mathematical expressions. To use a function, you can type it in directly in the worksheet if you know its name and arguments. Otherwise, you can click on the Functions tab. Functions can be selected from popular groups including: 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.

4.5.2. User-Defined Functions In PTC Mathcad, you can create your own custom user-defined functions. These functions have a name and the variables that are passed to them inside parentheses. For example: f(x,y) := x + y The same rules for variable names, as described in section 4.4, apply to the name of functions. The inputs to a function can be numbers, strings, variables, vectors, and matrices. The variables in the parentheses in the function definition do not need to exist prior to the definition. These variable names are used locally within the function definition. As with defining variables, you will use the Definition operator to define the mathematical expression you want the function to perform on the right-hand side of the expression.

Chapter 5.

Programming

Key Points Programs perform a specified set of actions on inputs and return an output. Programs are defined using the Definition operator. Within the program, the Local Assignment operator is used to define variables. The power of programs come from the ability to use if-then-else constructs and for and while loops.

5.1. Essentials of Programs I like to think of programs in PTC Mathcad Prime as user-defined functions but with a higher level of complexity. A user-defined function performs a specified mathematical expression that can include Mathcad’s built-in functions and any other mathematical operations. The inputs sent to a function or program can be numbers, strings, variables, vectors, and matrices. Programs have additional levels of complexity because they include the following additional functionality: Conditionals. These evaluate whether a condition like equals, less than, or greater than is true. Loops. These perform a set of operations multiple times. Processing and construction of vectors and matrices. The inputs to a program can be a vector or a matrix (just like built-in and userdefined functions), but you can write code in your loops that will construct a new vector or matrix. In addition, just like popular programming languages Java, C, Python, and Ruby, programs in PTC Mathcad Prime support recursion – a program can call itself. For example, Figure 5‑1 shows recursion used to calculate a Fibonacci number. I most often use programs for processing large amounts of information, typically read into PTC Mathcad Prime from Excel files. I write blogs for

PTC’s Mathcad website. I use programs to process Excel spreadsheets containing sports data from NCAA March Madness, the National Football League, and World Cup.

Figure 5‑1: Recursion in a program to calculate Fibonacci numbers.

5.2. Initiating a Program The same rules for naming variables, as explained in section 4.4, applies to the names of programs. After the name, you will use parentheses to define the inputs to the program, just like a user-defined function. These inputs in the program definition are used locally inside of the program. The next step in defining the program is to use the Definition operator, which is the keyboard shortcut of the colon key. To begin defining the actions that will take place inside of the program, click on the Math tab, the Programming drop-down, and the Program operator. It looks like two vertical bars. The keyboard shortcut is the right bracket.

Figure 5‑2: Program Operator.

5.3. Initializing the Return Variable The program will return a variable at the completion of its run. This variable is local to the program. Often the first line of the program will create and initialize this local variable. This will define the default value to be returned by the program in the case that none of the actions in the program occur. For example:

Figure 5‑3: Initializing a new result for a program.

However, this is not necessary in many cases. If the output of a program is a vector or a matrix, it will be created automatically when the elements of the matrix or vector are created.

5.4. Local Assignment Operator Within the program, the Local Assignment operator is used for definitions. Attempting to use the standard Definition operator (keyboard shortcut colon : ) will result in an error. Figure 5‑3 above shows the Local Assignment operator being used to set the initial value of the result that will be returned from the program. The Local Assignment Operator looks like a left arrow. It can be selected from Math > Programming. The keyboard shortcut is the left brace {.

5.5. If-Then-Else Constructs If-Then-Else constructs are used to evaluate a condition and perform operations based on whether the condition is true or false. There is not actually a keyword for then used in programs; the operations and expressions following the if evaluation are the actions to be performed when evaluated to be true. The available keywords for if-then-else constructs include:

if: to evaluate a condition. else: actions to be performed if the condition evaluated is false. Else and its actions are optional; you are not required to use else within the construct. else if: an additional evaluation you can perform if the preceding if or else if statement is evaluated to be false. also if: this allows you to evaluate an additional condition after a previous if or also if statement. The also if conditions are evaluated regardless of the result of the previous if or also if statement. An if statement cannot contain both else if and also if statements. These different keywords can NOT be typed in directly within a program. You must use the appropriate command from the Math > Programming drop-down or type in the corresponding keyword. For example, the keyboard shortcut for if is the right brace character { and the keyboard shortcut for else are the CNTRL, SHIFT, and right brace characters. The conditions that are evaluated for Creo Parametric integrations with PTC Mathcad Prime include: 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.

5.6. For Loops A for loop is used to perform an operation or a set of operations for a specified number of iterations. The elements of the for loop include:

The for keyword. The counter variable. The starting index. This can be a number or a variable. The stopping index. This can be a number or a variable. The for keyword cannot be typed directly. It is placed in the program using Math > Programming > for. The keyboard shortcut is the CTRL, SHIFT, and quotation mark “ keys. When the for keyword is invoked, it will automatically create placeholders for the counter variable and the range variable separated by the “is an element of” symbol. Below the for statement an additional line will be added in the program with two vertical bars to indicate the operation(s) that will take place during the loop:

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.

5.7. While Loops A while loop is used to perform an operation or set of operations depending on the evaluation of a mathematical expression. The while keyword cannot be typed in directly. It is entered by selecting Math > Programming > while. The keyboard shortcut is the CTRL key and the right bracket ]. When the while keyword is entered, another line is automatically created below it. The operations to be performed while the condition is true are entered here.

5.8. The Break Operator

The break operator is used to exit the current loop based on some evaluated condition. It cannot be typed directly into the program. It can be entered by selecting Math > Programming > break. The keyboard shortcut is CONTROL + SHIFT + left brace {.

5.9. The Continue Operator The continue operator is used when the result of an evaluation should not result in any operation actually taking place. Like the other keywords used in programs, it cannot be typed directly into the program. It can be entered from Math > Programming > continue. The keyboard shortcut is CTRL + SHIFT + colon :.

5.10. The Return Operator The return keyword is used at the end of the program to specify which of the local variables should be sent back as the result of the program call. You cannot type in the return keyword directly. You can enter it by selecting Math > Programming > return. The keyboard shortcut is CTRL and the backslash \ key.

5.11. Calling the Program A program can be called directly and evaluated, or assigned to a variable using the Definition operator.

Figure 5‑4: Calling a program.

5.12. Example Program Here is an example of a program that incorporates many of these functions, including: Variable and vector initialization. A for loop. A while loop. The break operator. The return operator. One day I was thinking about prime numbers, and I realized that if a number is not evenly divisible by any number less than its square root, then it’s prime. (Erastosthenes of Greece figured that out over two millennia ago.) We can write a program that returns a vector of all the prime numbers within a given range:

Figure 5‑5: Prime numbers program.

Let’s take a look at some results:

Figure 5‑6: Results of the prime number program.

Programs can be used to devise some pretty interesting engineering calculations. This particular program returned a vector. A Prime Analysis feature can actually generate datum features like datum points, coordinate systems, and curves. This will be discussed in section 12.4.

Chapter 6.

Optimization

Key Points The functions maximize and minimize are used in a Solve Block to perform optimizations for an engineering problem. The evaluated variables from an optimization can then be used as output variables from PTC Mathcad Prime to Creo Parametric.

6.1. Optimization Concept Often in product development, our goal is to take our initial designs and then iterate towards the best possible solution. Usually this means maximizing or minimizing one or more quantities in our models. Examples of optimization goals include: 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: The function to be optimized. The variables to be passed to the optimized function. Note that these have to be in the correct order as defined by the function.

Note that you can use Maximize and Minimize (with capital letters) interchangeably with the lowercase versions of the functions.

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.

Figure 6‑1. Inserting a 5 by 1 vector.

Figure 6‑2. How the vector appears when initially created.

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:

Figure 6‑3: Solve Block construct.

The construct consists of three areas: 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:

Figure 6‑4: Example Solve Block for optimization.

The Solve Block construct is an extremely powerful aspect of PTC Mathcad Prime and provides a simple method of determining the outputs you want to generate to send back to Creo Parametric.

6.5. Evaluation of Results Below the Solve Block, use evaluation math regions to see the optimized values. These evaluations can then be designated as outputs from PTC Mathcad Prime to be sent back to Creo Parametric in an embedded worksheet or a Prime Analysis feature. Outputs will be discussed in chapters 11 and 12.

Figure 6‑5: Evaluation of the Solve Block results to use as outputs.

Chapter 7.

Mathcad Tips and Tricks

Key Points Almost all commands and operators in PTC Mathcad Prime have keyboard shortcuts. Learning these can improve your efficiency with using Mathcad. The Ceil and Floor functions can be used to round your results up and down to appropriate values depending on your circumstance. The PTC Community website at https://community.ptc.com is an invaluable resource for novice and experienced Mathcad and Creo Parametric users.

7.1. Keyboard Shortcuts Most commands in PTC Mathcad can be executed via a keyboard shortcut to expedite entering math regions. Some can involve a single keystroke, but others involve holding down the Control key CTRL and/or the SHIFT key on the keyboard. On the Resources tab, you can also click the Keyboard Shortcuts command.

Figure 7‑1: Accessing Help for keyboard shortcuts.

Clicking on this command will open an Adobe Portable Document Format (PDF) file that explains many, but not all, the PTC Mathcad Prime keyboard shortcuts.

Figure 7‑2: Sample of the help for keyboard shortcuts.

Over time. you will most likely memorize the keyboard shortcuts you use most often.

7.2. Rounding Values PTC Mathcad can display your values out to 15 decimal places. For design purposes, this is more than sufficient. However, we often want to round our values down or up based on our calculations. For example, for improved structural integrity and ease of documentation and manufacturing, you may want: A length dimension to be rounded up to the next half inch. A hole diameter to be rounded down to the next integer when the hole is measured in metric units. If using Imperial (or the US Customary System in Mathcad), we may want to round down to the nearest quarter inch. The radius of a fillet (or a “round” in Creo Parametric parlance, not to be confused with the round function in Mathcad) should be rounded up to the next millimeter or eighth of an inch.

A keyway dimension to be rounded up to the next sixteenth of an inch. The functions that facilitate these operations can be found in the Truncation and Round-Off group. There are functions that perform truncating (cutting off at a certain number of decimal places) and rounding (the nth digit in the decimal is rounded up or down depending on the value of the next digit in the decimal). The ceil function (lowercase) accepts one value as an input and returns an integer greater than or equal to the input. The Ceil function (uppercase) accepts two inputs, and returns a value greater than or equal to the first input in multiples of the second input. The floor function (lowercase) accepts one value as an input and returns an integer less than or equal to the input. The Floor function (uppercase) accepts two inputs, and returns a value less than or equal to the first input in multiples of the second input. Here are how these functions look in PTC Mathcad:

Figure 7‑3: Mathcad functions for rounding.

These functions can also be used with variables and units. The uppercase versions of the functions can also be used to find upper or lower values in other units. For example:

Figure 7‑4: Rounding functions with units.

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.

7.3. Password Protected Areas By clicking Document > Area, you can create a collapsible area in your Mathcad worksheet. The area indicator in the left side of the sheet margin shows a plus sign when the area is collapsed; clicking on it will expand the area. When the area is expanded, the indicator changes to a minus sign, allowing you to collapse it. By right clicking on the area indicator, you can choose Protect Area to add a password:

Figure 7‑5: Password protecting an area.

Be careful using this functionality; if you forget the password, there are no means to unlock the password protected areas.

7.4. Equation Wrapping Sometimes in PTC Mathcad Prime, you may want to define a math region expression or function that extends beyond the length of your graph paper interface. In this situation, you have two options: 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.

7.5. Additional Resources PTC provides resources that can get you started performing engineering calculations quickly and easily: 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.

7.5.1. PTC Community The PTC Community website has an entire section devoted to PTC Mathcad Prime. It can be found at: https://community.ptc.com/t5/PTC-Mathcad/ct-p/PTCMathcad Alternatively, you can go to the PTC Community (https://community.ptc.com) and navigate to the PTC Mathcad community from the home page. It is divided into three main sections:

PTC Mathcad: here you can submit questions and other Mathcad users from around the world will help you. PTC Mathcad Ideas: if you have an idea for an enhancement or improvement to the software, post it here and others in the community can vote on it. Trust me, the program managers at PTC pay attention to these requests. PTC Mathcad Tips: suggested techniques and announcements from PTC.

7.5.2. YouTube Creo Parametric Channel I have a YouTube channel for Creo Parametric and I have a Playlist for PTC Mathcad Prime videos. This channel can be found at https://www.youtube.com/CreoParametric.

Part II – Creo Parametric Integration Chapter 8.

Creo Parametric Overview

Key Points Creo Parametric is a feature-based parametric modeler. The order of features in a model and parent-child relationships determine how changes are propagated. Features often contain dimensions. Parameters can be used to control our features and models. Real number and integer parameters can be inputs to and outputs from PTC Mathcad Prime. Relations are equations that control dimensions and parameters in our model as a function of other dimensions, parameters, or numbers.

8.1. Computer Aided Design with Creo Parametric Creo Parametric is a feature-based parametric modeler. Let’s break that down to discuss the implications and ramifications: Creo is history-based; the order in which features appear in the Model Tree determines how your geometry is constructed. Part models consist of features. When creating new features, you have to reference existing features to define the new feature’s location and possibly attributes like size. The new feature that you’re creating is the child of the features that you reference. The existing features that you reference are the parents of the new feature you are creating. These parent-child relationships are extremely important in Creo Parametric. Changes to a parent will be propagated to the children. This is one aspect of your model being parametric.

Features are driven by dimensions and parameters. Features also have options and attributes that determine the geometry that is created. When we talk about models being parametric, we’re really talking about how we make changes and how those changes are propagated to geometry, parts, and assemblies. The changes are propagated based on the parent-child relationships. Creo Parametric is also associative. That means a change made at any level is propagated automatically to all other levels. Changes to your parts are propagated to the assemblies that contain them and the drawings that reference them upon retrieval and regeneration. Changes to the assemblies are propagated to the parts and drawings. Changes made in the drawing – for example, to model dimensions and tolerances – are propagated to the parts and assemblies that own those dimensions and tolerances.

8.2. Features and Dimensions Features are the basic building blocks of parts in Creo Parametric. There are several different classes of features, including but not limited to: Datum Features like Datum Planes, Datum Axes, Datum Points, Datum Coordinate Systems, and Datum Curves. Sketch-Based Features like Extrudes and Revolves. Engineering Features like Holes, Rounds, and Chamfers. Surface Features like Boundary Blend, Fill, and Style. Data Sharing Features like Copy Geometry and Publish Geometry. Editing Features like Pattern, Mirror, Trim, and Merge. Most features have dimensions, which are numeric values that describe the size or location of geometry, or the quantity of instances in a pattern. All dimensions have two forms:

The numeric form, which is the value of the dimension. The symbolic form, which is the name of the dimension. Model dimensions initially have a name that starts with the letter d followed by a number. The symbolic form of the dimension can be renamed to something more intuitive and user friendly. It is highly recommended that you rename dimensions that will be used in Relations as discussed in section 8.4 and 3D Annotations discussed in section 10.3.

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: Manufacturing or sourcing information. Numerical values that we want to drive dimensions. Data management information, like a model’s creator, version information, and life cycle state. There are four different kinds of parameters that you can create: 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. The Parameters

dialog box can be accessed from:

The Tools tab in part- and assembly- modes. The Model tab in assembly mode. The Model Intent overflow menu on the Model tab in part mode. The Command Search in the upper right corner.

Here is an example of the Parameters dialog box:

Figure 8‑1: The Parameters dialog box.

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: A part’s length to change with its width. The number of holes in a pattern to update with changes to the model. The radius of one fillet to match that of another round feature. Gear tooth dimensions to change with the root circle diameter. These equations between dimensions and parameters are called Relations. The Relations

command can be accessed from:

The Tools tab in part- or assembly- mode. The Model tab in the Model Intent group on the ribbon in assembly mode. The Model Intent overflow menu on the Model tab in part mode.

The Command Search in the upper right corner. The Relations command will open this dialog box:

Figure 8‑2: The Relations dialog box.

Integrating Mathcad worksheets with Creo Parametric models makes heavy use of Relations. We use Relations to assign the output values from the calculations in our Mathcad worksheets to Creo Parametric dimensions and parameters. Recommendation: the forward slash and asterisk /* makes the rest of any line a comment. Document your Relations with comments to make your model user-friendly to others trying to understand your Design Intent later. Figure 8-3 shows an example of the Relations dialog box performing this function for an embedded worksheet. Inputs and outputs from the embedded PTC Mathcad Prime worksheet have the name of the alias followed by a colon and the word MATHCAD. The inputs are driven by model parameters

and the outputs drive model dimensions.

Figure 8‑3: Relations using Mathcad inputs and outputs.

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.

8.6. Notification Center Warnings will show as yellow flags in the lower right-hand corner of the Creo Parametric interface. By default, these include when embedded Mathcad analyses are out of date.

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.

9.1. Importance of Units Compatibility On December 11, 1998, NASA launched the Mars Climate Orbiter space probe from Cape Canaveral in Florida as part of the Mars Surveyor 98 project to study the climate history of the planet. Contact with the lander was lost on September 23, 1999. The search was called off the next day, and the day after that, the vehicle and mission were declared lost. A subsequent investigation determined that the spacecraft was most likely lost after a planned correction maneuver for Mars orbital insertion brought it much lower than the mission plan. At a much lower altitude, the vehicle would either have been destroyed in the Martian atmosphere or severely damaged and sent off into space. What caused the Mars Climate Orbiter to be at the wrong altitude? The wrong commands for the correction maneuver were sent to the vehicle. NASA is on the metric system. The vehicle was expecting the impulse values to be in newton-seconds. However, the software used by Lockheed Martin to calculate impulse provided values in pounds-force seconds. Therefore, the impulse that the correction maneuver delivered was 4.45 times

The total project cost was $327.6 million. Almost a third of a billion dollars, not to mention how many thousands of people-hours of development and ten months of mission time, were wasted.

Because of a units mismatch error. How much could that kind of error cost you and your product development organization? In this chapter we will look at how units are managed in both PTC Mathcad Prime and Creo Parametric, and discuss how to make sure you are communicating the correct units in both.

9.2. Units in Mathcad To apply units to a number, simply use the multiplication operator and type in the abbreviation for the unit. For example:

Figure 9‑1: Applying units to numbers.

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:

Figure 9‑2: The Units drop-down menu.

All calculations are evaluated in terms of the worksheet’s set of units:

Figure 9‑3: Evaluating in the worksheet units.

Note the issue with evaluating temperature. Performing math with temperature units will be discussed in section 9.4.5. To express results in a different set of units than those from the default unit system, position your cursor at the end of the unit, hit the backspace key, and

either type in the desired units or use the Units drop-down menu. You can perform math using different units for the same quantity. Mathcad will report the result in the worksheet’s units:

Figure 9‑4: Resolving math to the worksheet units.

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.

Figure 9‑5: Error for incompatible units.

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.

Figure 9‑6: Automatic units balancing.

9.2.1. Mathcad Default Units Systems

PTC Mathcad Prime comes with three default systems of units: SI: International System of Units. USCS: United States Customary System. CGS: Centimeter Gram Second. To change the default unit system for the worksheet, simply click Math > Unit System and select the desired default unit system.

Figure 9‑7: Changing the worksheet unit system.

The base units of each system are as follows:

Table 1: Units Systems Base Units System SI USCS CGS

Length Mass meter (m) kilogram (kg) foot (ft) pound (lb) centimeter (cm) gram (gm)

Time second (s) second (s) second (s)

The other additional base units for other quantities for the SI unit system include:

Table 2: SI Units Current Luminous Intensity Currency Substance Temperature

Ampere (A) Candela (cd) Dollar ($) Mole (mol) Kelvin

9.2.2. Defining a New Custom Unit in Mathcad In PTC Mathcad Prime, you can create your own custom unit. For example, let’s say I want to use the Physics 101 velocity unit of furlongs per fortnight.

Figure 9‑8: Furlongs per fortnight.

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:

Figure 9‑9: The Labels drop-down menu.

With the cursor still positioned on the name of the variable, select Unit from the drop-down list.

Figure 9‑10: Changing the region label to Unit.

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.

9.3. Units Systems in Creo Parametric Unit systems in Creo Parametric are based around basic units for mass (or force), length, time, and temperature. Derived units for other quantities, like area, volume, and force, are generated from these basic units. Creo Parametric comes out of the box with seven different Systems of Units: Centimeter Gram Second (CGS) Foot Pound Second (FPS) Inch lbm Second (Creo Parametric Default) Inch Pound Second (IPS) Meter Kilogram Second (MKS) Millimeter Kilogram Second (mmKs) Millimeter Newton Second (mmNs) Note that some of these unit systems are based around mass units (CGS, Inch lbm Second, MKS, and mmKS), while the others are based around force units (FPS, IPS, and mmNs). To access or change the unit system for your model, click File > Prepare > Model Properties. This will open the Model Properties dialog box:

Figure 9‑12: The Model Properties dialog box.

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: Set: apply a different unit system to the model. New: create a new unit system. Copy: create a new unit system based on an existing one. Info: opens an information window to list the basic and derived quantities of the selected unit system. The Units tab in this dialog box allows you to see all the possible units available in Creo Parametric. You can filter from All to a specific type of quantity.

Figure 9‑13: The Units Manager dialog box.

9.3.1. Units for Dimensions Length dimensions have the appropriate unit for your unit system. The units are included for input parameters sent to PTC Mathcad. Angle dimensions are discussed in section 9.4.4.

9.3.2. Units for Parameters User-defined parameters in Creo Parametric can have units. In the Parameters dialog box, the two columns on the right allow you to specify Unit Quantity and Unit.

Figure 9‑14: The Parameters dialog box.

It’s helpful to select a Unit Quantity first to narrow down the available units, but this is not required.

Figure 9‑15: Specifying a unit quantity for a parameter.

Then you can select the appropriate unit for the parameter.

Figure 9‑16: Selecting the unit for Young's modulus.

Parameters generated by Datum Analysis Features (DAF) automatically have units. For example, if you use Analysis > Mass Properties to generate a Datum Analysis Feature, the parameters for mass, volume, surface area, and so on, will have the appropriate units.

9.4. Units Compatibility Between Creo Parametric and PTC Mathcad When planning your strategy for using engineering calculations in PTC Mathcad Prime to drive model geometry in Creo Parametric, one of your first steps should be to identify the units of the inputs and outputs that you will be passing back and forth. First let’s look at some of the units you can use in both applications.

9.4.1. Fundamental Units The following table shows the corresponding units between Creo Parametric and PTC Mathcad Prime for the basic quantities.

Table 3: Fundamental Units in Creo and Mathcad Quantity

Unit

Creo Parametric

PTC Mathcad Prime

Mass

Length

Time

Temperature

gram kilogram pound-mass slug Metric ton millimeter centimeter meter Inch Foot second minute hour day Celsius Fahrenheit Kelvin Rankine

g kg lbm slug tonne mm cm m in ft sec min hr day C F K R

gm kg lb slug tonne mm cm m In ft s min hr day °C °F K R

Additional information regarding performing calculations with temperature units will be discussed in section 9.4.5.

9.4.2. Derived Units The following table shows the corresponding units between Creo Parametric and PTC Mathcad Prime for some relevant engineering derived quantities.

Table 4: Derived Quantities. Quantity Force

Unit pound-force ton-force dyne newton kilonewton

Creo Parametric lbf ton dyne N kN

Mathcad lbf tonf dyne N kN

Area

Volume

Pressure

Energy

square millimeter square centimeter square meter square inch square foot cubic millimeter cubic centimeter cubic meter cubic inch cubic foot Pascal Mega Pascal Giga Pascal pound per square inch kips (1000 psi) erg Joule calorie BTU

sq_mm sq_cm sq_m sq_in sq_ft cu_mm cm_cm cu_m cu_in cu_ft Pa MPa GPa psi

mm2 cm2 m2 in2 ft2 mm3 cm3 m3 in3 ft3 Pa MPa GPa psi

ksi erg J cal BTU

ksi erg J cal BTU

Note: Do not confuse tons and tonnes. A ton is a unit of force (weight) and a tonne is a unit of mass.

For a complete list of units compatibility between Creo Parametric and Mathcad, please see: https://support.ptc.com/help/creo/creo_pma/r7.0/usascii/#page/model_analysis%2Fbemod

9.4.3. Mathcad Evaluation in Base Units PTC Mathcad Prime understands units and can reconcile the result in the appropriate units. Let’s take a look at a simple engineering calculation for voltage:

Voltage is equal to current times resistance and the result is reported in volts. However, users have the option to turn off unit conversion and report the result in base units. Here is the result with the Base Units option turned on:

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.

9.4.4. Angle Dimensions Angles in Creo Parametric are measured in degrees, whereas angles in Mathcad are measured in radians. (Interestingly, in all the PTC-supplied Systems of Units, the derived units for angular velocity and angular acceleration use radians.)

Therefore, when passing angular dimensions between Creo Parametric and Mathcad, you will want to perform conversions in Creo Parametric. First, you will want to convert Creo Parametric angular dimensions to radians to send as an input to Mathcad, and then convert outputs in radians back to degrees. Let’s take a look at a very simple example. I have a Dimension pattern for holes located in a circle. My model has a parameter for the number of holes. That input will be sent to PTC Mathcad Prime, which will then output the angle. (Yes, we can do this very easily in Creo Parametric without a Mathcad worksheet. This can be done in the Axis Pattern tool.) Here is the model:

Figure 9‑17: Part model for angle conversion.

Here is the Mathcad worksheet:

Figure 9‑18: Mathcad worksheet for angles.

Here is the Prime Analysis feature:

Figure 9‑19: Prime Analysis feature for angle conversion.

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).

9.4.5. Temperature Units The following units are available in PTC Mathcad Prime for temperature:

Figure 9‑21: Temperature units in Mathcad.

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:

Figure 9‑22: Temperature units example.

The worksheet contains the following: We establish our Young’s Modulus. We define the Coefficient of Thermal Expansion. Note that the unit is per Delta degrees Celsius; PTC Mathcad gives an error when degrees Celsius is used in the denominator. The function for thermal stress due to a temperature differential is defined. Three inputs are defined. Note that the first input shows an error. It is “This value must be a scalar or a matrix.” The second input in Delta degrees Celsius is fine. The third input in Kelvin is fine. The results: Stress for the first input registers incorrectly as zero Pascals. The results for both Delta degrees Celsius and Kelvin

are correct. The Coefficient of Thermal Expansion can be defined in units of per degree Kelvin. Temperature is a measure of the average kinetic energy or an object or a system. The Celsius and Fahrenheit scales have arbitrary zero points above absolute zero. A negative temperature on those scales doesn’t indicate a negative value of kinetic energy. A doubling in temperature in those scales does not mean the kinetic energy of the system is doubled. Therefore, performing math using degrees Celsius or degrees Fahrenheit causes problems. Even simple math using those units results in incorrect values. Most of the time in PTC Mathcad Prime, you have to use the Delta versions of those units when performing math. The Kelvin and Rankine scales do not have these problems. The zero point for those scales are located at absolute zero instead of the arbitrary value of the freezing point of water or the freezing point of an ice-water brine solution. (Seriously, that’s what the Fahrenheit scale is based on.) Here are some evaluations using the Kelvin and Rankine scales:

Figure 9‑23: Calculations with Kelvin and Rankine.

If you need to perform engineering calculations using temperature, use the Kelvin and Rankine scales where you can. If possible, change the units of your Creo Parametric model to use these scales instead of Celsius and Fahrenheit.

9.5. Mathcad and Creo Parametric Integration 9.5.1. Prime Analyses Managing units in a Prime Analysis feature is quite easy. Let’s take a look at one example:

Figure 9‑24: Prime Analysis with dimension inputs.

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.

Here is a second example where the inputs are parameters instead of dimensions:

Figure 9‑26: Prime Analysis with parameter inputs.

Our model is in imperial units but the Mathcad worksheet is in SI.

Our inputs are parameters that have units applied to them. The outputs are returned in meters, the worksheet unit for length. We can use the Unit drop-down to convert the resulting parameters to inches, our model’s unit for length. Then it’s simply a matter of writing our Relations between model dimensions.

Figure 9‑27: Relations for driving model geometry from Prime Analysis feature outputs.

9.5.2. Embedded Worksheets For embedded worksheets, the parameters are returned in the worksheet’s units. Length dimensions are in feet for USCS; meters for SI; and centimeters for CGS. Therefore, you want to make sure that the Unit Sensitive option is turned on in the Relations dialog box. 9.5.2.1. Unit Sensitive Option If Unit Sensitive is turned on, Creo Parametric will recognize and factor in the output parameter units in your calculation. To do this, click Utilities and

check Unit Sensitive:

Figure 9‑35: Unit Sensitive Option.

This can be controlled by the configuration option relations_unit_sensitive. This should be set to yes, which is the default value. This could also be turned off – accidentally or intentionally – in your model templates. Why wouldn’t everyone have the Unit Sensitive option turned on? Sometimes people do funny math in the Relations dialog box in order to get an intended result. Having Unit Sensitive turned on can sometimes cause issues with that. 9.5.2.2. Repercussions: Unit Sensitive Turned Off Let’s take a look at a simple scenario that shows the effects when Unit Sensitive is turned off:

Figure 9‑28: Test scenario for embedded worksheets.

This is the model: This part consists of two Bodies: a block and a sphere. (Multibody modeling was introduced in Creo Parametric 7.0.) The block is 1 inch by 2 inches by 3 inches. The sphere has a radius of 2 inches. The Analysis > Mass Analysis tool was used to calculate the mass properties of each body. The mass property calculation was created as a feature in the model that generates a parameter for the volume. Annotate > Show Model Annotations was used to display the model dimensions as 3D Annotations in the Graphics Area. Annotate > Note was used to create Flat to Screen notes. The volume note includes parameters for the volume calculated in the mass property Datum Analysis Features. A PTC Mathcad worksheet calculates the radius of the sphere that has the same volume as the block:

Figure 9‑29: Mathcad worksheet for the test scenario.

The resulting parameters are in the Mathcad units for feet:

Figure 9‑30: Embedded Mathcad output parameters for test scenario.

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.

When we regenerate the model, we get the following result:

Figure 9‑32: Incorrect results 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.

Now when we regenerate the model, we get the correct result:

Figure 9‑34: Test scenario working correctly.

Thus, having Unit Sensitive turned off is a huge problem. 9.5.2.3. Additional Strategies There are a few alternate strategies if you must have Unit Sensitive set to no:

Send unitless parameters as inputs to PTC Mathcad Prime and receive unitless parameters back from the worksheet. This radius calculation in the previous scenario could have been performed entirely without units. The same strategy was employed in the box example in chapter 2. Perform a conversion to the results to scale them to Creo Parametric model units by dividing the results by the Creo Parametric model units. This will be discussed in more detail in the next section. Look at the calculations in the next figure to see examples of dividing by units to convert the Rout and Tout variables.

Figure 9‑36: Dividing by Units.

Convert the embedded Mathcad output parameters to the Creo model dimensions in the Relations dialog box. This is the method shown in the previous scenario. 9.5.2.4. Dividing by Units If the Unit Sensitive option is turned off and your embedded worksheet uses different units than your model, you can convert the outputs to the model units in either the Relations dialog box in Creo Parametric or the PTC Mathcad Prime worksheet. To convert an output variable from worksheet units to CAD model units, divide the results by the model’s units:

Figure 9‑37: Dividing by Unit.

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: what the SI unit is for a given quantity. the conversion factor between one unit and the SI unit. the unitless value of a variable in SI units. Honestly, I can’t think of a direct application for this with engineering calculations, but it’s something to keep in your back pocket in case the situation arises.

Figure 9‑38: SIUnitsOf Function

9.6. A Final Word I can’t stress this enough: when you are developing engineering calculations, always check your math. Are your results the right order of magnitude? How big are those values in the real world? Do they make sense. When you make changes to the model, do the result change the way that they should? A little bit of checking and double checking can save a lot of time, money, and effort in the long run. To summarize: 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.

10.1. Integration Options and Comparison As described in section 1.2, there are two methods to integrate Mathcad Prime worksheets with your engineering models in Creo Parametric: Embedding your worksheet in your Creo Parametric part or assembly. Creating a Prime Analysis feature. Which method do you use? Let’s take a look at the aspects of each. Embedded Worksheets: Updating your model is a manual process. Your model could be out of date with your Mathcad worksheet. Creo Parametric provides warnings regarding embedded worksheets in the Notification Center. There is no additional file to manage. Prime Analyses: Depending on your Regeneration Request setting (discussed in section 12.6), your model can take longer to retrieve and regenerate. Your model could potentially update and change when you don’t want it to. Conversely, your model might not update properly

when you do. Your models often need a double regeneration to update the geometry. This is discussed in section 12.5. Which method do you choose? That’s largely a personal preference depending on the following factors: 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. Planning for Integration Before you start embedding worksheets or creating a Prime Analysis feature, you should perform the following actions to minimize the chance of problems: Building your Mathcad worksheet to have the appropriate variables and math regions as inputs and outputs with the correct equals sign operator. Identify the units for input- and output variables in Creo Parametric and PTC Mathcad Prime. They can be different. Units were discussed extensively in Chapter 9. Change the names of your dimensions. This is especially true for Prime Analysis features and the Automapping functionality. Adding user-friendly entities to your Creo Parametric models like

3D Annotations (section 10.3) and adding columns to the Model Tree (section 10.4). Let’s take a deeper look at these tools.

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: The Creo Parametric dimensions / parameters have the same name as the Mathcad variables. The units match. Note the following rules regarding Automapping: PTC Mathcad input variables cannot contain Greek or Hebrew letters. Literal subscripts in a PTC Mathcad variable are the same as Creo Parametric parameter or dimension names in regular case. Names of Mathcad input variables cannot be longer than 32 characters. Setting the configuration option prime_automapping to yes will automatically enable the Auto-map function when initiating a Prime Analysis feature. If you are using Mathcad 15.0 or earlier, the corresponding option is mathcad_automapping.

10.2.2. Changing Dimension Names in Creo Parametric To change the names of dimensions in Creo Parametric, perform the following steps: 1. Select the feature or component either from the Graphics Area or Model Tree. A Mini Toolbar should open. If the Mini Toolbar does not open, click the right mouse button. Click the Edit

Dimensions tool. 2. The tab for the dimension will open. Click in the Name field and type in the name you want to use for the dimension. 3. Click in the background of the Graphics Area to de-select the dimension and regenerate the model. You may have to click twice.

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: reducing the need to create drawings or fully-annotated drawings. leveraging the models themselves for manufacturing and inspection. A study by the National Institute for Standards and Technology (NIST) has shown that MBD can reduce the design, manufacturing, and inspection cycle time by 72%. To use 3D Annotations to display your inputs and outputs, you will need to understand Combination States, Annotation Planes, and 3D Notes.

10.3.1. Combination States Displaying all your 3D Annotations for the PMI in a model can clutter the screen, resulting in what some people have described as a “bowl of spaghetti” or “barbershop floor” effect. To improve clarity, 3D Annotations should be organized into logical groups. For example, you may want to organize the 3D Annotations that are parallel to the FRONT plane into a group, or the Annotations related to mounting holes in another groups. These groups of annotations are called Combination States.

In addition, a Combination State can capture any or all of the following for visualization and documentation: Saved Views (the initial orientation of the model). Simplified Representations. Style States. Layer States. Combination States in assemblies can also contain: 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-STD31000, 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

Manager

icon on the Views tab or in the In Graphics Toolbar:

Figure 10‑1: The In Graphics Toolbar.

10.3.2. Annotation Planes

Your 3D Annotations can be displayed either Flat to Screen or oriented with respect to a model plane. In the latter case, the 3D Annotation will move, rotate, and zoom with respect to the model. To see the available Annotation Planes, click the Annotate tab. They are listed in the Ribbon:

Figure 10‑2: The Annotate Ribbon tab.

By default, Creo Parametric models come with 6 additional Annotation Planes: FRONT TOP RIGHT BACK BOTTOM LEFT However, I generally find that for dimensions and parameters used as inputs and outputs from PTC Mathcad Prime, I like them to be displayed Flat to Screen. Additional Annotation Planes can be created by clicking Annotate > Annotation Planes > Annotation Plane Manager > New:

Figure 10‑3: Annotation Plane Manager.

In the Annotation Plane Definition dialog box, The name of the Annotation Plane. The orientation, as defined by a reference plane, a named model orientation (saved view), or flat to screen. The viewing direction for 3D Annotations. The text rotation angle.

Figure 10‑4: Annotation Plane Definition dialog box.

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 icon. If this is an unattached note (no leader), left click to place the note where you want and start typing in the text you want to appear in the note. When finished, left click on an empty area of the Graphics Area. To use a dimension or parameter in the note, type the ampersand character (the and sign &, available from SHIFT and 7 on standard US keyboards) and the parameter’s name or the symbolic form of the dimension. If desired, you can create a note with a leader by clicking on the drop-down next to the Note icon and selecting Leader Note:

Figure 10‑5: The Note command.

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.

10.3.4. Adding 3D Annotations to a Combination State 3D Annotations are automatically added to the active Combination State. They can be added to additional Combination States by selecting them, clicking on the Annotate tab, and clicking the Assign to State command in the Managing Annotations group. This will open the Assign to States dialog box. You can select one or more states from the list using the CTRL key and then click OK.

Figure 10‑6: Assign to States dialog box.

3D Annotations can be removed from Combination States by clicking on them with the left mouse button in the Graphics Area and selecting the Remove from State icon in the lower left corner of the Mini Toolbar:

Figure 10‑7: Mini Toolbar for 3D Annotations.

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 icon from the Manage Annotations group.

10.4. Adding a Column to the Model Tree During the Mathcad-Creo integration process, at some point you will have to use Relations to assign the outputs of the Mathcad worksheet to model dimensions. While working on a model, it is sometimes convenient to display certain feature dimensions in the Model Tree to see how their values change as the model updates. To add columns from the Model Tree, perform the following steps: 1. Identify the names of the model parameters you want to display by clicking Tools > Parameters. 2. Identify the symbolic names of the model dimensions you want to display by selecting features and choosing Edit Dimensions from the Mini Toolbar. Click Tools > Switch Dimensions to toggle the dimensions between their numeric and symbolic forms. 3. In the Navigator, click on the Model Tree Settings icon. Select the Model Tree Columns option from the drop-down list. The Model Tree Columns dialog box will open:

Figure 10‑8: Adding a column to the Model Tree.

4. Change the Type drop-down list from Info to Model Params. 5. Enter the name of the parameter or the symbolic form of the dimension in the Name field. Click the Add Column button. 6. Repeat for any other dimensions or parameters you wish to add. 7. Select any displayed columns from the list and click the Remove Column button if desired. 8. When finished, click OK. The Model Tree now displays columns for the dimensions and parameters that you have specified. As of Creo Parametric 6.0, any changes to the Model Tree settings are automatically stored in the creo_parametric_customization.ui file and will be automatically applied the next time you launch a Creo Parametric session. Therefore, you may want to remove the additional columns you added to the Model Tree prior to exiting Creo Parametric.

Chapter 11.

Embedded Worksheets

Key Points Embedding an existing PTC Mathcad Prime worksheet in a Creo Parametric model creates a copy of the worksheet in the model. Relations are used to send inputs to the embedded worksheet and drive model geometry and parameters from the outputs. The worksheet can be accessed by double clicking the icon in the Creo Parametric Graphics Area. In the worksheet the Update Inputs icon is used to receive the latest values from Creo Parametric. In the worksheet Save and Push is used to send the outputs back to Creo Parametric.

11.1. Embedded Worksheets Overview As the name implies, when you embed a PTC Mathcad Prime worksheet, it resides inside the model. The Mathcad Worksheet will have: Input variables, which appear in a Definition statement. The engineering calculations to be performed to process the inputs into outputs. The output variables, which appear in an Evaluation statement. The general process I recommend for embedding a worksheet is as follows: 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. Save and Push the worksheet to Creo Parametric. The Creo Parametric model will now have the inputs and outputs

as parameters. These can be viewed by clicking Tools > Parameters and changing the Look In drop-down list to Embedded Mathcad. Connect model dimensions and parameters to these inputs and outputs using Relations. Access the embedded worksheet in PTC Mathcad Prime again.

Use Update Inputs to sync the worksheet inputs to the Creo Parametric model values. Click Save and Push Parametric. Close the worksheet.

to send the outputs back to Creo

In Creo Parametric, Regenerate

the model.

With the initial settings for the Notification Center, you will receive a warning when the embedded Mathcad worksheet is out of date. The basic process for updating the worksheet works as follows: Access the embedded worksheet. Creo Parametric sends dimensions and parameters to PTC Mathcad Prime based on Relations you’ve written to the input parameters.

Click Update Inputs

.

Click Save and Push to send the outputs back to Creo Parametric. Close the embedded worksheet.

In Creo Parametric, click Regenerate . The Relations are recalculated and the model geometry updates. Let’s cover this in more detail.

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. One Save and Push will add the Embedded Mathcad parameters in the model. Then in Creo Parametric, write the Relations to (1) send inputs to PTC Mathcad Prime and (2) drive the model dimensions and parameters from the Embedded Mathcad parameters. Access the embedded worksheet to Update Inputs. This will generate the correct values in the output variables.

The second Save and Push Creo Parametric. Close the worksheet.

will send these correct values to

In Creo Parametric, Regenerate the model to update the geometry based on the engineering calculations. The following steps reflect this generalized process.

11.3.1. Creating the PTC Mathcad Prime Worksheet In PTC Mathcad Prime, create your worksheet for the engineering calculations you want to perform. Your worksheet should have: Definition math regions at the top to establish variables used in the analysis that are inputs from Creo Parametric. Your math regions for the various engineering calculations necessary to generate your results. These can include functions, vector- and matrix- operations, Microsoft Excel integrations, programs, and Solve Blocks. Evaluation math regions at or near the bottom to be used as outputs sent back to Creo Parametric. Perform the following steps after your worksheet has been developed:

Click Input/Output > Show in Worksheet to identify on the sheet which math regions have been identified as inputs and outputs.

Click Input/Output > Show as List

to open the

Input/Output Designation dialog box. Select the desired Definition math regions and click Input/Output

> Assign Inputs . The math region will have a box around it with the word “In.”

Figure 11‑1: Assigning inputs in the worksheet.

Select the desired Evaluation math regions and click

Input/Output > Assign Outputs . The math region will have a box around it with the word “Out.” Change the names of the aliases in the Input/Output Designation dialog box, especially the outputs sent back to Creo Parametric.

Figure 11‑2: Assigning and renaming outputs.

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: 1. If you haven’t already done so, launch Creo Parametric and retrieve the model in which you wish to embed a worksheet.

2. Click Applications > PTC Mathcad > Insert Worksheet. 3. Navigate to the appropriate folder. Select the worksheet and click Open. 4. PTC Mathcad Prime launches with a tab that has the worksheet copied into it. The name of the tab is the name of the CAD model. 5. In the Quick Access toolbar in the upper left corner, click the Save and Push

icon.

Figure 11‑3: The PTC Mathcad Pushing values dialog box.

6. Leave Mathcad open (minimize it if necessary) and click on the Creo Parametric window. 7. Click Tools > Parameters . Change the Look In drop-down list to Embedded Mathcad. The Mathcad inputs and outputs will be listed. 8. Click Tools > Relations . a. Write Relations where the inputs are assigned the values of model dimensions, and model dimensions are assigned the values of Outputs. i. Embedded Mathcad parameters have the format

alias:MATHCAD where alias is the alias you defined in Mathcad for the output. ii. To ensure you use the correct syntax, click Insert Parameter Name from List and change the Look In drop-down list to Embedded Mathcad. b. Repeat step a to drive model dimensions and parameters from the output variables of the embedded Mathcad worksheet. 9. Return to the PTC Mathcad Prime application.

10. Click Update Inputs and Save and Push . 11. Close the worksheet tab and minimize PTC Mathcad Prime.

12. In Creo Parametric, click Model > Regenerate

.

Your model should be updated to the latest results of the calculations from PTC Mathcad Prime.

11.4. Updating the PTC Mathcad Prime Worksheet To access the embedded worksheet, click either: The embedded worksheet icon located in the upper right-hand corner of the Graphics Area in Creo Parametric:

Figure 11‑4: Embedded worksheet indication in the Creo Parametric Graphics Area.

Applications > PTC Mathcad Worksheet.

> Open/Create

Both methods will launch PTC Mathcad Prime if necessary and retrieve the embedded worksheet into a new tab.

11.5. Updating the Model To update your model and the outputs from the PTC Mathcad Prime worksheet, perform the following steps: 1. Update your model using the standard techniques of Edit Definition, Edit Dimensions, or Tools > Parameters. 2. If this causes your embedded Mathcad worksheet to be out of date, you will see a warning in the Notification Center.

Figure 11‑5: Notification Center warning.

3. Activate the embedded worksheet by clicking either the embedded worksheet icon in the upper right-hand corner of the Graphics Area (see image below) or Applications > PTC Mathcad > Open/Create Worksheet. 4. PTC Mathcad Prime will come to the front with the tab for the

embedded worksheet active. In the embedded worksheet, click Update Inputs and Save and Push. 5. Close the embedded worksheet in PTC Mathcad Prime and return to Creo Parametric.

6. Click Model < Regenerate

or CTRL-G.

Your model should be updated with the latest output variables from your engineering calculations.

11.6. Regeneration Failures It is entirely possible that your PTC Mathcad Prime worksheet can send outputs back to Creo Parametric that result in a regeneration failure. While this may not be completely preventable, there are some actions you can take that can mitigate this possibility. During testing, you may be able to identify the acceptable range of inputs that your model can regenerate successfully. However, if you have multiple variables, especially those that conflict with each other, you may not be able to determine the ranges for all dimensions that will result in a successful regeneration. Some potential actions you can use to mitigate regeneration failures include: Use Comparison Relations. If these Relations are evaluated to be false, a notification will appear in the Message Area indicating that the Relation was violated. Then you can investigate and implement changes that prevent a regeneration failure. Use If-Then-Else Relations to limit an output to a maximum or minimum value.

11.7. Identifying Mathcad Connected Models There are two ways to identify a Creo Parametric model has an embedded Mathcad worksheet: Seeing an icon in the upper right-hand corner of the Graphics Area

indicating an embedded worksheet. Filtering the Model Tree to display components with embedded worksheets.

11.7.1. Graphics Area Icon When a model has a Worksheet embedded within it, the Mathcad icon will appear in the upper right corner of the Graphics Area:

Figure 11‑6: Indication of an embedded Mathcad worksheet.

This is the only indication that your model has an embedded Worksheet. Note the following: The embedded Worksheet does not appear in the Model Tree. It does not appear in the Model Properties dialog box. No file appears in either the Working Directory or the Windchill Workspace.

11.7.2. Model Tree Filter In an assembly, you can use the Model Tree filter to identify components that have an embedded worksheet. Just below the words “Model Tree” you will see an icon that looks like a Filter and a field that you can type in a search string. To the right of the field is a triangle that will open a drop-down menu. Underneath “Queries by state” you can go to the “More Queries” flyout and select the “Contains Mathcad Worksheet” pre-defined search. The Model Tree will then be filtered down to only those components that contain an embedded Mathcad worksheet.

Figure 11‑7: Filtering Model Tree by embedded worksheets.

11.8. Removing a Worksheet If you no longer want your model driven from a PTC Mathcad Prime

worksheet, click Applications > PTC Mathcad Worksheet. You will receive the following warning:

> Remove

Figure 11‑8: Warning when removing an embedded worksheet.

Click OK to proceed. You should immediately go to Tools > Relations and remove all your embedded Mathcad-related expressions.

Figure 11‑9: Relations after removing an embedded worksheet.

Chapter 12.

Prime Analyses

Key Points Create your Mathcad worksheet for engineering calculations before creating a Prime Analysis feature. Designate your inputs and outputs in the worksheet. To create a Prime Analysis, you specify the Mathcad worksheet to be used; the Creo Parametric dimensions and parameters to be passed to Mathcad; the corresponding Mathcad input variable; and the output variables to be received from Mathcad. The Prime Analysis is created as a feature in the model. Relations are written to drive model dimensions and parameters from the Mathcad outputs. Changes to the model usually require two regenerations to update the model, although using Post Regeneration Relations can help with this.

12.1. Background: Datum Analysis Features Creo Parametric has a module called the Behavioral Modeling Extension (BMX). This module allows you to build Design Intent directly into your models. At its core, BMX consists of two main parts: You can perform measurements in your model, such as length, distance, diameter, mass properties, and so on. These measures can be created as features in a part or an assembly, and are known as Datum Analysis Features (DAF). These features contain parameters for the result of the measurement, such as a calculated distance or mass. These features can also generate other Datum Features. For example, a Datum Analysis Feature for a model’s mass properties can create a point or coordinate system at the model’s center or gravity. Based on the results of Datum Analysis Feature, you can create Feasibility or Optimization Studies. These are discussed in more detail in section 12.6. Both Feasibility and Optimization Studies

can be created as features in your model. BMX has additional capabilities, like the ability to perform Multi-Objective Design Studies (MODS), but Datum Analysis Features and Feasibility / Optimization Studies represent the core functionality. Mathcad Prime Analysis features are essentially Datum Analysis Features. However, a license of the BMX module is not necessary to create Mathcad Prime Analysis features. A Mathcad Prime Analysis can be created using either Mathcad Prime or Mathcad Prime Express (the free version).

12.2. The Prime Analysis Dialog Box Before explaining the process for creating a Prime Analysis feature, it helps to understand the different parts of the interface. When you click Analysis > Prime Analysis, the following dialog box will open:

Figure 12‑1: The Prime Analysis feature dialog box.

Let’s go through the various sections.

12.2.1. The File Section The File section under Setup defines the PTC Mathcad worksheet that will be used in the Prime Analysis.

Figure 12‑2: The Prime Analysis feature File section.

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.

12.2.2. The Inputs Section: Creo Parametric to Prime This section allows you to specify which dimensions and parameters are sent from Creo Parametric to PTC Mathcad Prime.

Figure 12‑3: The Prime Analysis feature Inputs section.

There are five columns for the inputs: 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 creates a new row in the table. Delete: honestly, I’ve never seen this choice not greyed out. Select Creo Parametric dimension allows you to select a feature from the Graphics Area or Model Tree. The feature’s dimensions are displayed in the Graphics Area and can be selected. Select Creo Parametric parameter opens the Parameter Selection dialog box from which the user can select the model parameter to be used as an input. When you right mouse click over the last two 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 a row:

button to add

Creo Parametric Dimension: the user can select features in the Graphics Area or Model Tree. This will display the feature’s dimensions, which can then be selected and added as an input. Creo Parametric Parameter: the Parameter Selection dialog box opens listing any valid real number or integer parameters that exist in the model. Prime Variable: the Input Selection dialog box opens listing any available Mathcad inputs. Select in Prime: the Mathcad Select Menu Manager will open and the user can select an input math region from the PTC Mathcad Prime application. Then clicking Done Sel from the Menu Manager will paste it into Prime column cell.

Figure 12‑5: The Mathcad Select Menu Manager.

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.

12.2.3. The Outputs Section: Prime to Creo Parametric This section allows you to define which Mathcad outputs are received by Creo Parametric.

Figure 12‑6: The Prime Analysis Feature Outputs section.

The columns for the outputs are: Prime: the name of the Mathcad variable. Value: the current value of the Mathcad variable. Note that until the Compute button is clicked, the value does not reflect the results of the calculation with the inputs from Creo Parametric.

Unit: the units for the Prime variable. Creo Parametric: the name of the parameter that will be created in Creo. This field can be edited from the default name generated automatically, Unit: the units for the Creo Parametric output parameter. This has a drop-down that allows you to select a different unit for the quantity type. When you right click over the first three columns, the following choices will be available from the pop-up menu: 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 result in the following happening when the plus sign clicked:

button is

Prime Variable. The Outputs Selection dialog box opens. Select in Prime. The Mathcad Select Menu Manager opens. The Clear All button will remove any dimensions or parameters that have been added as inputs. Info, in theory, provides information regarding the selected output. However, when I click it, I tend to get a fatal error resulting in a crash. Therefore, I recommend not clicking this button. A Mathcad worksheet can actually create datum geometry such as datum coordinate systems, datum points, and datum curves. The Csys for datum creation field allows you to select a different coordinate system than the default as the reference for these datum features. This datum creation functionality is covered in section 12.4.

12.2.4. Saved Analyses Section This section allows you to create the Prime Analysis as a Saved Analysis as opposed to a feature. As a feature, the Prime Analysis could potentially run every time the model regenerates. As a Saved Analysis, the end user explicitly controls when the Prime Analysis feature operates.

Figure 12‑7: The Prime Analysis feature Saved Analyses section.

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.

The Show/Hide button is irrelevant for a Prime Analysis. The Retrieve button allows you to populate the Prime Analysis dialog box with the information for the file, inputs, and outputs from the selected saved analysis. The Delete button removes the Saved Analysis from the model. The Saved Analysis command from the Analysis tab in the Ribbon will open the Saved Analysis dialog box. It will list any Saved Analyses in the model. However, the Prime Analysis feature cannot be edited using the pencil icon in this dialog box.

Figure 12‑9: The Saved Analysis dialog box.

12.2.5. Action Buttons The bottom of the Prime Analysis dialog box has three buttons: 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.

12.3.1. Develop the Mathcad Prime Worksheet Developing the PTC Mathcad Prime worksheet for a Prime Analysis is generally the same process as creating one for an embedded worksheet as described in section 11.3.1. In PTC Mathcad Prime, create your worksheet for the engineering calculations you want to perform. There is no set or one way to do this, but generally your worksheet should have: Definition math regions at the top to establish variables used in the analysis that are inputs from Creo Parametric. Your math regions for the various engineering calculations necessary to generate your results. These can include functions, vector- and matrix- operations, Microsoft Excel integrations, programs, and Solve Blocks. Evaluation math regions at or near the bottom to be used as outputs sent back to Creo Parametric. Then perform the following steps: Select the desired Definition math regions and click Input/Output > Assign Inputs. Select the desired Evaluation math regions and click Input/Output > Assign Outputs. Click Input/Output > Show in List to change the names of the aliases, especially the outputs sent back to Creo Parametric. As mentioned in section 10.2.1 on Automapping, you can facilitate the process by using input variables with the same name as the Creo Parametric

dimensions and parameters. After creating your Mathcad worksheet, be sure to save it.

12.3.2. Set Up the Prime Analysis Feature There is no one way to create a Prime Analysis feature. This section describes a general approach. To create a Mathcad Prime Analysis feature, you can perform the following steps: 1. Click the Analysis tab and Prime Analysis . Note that this can be performed in either a part or an assembly. This will open the Prime Analysis dialog box.

Figure 12‑10: The Prime Analysis feature dialog box.

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: i. Click the plus sign button to create a new row. 1. Right click over the first three columns and choose Select Creo Parametric dimension or Select Creo Parametric parameter. 2. Right click over the last two columns and choose Select Prime input. Select the desired input variable from the Input Selection dialog box. ii. Change the Add Mapping drop-down menu to Creo Parametric Dimension. 1. Click the plus sign button to create a new row. 2. Select the desired parameter from the Parameter Selection dialog box and click OK. 3. Right click over the last two columns and choose Select Prime input. Select the desired input variable from the Input Selection dialog box and click OK. iii. Change the Add Mapping drop-down menu to

Creo Parametric Dimension. 1. Click the plus sign button to create a new row. 2. Select a feature and the appropriate dimension in the Graphics Area. 3. Right click over the last two columns and choose Select Prime input. Select the desired input variable from the Input Selection dialog box and click OK. c. Repeat the steps under b for as many input variables that you want. 4. Define outputs from Creo Parametric to Prime: a. Under the “Prime to Creo Parametric” section, click the Add Mapping drop-down to select the method Prime Variable. b. Select the desired Mathcad output from the Output Selection dialog box and click OK. c. Click the plus sign button to add a new row. d. Change the names of the automatically generated Creo Parametric parameter if desired. 5. Click the Compute button to recalculate the outputs based on the current value of inputs. 6. Click the Add Feature to create the Prime Analysis feature in the Model Tree. A window will open at the top of the Graphics Area where you can enter the desired feature name. Note that the name has to comply with the same rules as other Creo Parametric features (e.g., no spaces). 7. Click Close to close the Prime Analysis feature dialog box. You now have a Prime Analysis feature in your model. However, it is not yet driving model geometry, dimensions, or parameters.

12.3.3. Define Relations

After the Prime Analysis feature has been created, you need to create Relations in your model to drive the relevant dimensions and parameters. To see the output parameters that have been created, click Tools > Parameters, change the Look In drop-down from Part to Feature, and select the Prime Analysis feature in the Model Tree (see Figure 12‑11). To write Relations between these output parameters and the model dimensions and parameters, perform the following steps: 1. Click Tools > Relations. 2. Select the model dimension or parameter that you want to drive from the output parameters. a. If you know the parameter name or the symbolic form of the dimension, you can type it in directly. b. If it is a model dimension, you can click the feature that owns the dimension, either from the Model Tree or the Graphics Area, and then select the dimension from the Graphics Area. c. If it is a model parameter, you can click the Insert Parameter icon from the horizontal toolbar in the Relations dialog box.

Figure 12‑11: Parameters generated from a Prime Analysis.

3. Type in the equals sign after the model dimension or parameter. Use spaces for clarity. 4. To select the output parameters, click the Insert Parameter icon from the horizontal toolbar in the Relations dialog box. a. Change the Look In drop-down list from Part to Feature. b. Select the Prime Analysis feature from the Model Tree. c. Select the output parameter you want to use and click Insert Selected. 5. Repeat steps 2 through 4 for all model dimensions and parameters that you want to drive. 6. Click OK to close the Relations dialog box.

7. Click Model > Regenerate twice. (Double Regeneration will be discussed in section 12.5.) In the Relations dialog box, the output parameters will be listed as the output parameter name, a colon, and FID_ followed by a number. FID stands for Feature Identification. The number is the unique identifier in a model given to a feature when it is created. Creo Parametric uses this number to track the different features in your model.

12.3.4. Edit Definition of the Prime Analysis Feature If you need to change the Prime Analysis feature, left click on it in the Model

Tree and choose the Edit Definition Mini Toolbar. The following dialog box will open:

icon from the

Figure 12‑12: Edit Definition of a Prime Analysis feature.

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: Change or reload the Mathcad worksheet. Change the inputs, outputs, and/or their units. Manually recompute the worksheet.

12.4. Creating Datums in a Prime Analysis A Prime Analysis feature can create datum coordinate systems, datum points,

and a datum curve. Here is a Mathcad worksheet capable of doing so:

Figure 12‑13: Mathcad worksheet for creating datums.

Note the following in this PTC Mathcad Prime worksheet: To generate datum features, math regions that evaluate matrices are designated as outputs. Coordinate systems are 3 by 4 matrices. The structure will be discussed in the next section. Datum point arrays are generated from matrices with 3 columns. They can have any number of rows. The number of rows determine how many points are created. Here is the Prime Analysis feature used to create the datums:

Figure 12‑14: Prime Analysis feature for generating datums.

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.

12.4.1. Datum Coordinate Systems The matrix for generating a coordinate system has 3 rows and 4 columns. The first three columns define the orientations of the X, Y, and Z directions of the coordinate system. The values can be numbers other than 1. You may want to create a square 3 by 3 matrix for the coordinate system orientation in order to test the determinant of the matrix. In order to create a coordinate system, the determinant may need to be positive. If the coordinate system does not follow the right-hand rule, then the output will not be available for selection in the Prime Analysis dialog box. The fourth column defines the X, Y, and Z coordinates of the origin of the coordinate system.

12.4.2. Datum Points As mentioned earlier, a matrix with three columns corresponding to the X, Y,

and Z coordinates of the point is used to generate the datum points. It can have any number of rows. Programs can be used to generate a matrix of points.

12.4.3. Datum Curves The datum curve is not automatically generated by the Prime Analysis feature. To generate a datum curve, perform the following steps after the Prime Analysis feature is created: 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.

Figure 12‑16: Resulting Datums of the Prime Analysis feature.

3. Double click Create (which is currently set to NO). Select the radio button for YES. If desired, change the name of the resulting datum.

Figure 12‑17: Resulting datums of the Prime Analysis feature.

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.

Figure 12‑19: Datum Curve Through Points.

12.5. Double Regeneration Problem Creo Parametric is a history-based modeler. Our part features are regenerated in the order they appear in the Model Tree. Changing the order can change the resulting geometry. Our models should update properly with a single regeneration. However, we

often have to regenerate a model twice when using a Prime Analysis feature. Regeneration in a part model works as follows: Part-level Relations are calculated. Features are regenerated in their order in the Model Tree. Any feature-level Relations are calculated when their corresponding feature is regenerated. Post Regeneration Relations are calculated. Multiple regenerations are not limited to Prime Analysis features. Other causes include: 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: 1. Click Tools > Relations . Select all the Relations in the dialog box relevant to the Prime Analysis feature outputs. Click the right mouse button and select Cut.

Figure 12‑20: Cutting the Relations.

2. Change the drop-down list in the lower right corner of the dialog box from Initial to Post Regeneration.

Figure 12‑21: Accessing Post Regeneration Relations.

3. Right click in the Relations editor and select Paste.

Figure 12‑22: Pasting the Relations.

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:

Figure 12‑23: Regeneration status in the lower right corner.

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.

12.6. Regeneration Request As discussed in section 12.3.4, when you click on a Prime Analysis feature in

the Model Tree and select Edit Definition Mini Toolbar, the following dialog box will open:

from the

The section under “RegenRequest” has three options: Always. This is selected by default. Read Only. Only Design Study. When the Regeneration Request is set to Always, model regeneration will launch PTC Mathcad Prime and recalculate the worksheet. This can slow down your work day. In an assembly with multiple Prime Analysis features set to Always, this can slow down your progress significantly. When set to Read Only, PTC Mathcad Prime won’t launch and recalculate your outputs. If you change your inputs, use Edit Definition to change the Regeneration Request to Always and update your model. Prior to releasing a model, change the regeneration request to Read Only. This will help prevent unwanted changes to model geometry for released parts and assemblies.

The third choice is Design Study, which include: 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: Design constraints, in which a computed measure from a Datum Analysis Feature (DAF) must be equal to, less than, or greater than some specified value. Design variables and the ranges that Creo Parametric can vary model dimensions and parameters. A Feasibility Study will find the first solution that meets the constraints. An Optimization Study is a Feasibility Study with a design goal – some quantity to be maximized or minimized, like mass. An Optimization Study is intended to find the best result over the entire solution space. Therefore, this is very much like optimization as discussed in Chapter 6. A Multi-Objective Design Study (MODS) is essentially a trade study. The best analogy I can think of is buying a house. There are a lot of factors in your decision. Many conflict with one another. You want the most space but the lowest price. You want a quiet neighborhood or a cul-de-sac, but you want a short work commute. You want good schools but low property taxes. The same conflicts exist in product design. High strength often comes at the cost of mass. You want durability but low material cost. MODS allows you to perform that kind of analysis. A Statistical Design Study is a Multi-Objective Design Study in which a statistical distribution is applied to both the design variables and the results. You may want to use the Design Study option if you use any of these kinds of functions.

12.7. Mathcad Analysis Feature

If you are using PTC Mathcad 14 or 15, you can create a Mathcad Analysis from the Analysis tab in part and assembly mode. The Mathcad Analysis dialog box (on the left) is very similar to the Prime Analysis dialog box (on the right):

The dialog boxes generally contain the same functionality. The process for creating a Mathcad Analysis is very close to that of a Prime Analysis.

Part III – Exercises Chapter 13.

Sample Problems

This chapter contains several design scenarios for you to get additional practice so you can apply the techniques from this book in your real-world problems later. These scenarios are designed so that you can quickly and easily create both the worksheets and the CAD models in a matter of minutes. (You will find that the CAD models are ridiculously simple to create. This book is on driving parts and assemblies from CAD modeling, not meticulous model creation.) The design scenarios are: 1. Designing and optimizing a pressure vessel for a specified pressure and surface area. 2. Calculating the size of a key for mating a shaft to a gear. 3. Solid disk flywheel design for engine operating conditions. 4. A transmission shaft that must meet requirements for permissible angle of twist. By all means, feel free to deviate from the scenarios to explore additional areas and to have fun! Based on the requirements for a design scenario, ask yourself the following questions: What are the inputs to the engineering calculations? What engineering equations and formulas do we need? What quantities do we want to optimize? What outputs will be sent back to Creo Parametric? What Creo Parametric part features would facilitate your Design Intent? Should you use an embedded worksheet or a Prime Analysis feature? The following sections provide guidance for how you can solve this design

problem, but feel free to solve it on your own.

13.1. Scenario 1: Designing and Optimizing a Pressure Vessel

Figure 13‑1: Pressure vessel model.

The design requirements for this problem are as follows: We are designing a pressure vessel that must hold a certain volume of 1 million cubic inches and a given pressure of 1200 psi. The pressure vessel will be cylindrical with hemispheres (half spheres) at each end. The length of the cylindrical portion must be at least 4 times the diameter of the hemispherical head. We want to minimize the surface area in order to reduce our raw material costs. We want to calculate the inner diameter and the length of the cylindrical section.

We want to calculate the thickness based on ASME calculations for circumferential, longitudinal, and hemispherical head welds.

13.1.1. Developing the Worksheet Here are some suggestions for how to create your Mathcad worksheet. First, you could define the inputs from Creo:

Figure 13‑2: Scenario 1 worksheet inputs.

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.

Figure 13‑3: Scenario 1 functions and initial values.

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.

Figure 13‑5: Scenario 1 initial results.

Next, we can set up variables for calculating the thickness based on ASME guidelines.

Figure 13‑6: Scenario 1 thickness calculation setup.

We can perform calculations for the thickness based longitudinal welds, circumferential welds, and the hemispherical head welds.

Figure 13‑7: Scenario 1 thickness calculations.

The max function can select the worst case to be output back to Creo Parametric.

Figure 13‑8: Scenario 1 thickness output.

13.1.2. Developing the CAD Model To create the CAD model, consider the following: The first modeling feature should be a surface that represents the volume of gas to be held. In order to capture a dimension for the thickness of the pressure vessel, use the Thicken command to add material to the outside of the surface.

Use 3D Annotations to display the hemisphere diameter, length of the cylindrical portion, and thickness in the Graphics Area. Add feet and an access port. How can you set up these features to change parametrically with changes to the size of the pressure vessel? (Hint: you can use datum features, depth options, and Relations to build this Design Intent into your model.)

13.1.3. Connecting the Part to the Worksheet Use either an embedded worksheet or a Prime Analysis feature to connect your worksheet to your model. If using an embedded worksheet, use Relations to drive the inputs and outputs. Use Relations to drive the outputs from the Prime Analysis feature. Be sure that the Unit Sensitive option is turned on in the Relations dialog box.

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.

Figure 13‑9: Model for scenario 2.

The shaft is 10 inches long and 2 inches in diameter. The key is geared in the middle of the shaft and the gear hub length is 2 inches. The shaft is made of steel. A factor of safety of 2 is required. This can be factored into the allowable shear strength. The torque to be transmitted from the gear to the shaft is 5000 inlbf. The width of the key should be a multiple of an eighth of an inch. You need to calculate the width of the key and drive Creo Parametric from the value.

13.2.1. Developing the Worksheet Here are some suggestions for the Mathcad worksheet: 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:

Figure 13‑10: Scenario 2 worksheet inputs.

The calculations could look like:

Figure 13‑11: Scenario 2 worksheet calculations.

The outputs could look like:

Figure 13‑12: Scenario 2 worksheet outputs.

For more information on these calculations, please see chapter 11 of

“Schaum’s Outline of Theory and Problems of Machine Design,” by Allen S. Hall, Alfred R. Holowenko, and Herman G. Laughlin.

13.2.2. Developing the CAD Model Here are some recommendations for creating the CAD model: Use the Inch Pound Second (IPS) unit system. The first solid feature should be the main shaft. You can create this with an Extrude with a symmetric depth. Feel free to use a Revolve instead if desired. The second feature should be the key. This will be an Extrude with a symmetric depth. For the sketch, you can use the cylindrical surface as a Sketch Reference and the Corner Rectangle tool with an Equal Lengths constraint. The initial value for the width dimension in the sketch doesn’t matter since the worksheet will calculate that. The model should have yield strength as a parameter, which can be an input. Rename the following dimensions: The shaft diameter (input). The key length (input). The key width (output). Be sure the Relations are set to Unit Sensitive.

13.2.3. Prime Analysis Feature Since units are critical in this problem, use a Prime Analysis feature. The dialog box could look like:

Figure 13‑13: Scenario 2 Prime Analysis feature.

13.2.4. Model Relations The resulting Relations dialog box could look like:

Figure 13‑14: Relations to drive model.

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: The weight is constrained at 25 pounds-force. During operation, the resisting torque of the machine powered by the engine results in a change of energy of 500 Newton-meters needed. The motor operates at 500 rpm and experiences a 10% drop during part of one revolution. For more information on these calculations, please see chapter 26 of “Schaum’s Outline of Theory and Problems of Machine Design,” by Allen S. Hall, Alfred R. Holowenko, and Herman G. Laughlin.

13.3.1. Developing the CAD Model Create a part using the millimeter-Newton-second template. The only geometry you need for this exercise is an extruded circle. The initial diameter is arbitrary given that the worksheet will calculate the value. Use an initial symmetric depth of 25 mm.

13.3.2. Developing the Worksheet Use the SI unit system in your worksheet. Perhaps you do not send any inputs from Creo Parametric.

Figure 13‑15: Scenario 3 worksheet inputs.

The calculations could look as follows:

Figure 13‑16: Scenario 3 worksheet calculations.

The outputs could look as follows:

Figure 13‑17: Scenario 3 worksheet outputs.

13.3.3. Connecting the Worksheet and CAD Model If you do not send any inputs from Creo Parametric, the only things that need to be configured in the Prime Analysis feature are the worksheet file and the diameter output.

Figure 13‑18: Scenario 3 Prime Analysis feature.

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: Send the weight as an input from Creo Parametric. Given the weight, calculate the thickness of the flywheel for a given material. Send this as an output from PTC Mathcad Prime to Creo Parametric. Change the inputs for energy and angular velocity. Use an embedded worksheet instead.

13.4. Scenario 4: Designing a Shaft We are designing a solid transmission shaft. We need to calculate the diameter based on the permissible angle of twist. The requirements are as follows: The shaft is 6 feet long. The part is made out of steel. The torsional moment is 5000 inch-pounds-force. The permissible angle of twist is one degree per foot. The stock shaft diameter sizes are as follows: The minimum diameter is 0.5 inches. The stock is available in 1/16th inch increments up to 2.5 inches. Between 2.5 and 4 inches, the stock is available in 1/8th inch increments. Above 4 inches, the stock is available in1/4th inch increments. For more information on these calculations, please see chapter 9 of “Schaum’s Outline of Theory and Problems of Machine Design,” by Allen S. Hall, Alfred R. Holowenko, and Herman G. Laughlin.

13.4.1. Developing the Worksheet The inputs for the worksheet might be:

Figure 13‑19: Scenario 4 worksheet inputs.

The calculations could look as follows:

Figure 13‑20: Scenario 4 worksheet calculations.

Since our diameter has to be in stock increments, we can use a program to round the output appropriately. The outputs might look like:

Figure 13‑21: Scenario 4 worksheet outputs.

Note that the program uses if and also if statements as well as the Ceil function.

13.4.2. Developing the CAD Model

For the CAD model, use a model template with English units. Create an Extrude or a Revolve to create a shaft with a length of 6 feet. Initial diameter is arbitrary since it will be driven by the worksheet. Include a parameter for the torsional moment to be sent from Creo Parametric.

13.4.3. Connecting the CAD Model and Worksheet Use a Prime Analysis feature to send the inputs and receive the outputs. Write a Relation to drive the shaft diameter from the Prime Analysis output parameter.

13.4.4. Explorations For additional exploration, try the following: Change the torsional moment requirements. Create a plot or graph of angle of twist per unit length as a function of diameter.

Chapter 14.

Conclusions

We’ve come to the end of the journey with engineering calculations with Creo Parametric and PTC Mathcad Prime. I hope that you have the confidence to drive your engineering calculations with embedded worksheets and/or Prime Analysis features, and that you and your product development organizations realize the following benefits: How easy it is to build engineering calculations in your CAD models. Capturing Design Intent in your parts and assemblies. Documenting, communicating, and sharing of engineering calculations in an electronic format. The simplicity and efficiency of implementing changes. Thanks for reading, and I hope this helps improve your product development processes.

Appendix A. Creo Parametric Configuration Options The following configuration options are relevant to connecting Creo Parametric models with PTC Mathcad worksheets. Note: the default value is indicated with an asterisk. prime_analysis_directory no default or initial value This option sets the default folder that Creo Parametric looks for Mathcad worksheets for a Prime Analysis feature. mathcad_analysis_directory value

no default or initial

This option sets the default folder that Creo Parametric looks for Mathcad worksheets for a Mathcad Analysis feature (if you’re trying to connect your models to worksheets from Mathcad 13, 14, or 15). prime_automapping no*, yes When set to yes, a Prime Analysis feature will automatically add inputs when the names of a Creo Parametric dimension or parameter matches the name of a Mathcad input variable. mathcad_automapping

no*, yes

This performs the same function as prime_automapping, but for a Mathcad Analysis feature. 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. nmgr_outdated_mathcad

warning*, do not

show, warning_with_message, error This option specifies what happens when an embedded Mathcad worksheet is out of date with the Creo Parametric model: warning: A yellow flag appears in the Notification Center. warning_with_message: A yellow flag appears in the Notification Center as well as a “toaster” pop-up with every model regeneration. Personally, I find this particular choice extremely annoying. error: A red flag appears in the Notification Center. do not show: there are no indications in the Notification Center when the embedded Mathcad worksheet is out of date with the Creo Parametric model.

Appendix B. Acronyms A note on acronyms: I generally despise acronyms. I believe that the use of them in engineering and the workplace is a detriment to effective communication and works against inclusion, especially for younger engineers and newer employees. I have endeavored to limit the use of acronyms in this book and did my best to explain an acronym wherever one is used. BMX

Behavioral Modeling Extension

CAD

Computer Aided Design

CAE

Computer Aided Engineering

DAF

Datum Analysis Feature

DOE

Design of Experiments

MBD

Model Based Definition

MCAD MRO

Mechanical Computer Aided Design Maintenance, Repair, and Overhaul

NIST

National Institute of Standards and Technology

PDF

Portable Document Format

PMI

Product and Manufacturing Information

TDD

Top Down Design

TLA

Three Letter Acronym