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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Translate the entire conversation x

.Net User EFI interface

ViacheslavMezen
12-Amethyst

.Net User EFI interface

Sources: https://github.com/ViacheslavMezentsev/NetEFI

[26-06-2014]

- only for 32-bit systems;

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

- only .net 2.0 supported;

- examples for vs2008.

22 REPLIES 22

Updated.

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

Mathcad Prime 10.0 x64 also supported.

 

netefi.png

Updated.

- echo functions added;

- small changes.

Simple examples are attached (pdf files).

Great work!

Thanks for sharing!

Thanks.

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

Updated.

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

Diego.

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 vb.net.

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#, vb.net, c++/cli) user functions in x64 Mathcad Prime.

 

[22-01-2021]

- 64-bit support added.

 

[21-01-2021]
- TComplex changed to .Net Complex from System.Numerics;
- refactored.

 

[19-01-2021]
- added support utf-8 for result string;
- added example project "capture".

 

[18-01-2021]
- only for 32-bit systems;
- mc15 m050 tested;
- .net 4.0 supported;
- examples for vs2019.

netefi-x32.png

netefi-x64.png

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

 

2021-01-23_22-08-58.png  

2021-01-24_02-32-39.png

 

MC Prime 7.0 x64 also supported.

Mathcad Prime 8.0 x64 also supported.

 

NetEFI in MP8.jpg

 

photo_2022-03-30_23-50-25.jpg

Mathcad Prime 10.0 x64 also supported.

 

cstools.png 

CustomFunctions.png

Mathcad Prime 11.0 x64 also supported.

 

uni_1-1746696081194.png uni_0-1746696014950.png

 

NetEFI Framework for Mathcad


This framework allows you to create user-defined functions for Mathcad 15 and Mathcad Prime using any .NET language (C#, VB.NET, etc.). It removes the need to write C++ code, allowing you to focus on your function's logic in a familiar managed environment.

Key Features

  • Write in .NET: Develop your custom functions in C#, VB.NET, or any other .NET language.
  • Full Compatibility: Supports both the classic Mathcad 15 and modern versions of Mathcad Prime (via the legacy Custom Functions API).
  • Rich Data Types: Natively handles complex scalars (Complex), complex matrices (Complex[,]), and strings (string).
  • Easy Setup: The NuGet package automatically includes the required C++/CLI host (netefi.dll), so you only need to focus on your C# code.
  • Advanced Features: Provides an API for error handling, logging, and checking for user interruption (Esc key).

    uni_0-1755895013450.png


    You need to make sure that the 64-bit version of netefi.dll gets into the folder during assembly.

NetEFI.Framework 0.4.0
For users of versions prior to 0.4, please note this is a BREAKING CHANGE

uni_0-1755982294194.png

 

NetEFI.Framework 0.5.0

 

uni_0-1756704774250.png 

uni_1-1756704785372.png


New Error Handling System (Breaking Change);
API and Project Refinements (Breaking Change);
- A new `context.Invoke<TResult>(...)` method allows for type-safe calls between custom functions.

 

Announcements


Top Tags