How to share user defined functions or plugins without programming?

How to share user defined functions or plugins without programming? - How to share user defined functions or plugins without programming? - Messages

#1 Posted: 12/19/2016 5:27:40 AM
fernando_92

fernando_92

0 likes in 3 posts.

Group: User

Hello,
As far as I know, Smath allow us to create user defined functions and to share them using the "plugins". Plugins can be created by programming the functions using a development tool.
But this solution is not practical enough when the functions are really complicated. (cf https://smath.com/wiki/GetFile.aspx?File=Developer%20Guide/Tutorial%20on%20creating%20plugin%20for%20Smath.pdf)

I would like to know how would it be possible to share some user defined functions or plugins without having to program.

For example, imagine I use "function1" in several Smath projects.
I want to be able to use this "function1" in all of my sheets without having to redefine "function1" in every project.

Please this would be very helpful for me.

Thank you for your suggestions.

Fernando
#2 Posted: 12/19/2016 5:38:11 AM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

You can use include plugin for this.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
fernando_92 12/19/2016 7:52:00 AM
#3 Posted: 12/19/2016 10:59:13 AM
Arie

Arie

93 likes in 285 posts.

Group: User

I use snippets for this purpose.

For more info on snippets see the wiki here: https://smath.com/wiki/Snippets.ashx
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
2 users liked this post
Davide Carpi 12/19/2016 11:58:00 AM, fernando_92 12/20/2016 4:18:00 AM
#4 Posted: 12/19/2016 9:59:30 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

For example, imagine I use "function1" in several Smath projects.
I want to be able to use this "function1" in all of my sheets without having to redefine "function1" in every project.



That's what the "plugin Include" does.
1. Plug these two in the same directory.
2. Open "Genfit Algo Include Test.sm"
3. It will ask to install "include Plugin", install.
4. Press F9 to calculate work sheet.

Please confirm if it works for you.
Was created Smath 5346, works fine latest Smath 6179.

Jean

Genfit Algo Include.sm (13 KiB) downloaded 39 time(s).

Genfit Algo Include Test.sm (16 KiB) downloaded 42 time(s).

1 users liked this post
fernando_92 12/20/2016 4:18:00 AM
#5 Posted: 12/20/2016 12:04:51 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... try these two . Same topo as previous "Genfit"

Fourier 2D ZOOM Include.sm (11 KiB) downloaded 44 time(s).

Fourier 2D ZOOM Include Test.sm (105 KiB) downloaded 46 time(s).
#6 Posted: 12/20/2016 4:22:49 AM
fernando_92

fernando_92

0 likes in 3 posts.

Group: User

Hello, thank you for your suggestions, plugin " Include " works for me. It is really helpful. I will have to test its limits.
But I would like to know now what is the difference between Snippets and the "Include" Plugin ? Why couldn't we just use snippets?
Thank you!
#7 Posted: 12/20/2016 10:05:06 AM
Arie

Arie

93 likes in 285 posts.

Group: User

Both Snippets and Include you have a "master" worksheet that includes all the functions you'd like to incorporate into the worksheet.

With Snippets, you actually create a copy of the "master" and essentially paste it into the worksheet that you are using. It puts the copied worksheet into a collapsible area so you can minimize it if you'd like.

Advantages and disadvantages to this approach are as follows.
1.) You have direct access to the function definitions. You can see how you wrote a certain function or make changes in your local copy but they don't get updated in the "master" snippet.
2.) If you update the "master" snippet worksheet, it does NOT update worksheets where the snippet as been used. You would have to re-add the snippet in subsequent worksheets to update.

With the Include plugin, you are essentially running the "master" worksheet in the background and you have access to the results and functions defined in that worksheet. This has the potential advantages/disadvantages of
1.) Cannot see or change the function definitions in the local worksheet.
2.) An update in the "master" worksheet will be immediately available to any worksheets that include the master.

I prefer snippets for managing functions a couple reasons.
1.) I like to have the local copy of the functions in the worksheet. I often make worksheets and don't come back to them for months or years at a time. When I do, I like to see the state of the functions that I used at that time. Everything I need is in one worksheet. If I were to use the include plugin and for any reason I lost or misplaced the master Include worksheet, I'd be SOL.
2.) I think I ran into the issue with the include plugin with which function Descriptions don't get passed from one worksheet to another. I often write a lot of detail on how some of my more complicated functions work so they can be useful to others or so I can remember how to use them properly. Using the include plugin, you'd have to go to the master worksheet to see that information

I find include plugin to be much more useful for transferring results. Perhaps I create a worksheet to solve for the output of a certain circuit. I then want to use the results of that for the input of another circuit. I may use the include plugin in that situation.
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
1 users liked this post
frapuano 12/20/2016 1:01:00 PM
#8 Posted: 12/20/2016 12:03:20 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Thanks for the ellaborate distinction.
"Snippets" is like a plugin, like something done for ever [so to speak].
I understand better how to manage "Include". Looks much easier to recompose
a stand alone work sheet to share in the forum.
#9 Posted: 12/20/2016 12:13:45 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Hello, thank you for your suggestions, plugin " Include " works for me. It is really helpful. I will have to test its limits.
But I would like to know now what is the difference between Snippets and the "Include" Plugin ? Why couldn't we just use snippets?
Thank you!



Fernando:

Did the 2nd "Fourier" example work ?

It didn't work for me the first time. It couldn't find the Matlab "mwXXX.."
library. By luck I type 'mwbesselj(1,1.23456789) in new sheet. It did want
to install the 8 MB Matlab stuff, YES, done, then the Fourier is available.

Viacheslav replied: repaired.

Jean

  • New Posts New Posts
  • No New Posts No New Posts