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

The PTC Community email address has changed to Learn more.

.Net User EFI interface


.Net User EFI interface



- only for 32-bit systems;

- mc15 & mp3 supported (mp3 can't get string value for now);

- only .net 2.0 supported;

- examples for vs2008.



Now 3 test projects available: c#, and c++/cli. All based on .net 2.0.


- echo functions added;

- small changes.

Simple examples are attached (pdf files).

Great work!

Thanks for sharing!


If someone will write JSON codec as a program, it will allow to exchange of data (between Mathcad and dll) in any format, using strings (nested arrays, for example.).


- error handling added (only one function in the assembly may contain a static field Errors - array of strings).

For example:

using System;

public partial class cserror {

public static String[] Errors = {

"cserror 1",

"cserror 2",

"cserror 3",

"cserror 4"



How to use:

using System;

using NetEFI;

public partial class cserror: IFunction {

public FunctionInfo Info {

get {

return new FunctionInfo( "cserror", "n", "return error string",

typeof( String ), new[] { typeof( TComplex ) } );



public FunctionInfo GetFunctionInfo( string lang ) { return Info; }

public bool NumericEvaluation( object[] args, out object result ) {

throw new EFIException( ( int ) ( ( TComplex ) args[0] ).Real, 1 );



EFIException( ErrNum, ArgNum) - like in MAKELRESULT().

Sorry for my ignorance here but I am a little confused about what you are doing. Do you mind claying exactly what you are doing?

Not sure understand correctly.

In this discussion we will collect, I hope, all the issues related to the design of user libraries based on .Net languages.

Feel free to asking questions.

Sorry I should have read up on EFI before posting. Is this a way of developing user defined functions with Mathcad I take it?

Yes it is.

Here one man asked to help him: Re: DLL in Visual Studio

What I want to do is in the opposite direction: I want to know if it is possible to call a function, previously builded in Visual Studio, from Mathcad and then be able to manipulate the

data gathered from that visual Studio function in a mathcad worksheet.

Please, correct me if I misunderstood your post.


I liked his example and I decided to help him. Now it is possible to implement the project in the way that he wants. I'll show later how to do it using

Ok, now we can take a snapshot from usb webcam

Don't forget, this works only on 32-bit systems. I don't have access to a 64-bit system for now.

Very impressive.

Updated (github).

Now you can use context:

public bool NumericEvaluation( object[] args, out object result, ref Context context ) {

//while ( !context.IsUserInterrupted ) { }

if ( context.IsDefined( "vbecho" ) ) {

context[ "vbecho" ].NumericEvaluation( args, out result, ref context );

} else {

result = Evaluate( ( string ) args[0] );


return true;


public string Evaluate( string text ) {

return text;


Updated (github).

How it works (rus): Внедрение кода с пользой

Tested for MC15 M050 x32 and MC Prime 6.0 x64. Now you can use .net (c#,, c++/cli) user functions in x64 Mathcad Prime.



- 64-bit support added.


- TComplex changed to .Net Complex from System.Numerics;
- refactored.


- added support utf-8 for result string;
- added example project "capture".


- only for 32-bit systems;
- mc15 m050 tested;
- .net 4.0 supported;
- examples for vs2019.



Now we can increase the speed of calculations. In this example in 5 times. Part of the function is implemented in the plugin.





MC Prime 7.0 x64 also supported.

Mathcad Prime 8.0 x64 also supported.


NetEFI in MP8.jpg