Checking interest for Python interface to starter/engine keywords #678
Replies: 5 comments 7 replies
-
Hello Marco, It is really great idea. A python script for starter makes very easy to integrate openradioss with other open source programs such as salome-meca and Freecad. It will be very tedious to write the script for each card as you said. Scraping cards from hm_cfg_files in main directory of OpenRadioss can be better. As far as I understand, this folder contains the default values of each card and the parameters in the card. I can join you if you share your codes on github. All the best, |
Beta Was this translation helpful? Give feedback.
-
I have committed what I have so far to Github. There is no packaging/installer yet. Will add that when it reaches a more mature state. Also, many of the tests/definitions only contain place holder code. Note that I have grouped the ~600 keywords alphabetically in sets of 9 keywords per batch. This keeps the amount of code in a single module (file) to an acceptable level. Given a group of keywords contained in a single batch, there are essentially two pieces of information that needs to be defined:
In the Much of the scaffolding code is automatically generated. I does however need some manual tweaks here and there. For example the "/DEF_SHELL" and "/DEF_SOLID" where not correctly represented because of the underscore in the keyword name. I manually corrected this in the dataclass names and corresponding import statements. These tweaks are however relatively minor when compared to the amount of work needed to define each and every keyword datatclass. If you want examples, take a look at batches 001, 002 and 003. They are/should be complete. So each of the keywords defined in them has a corresponding dataclass defined and all keywords have a TOML test definition file. If you need more information, let me know. |
Beta Was this translation helpful? Give feedback.
-
For those who are interested. I just committed an update of the Python interface. Still a lot of work to do, but there is progress. I have added the scaffolding for the engine keywords and significantly updated the code in I tried to use the OpenRadioss config file for the automatic generation of the Python definitions of a keyword, but I abandoned this path. So, unfortunately I am still implementing keywords by hand. If anyone wants to help, that would be highly appreciated. It is pretty straigtforward, but tedious. But if we distributed the load, the package can be completed in a couple of weeks (assuming that you can only spend a few hours a week). If anyone wants to give it a try, let me know. In any case, I will prepare a small manual with one or more examples on how to define a keyword and commit that to the repository. Oh, before I forget again, the repository is over here operato. One last comment. As mentioned in the README, I am also creating a C++ based converter for the animation (and probably time history) files. I have not committed the code yet, but I plan to do so somewhere in the next few weeks. This converter has a feature rich commandline interface so you can convert a whole series of animation files in one go. In addition reads the data into VTK datastructures and as such it can support all the export options provided by VTK. I will probably separate it out in a library part and a commandline interface part so if you want to you can integrate it in your own C++ code. |
Beta Was this translation helpful? Give feedback.
-
Just to keep you informed. I just committed an update. More keywords are supported (but still a lot to do) and I changed the way keywords are added to a The reason why I changed the interface is that in the old way, an editor with language server support (like Visual Studio Code or Vim) cannot figure out the type of keyword you are defining and therefore isn't very helpful when adding keywords. With the updated code, you get the documentation and type information of a keyword when typing. See the image below. If there are any requests, or comments, let me know. |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
Dear All,
I would like to check whether or not there is an interest in a Python package that supports generating starter/engine input files completely from within a Python script. I have started to work on it and I am pretty happy with what I have so far:
The syntax that is currently supported is something like the following:
Since it is a lot of tedious work to implement all the keywords, I would first like to check interest and maybe get some additional ideas/feature requests.
As an example how a particular keyword is implemented, take a look at the example for "/BEAM":
Some remarks:
pre_conditions
property can be used to enforce consistency checks on the input valuesstructure
property. This particular example states that the structure consists of a sequence of lines where each line consists of 4 integer fields.As mentioned above, every keyword has an associated test. This test is defined in a TOML file. For example, the test corresponding to the above "/BEAM" example is as follows:
So, each test (like
[default]
) has a corresponding set of parameters[default.params]
. These parameters are used to instantiate the corresponding class and from this instance you can get the text representation of the keyword. This text representation is compared to thevalue
defined in the TOML file.When run, it looks something like the following (all tests replace whitespace by an underscore):
The Python package will not replace a pre-processor, in particular when complex geometries are involved. However, I do believe it is a useful additional tool.
Some final remarks:
So, what are your thoughts?
Beta Was this translation helpful? Give feedback.
All reactions