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

.Net User EFI interface

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

14 REPLIES 14

Re: .Net User EFI interface

Updated.

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

Re: .Net User EFI interface

Updated.

- echo functions added;

- small changes.

Simple examples are attached (pdf files).

Re: .Net User EFI interface

Great work!

Thanks for sharing!

Re: .Net User EFI interface

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

Re: .Net User EFI interface

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

Re: .Net User EFI interface

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?

Re: .Net User EFI interface

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.

Re: .Net User EFI interface

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

Re: .Net User EFI interface

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.

Re: .Net User EFI interface

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.

Re: .Net User EFI interface

Very impressive.

Re: .Net User EFI interface

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;

}

Re: .Net User EFI interface

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

Re: .Net User EFI interface

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

 

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."