Access SMath file from within C++ app

Access SMath file from within C++ app - Can a C++ program access variables and results of a SMath file? - Messages

#1 Posted: 10/23/2017 5:03:14 AM
florian.kosche@difk.no

florian.kosche@difk.no

0 likes in 8 posts.

Group: User


Hi,

I wounder if it is possible to access SMath files from within C++ app to provide values for variables and get back results. The reason is that it is easier to develop and check analysis for ever changing tasks in SMath but include it in our general analysis solving application.

Thanks!
#2 Posted: 10/23/2017 12:55:24 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I wounder if it is possible to access SMath files from within C app to provide values for variables and get back results. The reason is that it is easier to develop and check analysis for ever changing tasks in SMath but include it in our general analysis solving application.



Not clear what you are asking for:

If you C++ application can generate vector of values and if it can write to NotePad,
you can read NotePad from Smath and proceed to the maths you wish, that Smath can digest.

Maybe the other way around ?

Read NotePad.PNG
#3 Posted: 10/23/2017 1:15:39 PM
florian.kosche@difk.no

florian.kosche@difk.no

0 likes in 8 posts.

Group: User

In principle yes, but not exchange values through text files, rather than an api towards specific SMath files. You could imagine the SMath file includes operations that can be accessed by a C++ function.

I then could write a program in C++ which would connect to a SMath file and feed it with values and get back results.

Was that maybe clearer?
#4 Posted: 10/23/2017 5:05:14 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Ah ! got it ... Application C++ read Smath data ,<= [data generated by Smath from some function(s)]
... then Smath <= read back application . Bidirectional means both in some universal code.
The real question is: could Smath do same as the "Application" ? ... you give no hint.
#5 Posted: 10/23/2017 9:36:51 PM
florian.kosche@difk.no

florian.kosche@difk.no

0 likes in 8 posts.

Group: User

I have no hints, but I think you understand. In a way you would integrate SMath files into the C++ application during execution as if they were C++ functions. This would not happen at compile time but during execution.

#6 Posted: 10/23/2017 10:42:49 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I have no hints, but I think you understand. In a way you would integrate SMath files into the C application during execution as if they were C functions. This would not happen at compile time but during execution.



That's what Mathcad is doing with the extension packs.
You can work solely from the respective extension pack or from the normal Mathcad work sheet
that calls the functions from the pack. But functions in the pack(s) are coded in Mathcad style.
In other words, the Smath functions would have to be coded C++ for the application to read
at execution time... And from the C++ application, were to you feed that to plot, tabulate
and else project demand ?

Smath has already some stuff from "Dot Numerics, Matlab..."

Cheers, Jean ... Hope you get more professional reply.
#7 Posted: 10/24/2017 1:48:52 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Wrote

I then could write a program in C++ which would connect to a SMath file and feed it with values and get back results.



There is no direct way for this. Theoretically, you can use shared memory for this. But still there is no direct access from the unmanaged memory to the managed one. Also you will need a way to calculate the document from the outside.

For now there is no API to control SMath Studio from own application. And Andrey was against using separate parts of the program as a worksheet calculator.
Russia ☭ forever, Viacheslav N. Mezentsev
#8 Posted: 10/24/2017 5:04:07 AM
florian.kosche@difk.no

florian.kosche@difk.no

0 likes in 8 posts.

Group: User


I see! Would be a very powerful tool for practical engineering though. A work around could be that SMath sheets can be exported as C or C++ code, which than could be linked into the application.

I shall think a bit more.

Thank you for your answers!
#9 Posted: 10/24/2017 5:26:03 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Wrote


A work around could be that SMath sheets can be exported as C or C++ code, which than could be linked into the application.


It's impossible. SMath Studio is a .Net application and worksheets (which including visual components) also depend on .Net assemblies. So, you can't do that.
But you can add your code as plugin like Mathcad EFI or CPPPlugin.
Russia ☭ forever, Viacheslav N. Mezentsev
  • New Posts New Posts
  • No New Posts No New Posts