Quantcast
Channel: PTC Community : Popular Discussions - Programming & Extending Mathcad
Viewing all 2429 articles
Browse latest View live

plotting a circle with triangle

$
0
0

Hello, i am studying master program at mechanical engineering. I am trying plot a circle using 3 points of a triangle. Circle must be plot inside triangle. How can i do?


Nested if Statements

$
0
0

I need to do some nested if statements for conditional programming and I cannot figure out for the life of me how to nest if-statements using the programming toolbar.  I am in Matcad 14 and the "add line" button just adds if-else if statements, I need to nest.  All the "add line" option does is just add another line on the same logic level.  Is there a difference between if and conditional if?

 

I posted a flowchart of the basic program logic. (Ignore the red lines, that is just my spell checker)

 

flowchart.png

Automation changes between 13 and 14?

$
0
0
I have been fairly successful in using the automation interfaces of V13, but I recently upgraded to V14, and now things seem broken. When doing the following (I'm using C#):

Mathcad.NumericValue v = new Mathcad.NumericValue();

I get the following exception:

Unable to cast object of type 'Automation.Wrappers.NumericValue' to type 'Mathcad.NumericValueClass'.

Has anyone had a similar problem? Basically the code I used with V13 does not seem to work with V14 (yes, I did update my references to point to the new version of the interop.mathcad.dll file).

Any ideas?

Win32::OLE bridging Perl Thread Issues

$
0
0
I have VBA code as follows:

Dim mathcad, worksheets, sheet

Set mathcad = CreateObject("Mathcad.Application")
set worksheets = mathcad.Worksheets
Set sheet = worksheets.Open("C:\vbscript\testM12.xmcd")

sheet.setValue "x",50
sheet.setValue "y",60
sheet.setValue "z",70

sheet.Recalculate

MsgBox(sheet.getValue("output1"))
MsgBox(sheet.getValue("output2"))

that I translated to perl using the Win32::OLE module. It is as follows:

#!/usr/ym/util/perl
use Win32::OLE;

#Perl "C:/documents and settings/aaron.verellen/desktop/trial2.pl"

#Win32::OLE->Initialize(COINIT_OLEINITIALIZE);
Win32::OLE->Option(Warn => 2);

#use existing instance if mathcad is already running
eval {$MC = Win32::OLE->GetActiveObject('Mathcad.Application')};
die "Mathcad not installed" if $@;
unless (defined $MC)
{
$MC = Win32::OLE->new('Mathcad.Application', sub{$_[0]->Quit;})
or die "Unable to start Mathcad";
}

#Open specific worksheet
my $filePath = 'C:\Documents and Settings\aaron.verellen\Desktop\testM12.xmcd';
my $WS = $MC->Worksheets;
my $S = $WS->Open($filePath);


#Set values on the worksheet
$S->setValue('x',50);
$S->setValue('y',60);
$S->setValue('z',70);

$S->Recalculate;

my $test = $S->getValue(\'x');
print "test = $test\n";

my $answer1 = $S->getValue('output1');
my $answer2 = $S->getValue('output2');

print "($answer1,$answer2)\n";

When I run the code I get the following error message:

C:\>Perl "C:/documents and settings/aaron.verellen/desktop/trial2.pl"
Win32::OLE(0.1709) error 0xc00000fd
in METHOD/PROPERTYGET "getValue" at C:/documents and settings/aaron.verellen
/desktop/trial2.pl line 31
test =

When I take this before perl experts they tell me that error 0xc00000fd appears to mean stack overflow...something to do with threads and they point me here. I was hoping that someone here can give me a little help in getting the getvalue methode working so I can retrieve values from the mathcad worksheet. Everything else appears to be working properly with the exception of this error.

Thank you in advace for any help you are able to give,
Aaron

Nested if Statements

$
0
0

I need to do some nested if statements for conditional programming and I cannot figure out for the life of me how to nest if-statements using the programming toolbar.  I am in Matcad 14 and the "add line" button just adds if-else if statements, I need to nest.  All the "add line" option does is just add another line on the same logic level.  Is there a difference between if and conditional if?

 

I posted a flowchart of the basic program logic. (Ignore the red lines, that is just my spell checker)

 

flowchart.png

Solving Laplace's Equation

$
0
0
I'm trying to solve part 2a using point jacobi method but it seems that my solutions don't look right. I got two solutions but I don't even know it's right or not. Maybe both solutions are wrong. Can someone check?

Mathcad Vs. Mathematica

$
0
0
Jim you mentioned that you use Mathematica as well as Mathcad. Can you give us (me) a comparison between the two applications. Advantages and disadvantages.

It would be great if you would.

Thanks
Javier.

COMPLEX PROBLEM TO BE SOLVED IN MATHCAD - GUIDANCE NEEDED

$
0
0

Hello Everyone,

 

I have a complex problem to get solved in the best way of approach.

I have attached the worksheet with my requirement.

I'm using MC version 15.0

 

Kindly help me.


How to use controls in mathcad (textbox,radio buttons,push buttons)

$
0
0

Dear all,

 

How do we use these controls in mathcad.

Can anyone post some samples. Just I wanted to understand the approach with an example.

 

I have seen these controls using in excel, just thinking about the approach to use in MC

Nested if Statements

$
0
0

I need to do some nested if statements for conditional programming and I cannot figure out for the life of me how to nest if-statements using the programming toolbar.  I am in Matcad 14 and the "add line" button just adds if-else if statements, I need to nest.  All the "add line" option does is just add another line on the same logic level.  Is there a difference between if and conditional if?

 

I posted a flowchart of the basic program logic. (Ignore the red lines, that is just my spell checker)

 

flowchart.png

Mathcad Automation API

Again else If statements

$
0
0

Hi everyone, I don't know what's happening to me, but when I think I know how Mathcad works, I'm not able to do a simple thing.

 

Mi problem today it's that I'm trying to do an "else if" statement but again, for some reason I cannot figure out how to program it. I've searched through the forum but I don't know how to fill the part that is missing (see image)

 

Clipboard06.jpg

 

Again, if someone could give me a hand with this (I'm going crazy) I would appreciate.

 

Thx in advance.

Area Collapse/Expand

$
0
0
Hi,
I have MC13 and I'm writing some applications using the mathcad controls.
Is there any way that I can write a script inside a component (e.g. radio button, push button, etc) to expand and collapse areas inside the same spreadsheet?
Thanks in advance,

David

Colour between curves

$
0
0

Please could someone show how to colour beteeen two curves.

see attached.

thanks

 

Jason

Foreign Exchange Currencies in MathCad

$
0
0

I am interested in finding a way to process foreign exchange rates in MathCad. Does anyone know of a workaround or add-in that will allow me to declare the value of one currency in terms of another, and then use that value to complete my calculations?


Shift Register Instead of For loop

$
0
0

Hiya,

 

Is it possible that I could use shift registers instead of for loop in mathcad.

 

 

 

 

 

 

Thanks.

working with vectors in a program

$
0
0

Hi everyone, I'm having lots of issues with one program I'm doing, and I would like to ask if you can help me with one in particular.

 

I'm trying to pick up a number from a vector compare it with some value and then do an iteration, but for some reason Mathcad doesn't let me pick up the number from the vector.

 

I'm trying to do:

 

Clipboard04.jpg

 

but it seems that I cannot use this kind of statement in an iteration.

 

Thx in advance.

 

PS: I'm Spanish so excuse me if my english it's a little bit rough

Simple program - wrong return value

$
0
0

This is a problem I stumbled upon writing a more complex routine (http://communities.ptc.com/message/197514#197514) and was able to cut down to the attached simple programs.

Can anybody explain whats wrong with Test2()?

Why is the else branch ("otherwise") not evaluated when the first "if" is triggered??

Inserting that dummy line as in Test1() "solves" that problem, but whats the reason for this?

ProgramOutputTest.png

selection of items in a Marix

$
0
0

Hello everybody,

 

I need some help to select sevral lign in a matrix using a logical test and then create a vector which wwould summarize all selected items.

 

To be more accurate, my problem is to select the right "spring" cosidering given deflexion and maximum reaction load within this loading configuration. I already creat a fonction which calculat the reaction load for a given deflexion and spring model ( equ_paulstra_reactionload("matrix of the approximated polynomial coeficient which give reaction load in function of the deflexion","deflexion","ligne of the considered model" ). Then I would create a fonction which test each spring and put them in a vector using there reference.

 

I join my work done so far.

 

Thanks a lot for your elp,

 

regards,

 

Mathieu STAUCH

creating a program for multiple-application trapezoidal rule

$
0
0

I have to create a program using the multiple-application trapezoidal rule. I'm not sure what else I need to add into the program. It keeps saying my f(x) variable is undefined. I've tried a few things and nothing is working. Thanks for any/all help.

Viewing all 2429 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>