cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Access MathCAD Prime-data via Visual Basic (Script worked with MathCAD 15.0)

TJS
2-Explorer
2-Explorer

Access MathCAD Prime-data via Visual Basic (Script worked with MathCAD 15.0)

I am using Mathcad Prime 7.0 7.0.0.0

With an VisualBasic Programm we extract Calculations out of MathCAD 15.0
into an Excel Table.
I managed to transform the file from MathCAD 15.0 into MathCAD Prime 7.0
but the extraction of the values does not work.

I managed to open the

I changed
"GetValue" -> "InputGetValue"
and
"getelement" -> "GetMatrixElement"
but the values still do not get transfered to Excel.

What is the right syntax to adress the values in MathCAD Prime?
(mcws stands for MathCAD-Worksheet)

VB-Script-Line for MathCAD 15.0:

Set MC = CreateObject("Mathcad.Application")
Set mcws = MC.Worksheets.Open(pfad & Worksheets("Stammdaten").Range("MCDatei"))
...
WertEinlesenMCAD.uwrk = mcws.GetValue(varname).getelement(0, 0)



Script for MathCAD Prime 7.0:

Set MC = CreateObject("MathcadPrime.Application")
MC.Visible = True
MC.Activate
Set mcws = MC.Open(pfad & Worksheets("Stammdaten").Range("MCDatei"))
....
WertEinlesenMCAD.uwrk = mcws.InputGetValue(varname).GetMatrixElement(0, 0)

5 REPLIES 5
MartinHanak
24-Ruby III
(To:TJS)

Hi,

please ask PTC Support.


Martin Hanák

Hi,

In Prime  there is an additional step to pass variables to and from the API.

On the Prime window ribbon menu "Input/Output | Integration | Assign Inputs" where exchange variables are identified.

Refer to the help which is where the image came from.

Cheers Terry

 

Capture.JPG 

 

I made the calculations to "Output", but still the transfer does not work.

 

 

TJS_0-1639147337453.png

Even when "varname" matches exactly the Alias of the Output, I won't get a value transfered.

WertEinlesenMCAD.uwrk = mcws.InputGetValue(varname).GetMatrixElement(0, 0)

Hi,

The terminology is a little difficult.

Use input for getvalue!

 

It is Input to API and output from the API?

 

As per the example supplied no dot in the alias.

Capture.JPG

Cheers

Terry

Announcements

Top Tags