Import definitions / equations / textregioin from text-file - Possibility to generate a worksheet from another program ... - Сообщения
I'm using Excel to generate some mechanical models for shafts of gear-boxes and I also have got the possibility to put the equilibrium conditions into text- formulars.
Because Execl can neither display the equations in any way, nor calculate the results I would like to import the "Values" of the Excel-sheet into SMath.
As I use Geogebra too, wich has got the function to type commands in one line and let them run as an input I thought that it would be great to have it in SMath too...
So, is there some kind of scripting functionality tha provides the possiblity to read a script-file in text-format which tells smath what to do ... e.g. x:5/3 *F.Ax
And if not, do you have another idea for a solution?
Regards
Teacher
2. Excel can tabulate values from the equation, and plot the graph
3. Show your formula in Smath.
4. Smath can retrieve formula(s) ... "include"
- What do you mean by generating models? Collect parameter values?
- I bet Excel can actually calculate any result, provided the user is able to specify the procedure.
- What is the purpose of using external text files instead of directly specifying what you want to do?
There are some examples for mechanical problems in the online gallery, see e.g. BeamFEA, which includes heavy scripting/programming.
thanks for your replies ....
Maybe I try to describe the situation a little bit more:
I've build a sheet where I can input the loads and the geometry of the shaft and Excel is now calculating vales of the reaction forces - not the formulas.
Though I often have to give a sample solution I am in need of the formulas of the reaction forces. So put the given input data within Excel together to get the formulas (as a string in a cell of the sheet) like this:
S/greek F.y=0 /next fomular/ F.Ay+F.By-F.t-F.p=0
S/greek F.z=0 /next fomular/ F.Az+F.Bz-F.r=0
... and so on...
Because I have to use those forumlas to continue calculating wihtin SMath I am looking for a possibility to import a list of commands (like I said, I know this from Geogebra) or just copy & paste the "text of the command" (like given above), so I don't have to type it manually again!
I hope this makes things a little bit more clear.
@Jean: If I would import the data the Excel-sheet, would it be possible to create a formula from a given string within the imported table?
So thanks again in advance for further informations
WroteSo thanks again in advance for further informations
Start from square 0 in Smath
Write your formula(s), one by one , plot the first formula
try next, and so on. Collabs can see something.
The key failure is "hybrid non-compatible math tools"
You have Geogebra ... doing what that Smath can' t do ?
Excel plots and tabulates: you don't need => Smath plots & tabulates.
Can't help w/o seeing your 1rst step(s).
WroteSo, is there some kind of scripting functionality tha provides the possiblity to read a script-file in text-format which tells smath what to do ... e.g. x:5/3 *F.Ax
You can use importData.XLSX from Xlsx Import/Export plugin
sorry for posting again so late, but there were quite a few things to be done ...
So here what it is all about:
I've created a Excel-file with many different sheets within to do the following:
-1- define the input-values like
+ setcions of a shaft (diameter, length)
+ material paramters (mechanical stiffness parameters)
+ the points where loads are aplied to the shaft as well as the mounting points
+ ....
-2- the sheet is built up in the way that the reaction forces at the mounting points are calculated automatically by value (not by formula)
-3- on another sheet ...
+ the internal force variables
+ the single mechanical stresses (like tensile stress / pressure, bending stresses and torsional stress) are evaluated by combining the internal forces with the given geometry data
+ the reliability is determined from the given stresses and the material parameters
All this is calculated by value (not by formula) in a veeeery huge table
-4- the results are shown in some diagrams
Often I need to write a sample solution. For this I need to document the way how to get to the solution by formula (and not as it is done within the Excel-sheets by value only (yes there are fomulas too within the sheets but they are generated in a veeeery general way, so nothing ever any engineer would use without a computer).
For this reason there is
-5- a sheet where it is possible to generate some free punches for calculating
+ the reaction forces and
+ the internal force variablesФайл не найден.Файл не найден.
Because this is just a "static" picture [as it is not possible to build a 3D-vector-diagram wihtin Excel] I thought about using Geogebra so there is
-6- another sheet where the given model (shaft-geometry, loads, reaction forces and if needed the inernal forces) is translated into text-command-lines to be used as an input on Geoegebra's input line.
Maybe you can - by looking at the screenshots - follw my decision to use Excel-sheet instead of the sheet-functionallety within SMath...
Now, at least, the only thing for documentation which is still missing is generating the the formulars for calculating the reaction forces and the internal forces, and maybe somewhen the stresses and the reliability at certain points.
.... and all this was leading to the question: Is there a way to import commands, which are given in a text-form (e.g. F.Ax:100'N
I hope posting a screenshot of every given point is helping to follow my explanation.
So and after this I hope what I'm trying to find and can help me out with some solution ;-)
Regards
Theoretically you can create your own sm-file, but it's too hard.
You can create a report using LaTeX or something similar.
Script Region
var cmds = new List<string>( new[] { "F.Ax:100*'N", "F.Bx:F.Ax-a" } );
cmds.ForEach( c =>
{
var tmp = SMath.Math.Symbolic.Converter.ToMItem(c).ToTerms();
Decision.SymbolicCalculation( Entry.Create( tmp ), store );
} );
store.TraceData( "Done." );
It's funny, but I was still hoping for the sentence "You will not be able to place the expression on the sheet." not to come. But in fact thats exactly what I'm trying to do.
The "hidden" definitions are good for calculating, but then it would be possibleto import Excel-data instead ... So this is not helping me out at all.
I just took a look on an example .sm-file and recognized that it is "just" a textfile, so it would be possible to "copy & paste" the body of an empty .sm-file and then insert my fomulars ....
the marked regions are going to look like that ....
As it seem to be a boring work to analyse the .sm-file and figuring out which command / region is responsible for which expression in the workbook and how its structure works:
***
Is there any description of the SMath-file-format to help me getting along faster?
***
Of course that's a lot of work, but if there is no other way to get my documentations done ... Over the years it will save a lot of time and of course - boring work of typing the formulas manually...

... May be now, as it seem to be clear what I'm trying to do, anyone has got a better idea ...
Regards
Just create an sm-file (by modifying a sample xml source as described above) and write it to the snippets directory of your SMath installation. In the file properties you can define a name, which you just need to type at the point, where you want to insert the file.
The procedure is described in my pdf handbook.
I don't think that the numerics of the beam is too complicated for SMath, just have a look at the BeamFEA example (you can open it in SMath in the cloud)
thanks again and again and again ;-) Pretty cool to know that there are some other people out there who's also interested in solving problems ...
@mkraska: I know about the snippets and I also had a look at the beam-example a while ago. And of course I don't think that SMath can't handle the calculations I've been doing along with Excel. It's more that in this case I found it much more comfortable doing the graphing and drawing things along with Excel and so I did the rest along with it too.
@Davide: Sorry for ignoring your former post about the inputData-plugin. According to that I've got some questions:
-1- how is the path defined for the XLSX-file (I've been trying some example where I just put both files (.sm .XLSX) within the same directory, but it doesn't work.
-2- Is it possible to "repost" the definition of a formula? When defining a formula like F.Ax:F.Bx-F.S I can see the definition (of course ;-)), but when typing F.Ax= it only shows the numerical result of the formula. I think that's the reason you've been using a matrice for importing the data, right? Is there any way torepost the definition of a formula??
Regards
Wrote@Davide: Sorry for ignoring your former post about the inputData-plugin. According to that I've got some questions:
-1- how is the path defined for the XLSX-file (I've been trying some example where I just put both files (.sm .XLSX) within the same directory, but it doesn't work.
-2- Is it possible to "repost" the definition of a formula? When defining a formula like F.Ax:F.Bx-F.S I can see the definition (of course ;-)), but when typing F.Ax= it only shows the numerical result of the formula. I think that's the reason you've been using a matrice for importing the data, right? Is there any way torepost the definition of a formula??
Regards
- absolute (C:\...) or relative (in the example above, both the files were in the same folder)
- you can import definitions (simplified example in the cloud) or you can act like in the screenshot above; if you don't mind about calculations smath-side, then you can use a boolean equal in place of the definition symbol and maybe you can hide the LHS (the import function - right click on the region and unflag "display input data")
it's been a while since opening he post ...
At first I really like to thank you all for beeing interested in my problems and giving your point of view to solving the problem.
After thinking a while (and of course looking at the structure of a SMath-file) I decided that it is best for me wo export my Excel-generated data into a native SMath-file.
I know that there are easier way to solve the given problem by using so mathematics, but because I like the solution to look like it is "hand-made" it took a while in considering all those special cases that might occur. And now, after all I'm done with that and everythings works fine. So the most of the time I was spening my time in generating names for the variables, match the layout and stuff like that. Exporting and building the SMath-file was just an blink of an eys compared with that...
You might want to habe a look. The attached SMath-file is totally automated exported from Excel. When opening the first time you might dicover that it takes a while for SMath to build up the screen. It might be that I was not looking too seriously at the synthax-rules. But SMath is very frugal with that and if you save the file and reopen it everything is "repaired" by SMath.
Again, thanks a lot for inspiring me ;-)
Regards
here is a screenshot for those who don't like downloading the file:
here is the SMath-file for downloading:
UM-Achsen+Wellen-Aufgaben-Aufgabe 5.sm (18 КиБ) скачан 57 раз(а).
-
Новые сообщения
-
Нет новых сообщений