include

include - include() function allow you to include simple definitions from other documents. - 消息

#121 已发布: 2019/2/24 05:19:39
Martin_B

Martin_B

22个赞,共84个帖子。

组: User

Wrote

Updated. Try now.



It works. Thanks a lot.
#122 已发布: 2019/3/19 16:25:04
Arie

Arie

94个赞,共285个帖子。

组: User

Wrote


Updated (plugin version changed to 0.2.x.x). Try now.

Old worksheets must be saved in the new format.



Hi is there anyway to throw an error if the worksheet needs to be saved?
It presently evaluates to 0 without any indication of error.
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#123 已发布: 2019/3/19 18:53:27
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

Most of my plugins have a log file in the folder where the plugin is located. Yes, I could classify the errors and stop the function when the first error occurred. In the meantime, I quietly write them to a file. The parse function tries to recognize all constructions as much as possible, but this cannot be done completely in the way that I use. In order not to return an error, I return the number of recognized definitions.
Russia ☭ forever, Viacheslav N. Mezentsev
1位用户喜欢此帖子
dio pants 2019/3/19 23:58:00
#124 已发布: 2019/3/19 20:33:25
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Wrote

Hi is there anyway to throw an error if the worksheet needs to be saved?
It presently evaluates to 0 without any indication of error.


The wrong may be right ... isn't it ?
Red does not necessarily means error.
It may mean "Equation too long to display"
For sure: if a result is wrong, wrong until doctored.
Cheers alyles ... Jean.

Oh ! you forgot the work sheet !
#125 已发布: 2019/3/20 00:08:38
dio pants

dio pants

16个赞,共180个帖子。

组: User

Uni-

I have been chasing this error for a little while now.

Alyles and Davide helped me on Discourse, ( https://en.smath.com/forum/yaf_postst17181_IRC-or-Discourse-channel-anyone.aspx )

and we figured out that the issue was that the file that was to be included needed to be touched, or opened and saved to update it, and then save it.

The log however, leads one to believe that function loaded correctly and included the file. See screen below.

The other difficulty I had was finding the log- the extensions folder names are obfuscated.

Click to enlarge
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#126 已发布: 2019/8/14 03:27:01
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

Wrote

and we figured out that the issue was that the file that was to be included needed to be touched, or opened and saved to update it, and then save it.



1. Included sm-file must exsists.
2. You need save document with include() function (for relative path). This is because of value of current directory. Only when you save worksheet the current directory and the path to sm file become defined. For now as I know there is no way to address this. SMath Studio change the current folder only when you save the document.

Perhaps the error is due to the fact that the parsing of the document failed, but an error message is not provided for this case.

Wrote

The other difficulty I had was finding the log- the extensions folder names are obfuscated.



As for that for now I don't know how get access more simply.
Russia ☭ forever, Viacheslav N. Mezentsev
#127 已发布: 2020/11/18 04:11:05
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: User

Hi. First, thanks for your work. I think that include it's one of most important tools in SMath for write advanced functions, like ode solvers, in native SMath code, instead of use C# plugins.

It's possible using include in a function body? Please, see the attached. In case that it could be, can also be values in include only local for the caller function, and not to the entire worksheet?

ref_f.sm (2.29 KiB)已下载 1513 次。
work_with_ref_f.sm (19.44 KiB)已下载 1481 次。
work_with_ref_f.pdf (102.22 KiB)已下载 837 次。

Thanks!!!
Best regards.
Alvaro.
#128 已发布: 2020/11/18 06:09:21
sergio

sergio

127个赞,共342个帖子。

组: User

using "include" as a function parameter can work around the problem!?

SMathStudio_Desktop_aUJl1swnf3.png

sergio
1位用户喜欢此帖子
Alvaro 2020/11/18 13:36:00
#129 已发布: 2020/11/18 13:35:22
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: User

Wrote

using "include" as a function parameter can work around the problem!?

sergio



Hi Pompelmo. Absolutely. That' exact what I want. Thanks very much.

Best regards.
Alvaro.
#130 已发布: 2020/11/18 14:15:41
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

It's funny, but be patient and no workaround is needed. Andrey will help us with a possible bug.
Russia ☭ forever, Viacheslav N. Mezentsev
1位用户喜欢此帖子
Alvaro 2020/11/18 14:31:00
#131 已发布: 2020/11/18 15:35:54
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Wrote

It's funny, but be patient and no workaround is needed. Andrey will help us with a possible bug.


I understand the idea of introducing include in some kind of collection, something similar writefile, readfile. But, include is a one time use. In the attached, if I copy/paste include in a new sheet file not found ... same if recall from the f(x) menu and code.
The idea was to use the algos include for other data fitting session.
OK, in that single use include, no problem to add more fitting sessions.
In the attached, we have 3 fitting sessions all happy from single include.
What is the use of include ? To me, just a competitive curiosity to Mathcad.
Collapsed area does the same thing, infinitely transportable.

Cheers ... Jean

GenfitAlgoInclude.sm (36.06 KiB)已下载 1547 次。
Genfit Algo Include Test UpDated.sm (88.09 KiB)已下载 1521 次。
#132 已发布: 2020/11/19 14:52:07
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

Someday, Jean, sm-document will become a project, in other words we will have a complete book. I hope so.
There is still a lack of standardization in the documents. Everyone invents their own wheel. This is extra work.

Libraries need to be made from standard calculations. Now there are two versions of "libraries": plugins and files connected using an include() function.
Collections from such libraries have all the serious design tools.
Russia ☭ forever, Viacheslav N. Mezentsev
#133 已发布: 2021/11/18 04:12:24
FloR

FloR

0个赞,共1个帖子。

组: User

Hello,

I have a question if it is possible to use the include plugin and include only some "public" variables from a include.sm to an other file and not all variables which exists in the included file?

Thaks,
Florian
#134 已发布: 2021/11/18 05:58:57
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

In theory, I could add some sort of options to filter the contents of the files, but usually the definitions are interconnected. If this is not the case, then they can be saved in a separate file and included in other files. It is possible to add options to search for matches by operand name, function name, or area name, but this is unlikely to be useful.
Russia ☭ forever, Viacheslav N. Mezentsev
#135 已发布: 2021/11/19 18:26:49
Ryan Freund

Ryan Freund

20个赞,共339个帖子。

组: User

A couple things about include()

Is it possible to include variables assigned by the combobox region yet? (see here: https://en.smath.com/forum/yaf_postsm30772_Include-and-Combobox-Region.aspx)

A strange behavior also exists that is related to combox results. Try this:
Create a 'parent file'.
Add a combobox list in the parent file. Let's say it is a "yes/No" matrix and you choose "yes". So "yes" is assigned to the variable YN.
Now create a child file and include the parent file.
It will say that YN is not defined.
Let's go back to the parent file and manually assign YN:"Yes".
Now YN="Yes" in the child file.
Go back to the parent file and delete the manual definition of YN, but keep the combobox list.
Now open the child file and find that YN=yes is still defined. Even if you change the combobox list to "No".
#136 已发布: 2021/11/19 19:50:37
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

Any visual region is skipped as the reading algorithm cannot simulate its operation. Only the core of the program can do this. The external (user) API does not have the ability to recreate components, since it is a complex operation. Only simple definitions can be read and reconstructed.
Or you can ask Andrey to include this feature in the set of standard functions. In this case, he could use the already existing loading code to implement the desired functionality. He knows much more about it.

PS. Okay, as an exception, I could add parsing of this component using its sources. Maybe something will work.
Russia ☭ forever, Viacheslav N. Mezentsev
1位用户喜欢此帖子
Ryan Freund 2021/11/20 09:33:00
#137 已发布: 2021/12/10 06:03:37
Chito

Chito

1个赞,共6个帖子。

组: User

Hi. Thanks for this plugin. I found it very useful in creating a single custom functions file for my team.

I'm encountering errors when I have strings with spaces or any other special characters as arguments. If I call the function within the included file there's no error. Does anyone have an idea on what's causing this?

smath-include-error.png

Thanks.

test_sheet.sm (5.08 KiB)已下载 1546 次。
test_include.sm (5.18 KiB)已下载 1527 次。
#138 已发布: 2021/12/10 06:22:01
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

SMath Studio compatibility

Plugin updated. Please try.

Changes:

- added encoding of special characters in the text.
Russia ☭ forever, Viacheslav N. Mezentsev
1位用户喜欢此帖子
sergio 2021/12/10 08:53:00
#139 已发布: 2021/12/10 06:37:16
Chito

Chito

1个赞,共6个帖子。

组: User

Wrote


Plugin updated. Please try.



The update solves the problem. Thank you very much uni.

#140 已发布: 2022/1/4 19:46:14
Вячеслав Мезенцев

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

1,558个赞,共1,868个帖子。

组: Moderator

SMath Studio compatibility

Wrote

Any visual region is skipped as the reading algorithm cannot simulate its operation. Only the core of the program can do this. The external (user) API does not have the ability to recreate components, since it is a complex operation. Only simple definitions can be read and reconstructed.


As it turned out, there is something that can be done.

Wrote

PS. Okay, as an exception, I could add parsing of this component using its sources. Maybe something will work.


Plugin updated ( ). Please try.

Changes:

- added support for: combobox, combobox list, checkbox list, radio button list, slider;
- the algorithm of work has been changed;
- refactored.
Russia ☭ forever, Viacheslav N. Mezentsev
4位用户喜欢此帖子
sergio 2022/1/5 06:12:00, Davide Carpi 2022/1/5 11:09:00, João Felipe Seráfico Melo 2022/1/5 08:03:00, Ryan Freund 2022/1/5 15:25:00
  • 有新帖
  • 无新帖