PTC Express
February 2009
HOME
In This Issue
Pro/ENGINEER Routed Systems Designer 8.0 - Are You Connected?
Modular Product Architecture for Industrial Manufacturers
Using Motion Skeletons for Top-Down Assemblies in Pro/ENGINEER
New Surface Edit Tool in Pro/ENGINEER Interactive Surface Design Extention
Employing the Import DataDoctor Tool in Pro/ENGINEER
Creating and Reusing NPI Templates in Windchill ProjectLink
Documenting Mathcad Components
Conditional Display of Results in Mathcad
PLM On Demand Demonstrations for Small & Medium Sized Businesses
Pro/INTRALINK 9.0 Webcast Series
PTC University Demonstration Series
Mathcad Demonstration Series
PTC World Conference Series
Pro/ENGINEER Brings 25% Faster Product Development to Danaher Motion








Documenting Mathcad Components


Objective


Sometimes some calculations are implemented as basic code. Mathcad is a useful tool to translate and analyze the behavior of these calculations. The objective of this worksheet is to show how to implement a simple but traceable component for using basic language inside Mathcad.


Components


The component (or control) of interest, is the Text Box component. You can find the help about controls under QuickSheets > Programming.


The Controls can be found under the Insert menu as shown.



Use the contextual menu, to access the Component Properties and the script code.




Contextual Menu


Setting up Control Properties


Example


For example, this component



does this computation:





The Component Internal Code


This schema is useful for developing purposes, but the final work looks undocumented. To show what code is executed, insert a Text Box named Editor with this internal code


script
 

With the ExecuteGlobal statement you can use the control text as the program. Here is the result:


Documented Component


component
 

Application Example


A VBScript Runge-Kutta Solver


This example is Runge-Kutta solver writing in VBScript. Notice that the code inside the Class declaration generates an error in the Sub EditorEvent_Start, because the class name can't be repeated. Then, if you modify this part of the code, you also need to 'modify'  the internal script (selecting Edit Script from contextual menu, and exiting) to tell Mathcad that something has happened.



 

Parameters


ODE, y' = d(x,y)


script notation



Mathcad notation



Initial Conditions



Endpoint and Intervals



Solutions


Odesolve solution




Script solution



Comparison of results


Plots



plot
 

Note


Inside the Text Box Copy and Paste are called with [Ctrl] [Shift] C and [Ctrl] [Shift] V respectively.


References


  1. Elementary Differential Equations and Boundary Value Problems, Boyce, DiPrima. Wiley, ISBN: 978-0-471-43338-5
  2. Microsoft Corporation (1997) Visual Basic 5, Component Tools Guide
  3. Mathcad Documentation


Right-click, choose Save Target As, and change the extension to XMCD and File Type to All to
download Mathcad 13 file.


Was this article helpful? Let us know.











[PRINTER FRIENDLY VERSION]