Obsoleting material handling bash scripts with python
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Obsoleting material handling bash scripts with python
bernd, can you point to the code you mentioned in PR [1]? I want to see what was your idea. I think about yaml format for the material cards, csv/ods for mass editing. But you're the one to make the final decision
[1] https://github.com/FreeCAD/FreeCAD/pull/1983
[1] https://github.com/FreeCAD/FreeCAD/pull/1983
Re: Obsoleting material handling bash scripts with python
me too https://github.com/berndhahnebach/FreeC ... aterialdev but still far from finished ...
and Yorik for sure.
Re: Obsoleting material handling bash scripts with python
in conjuction with these methods https://github.com/FreeCAD/FreeCAD/comm ... 4548e0de3e merged in master already you can write all cards to yaml ...
Re: Obsoleting material handling bash scripts with python
I am curious about your opinion ... but as mentioned it is far from finished. The commit "dev" is more a proof of concept.
Re: Obsoleting material handling bash scripts with python
Tested & (mostly) works. The yaml format looks better than plain "config" type file. Side effect for me: vim is highlighting yaml nicely
It probably makes sense to wait for python3 because of uft8 to avoid this:
Also yaml.load might be replaced with safe_load (paranoid safety mode ).
What's the plan for mass editing? csv/odt or a separate editor?
[1] https://pyyaml.org/wiki/PyYAMLDocumentation
It probably makes sense to wait for python3 because of uft8 to avoid this:
Code: Select all
UltimateTensileStrength: !!python/unicode '38.8 MPa'
What's the plan for mass editing? csv/odt or a separate editor?
[1] https://pyyaml.org/wiki/PyYAMLDocumentation
Re: Obsoleting material handling bash scripts with python
is there a way to handle the Py2 Py3 str unicode problems not inside the yaml file but inside the code instead? We should use "clean" material card files.
Re: Obsoleting material handling bash scripts with python
I don;t know. I tried allow_unicode option, but no luck. I think that one of the big changes between python2 i 3 is string handling. I see strange things
I'll try to play around with the yaml module to get consistent utf-8 encoding for python2 and 3.
Edit: Looks promising: https://stackoverflow.com/questions/289 ... de-objects
Edit2: Another one https://stackoverflow.com/questions/396 ... aml-output
I think it can be done...
Code: Select all
- General:
Description: !!python/unicode 'Generic soda-lime glass'
DescriptionDE: !!python/unicode 'Normalglas'
DescriptionPL: Szkło sodowe <-- Polish ł but no !python/unicode
Father: !!python/unicode 'Glass'
Name: !!python/unicode 'Glass'
Edit: Looks promising: https://stackoverflow.com/questions/289 ... de-objects
Edit2: Another one https://stackoverflow.com/questions/396 ... aml-output
I think it can be done...
Re: Obsoleting material handling bash scripts with python
great I take a look too.
At least you and my origin language are perfectly made for testing äöüß ... damn no polish keyboard on my mobil ...
At least you and my origin language are perfectly made for testing äöüß ... damn no polish keyboard on my mobil ...
Re: Obsoleting material handling bash scripts with python
zażółcić gęślą jaźń - that's a typical test. "Make ego/self yellow using gustle" is the meaning
OK, so the plan is to have all FCMat files in utf-8, but no !!python/unicode marker. Both python2 and 3 must work. If we can make it, the code could be included in the master immediately, maybe with a comment "to be enabled in v0.19"?
Edit: I'm reading the material reader/writer code in the master branch and the first idea that came to my brain is: do not touch it, start from scratch, make a new module and once it works switch over
OK, so the plan is to have all FCMat files in utf-8, but no !!python/unicode marker. Both python2 and 3 must work. If we can make it, the code could be included in the master immediately, maybe with a comment "to be enabled in v0.19"?
Edit: I'm reading the material reader/writer code in the master branch and the first idea that came to my brain is: do not touch it, start from scratch, make a new module and once it works switch over
Re: Obsoleting material handling bash scripts with python
sounds like a plan! I would not start from scratch, but on top of this commit https://github.com/berndhahnebach/FreeC ... b6271967c8