collection of material issues

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: collection of material issues

Post by bernd »

uwestoehr wrote: Mon Mar 22, 2021 12:45 am Here is the material card file I try to load: Graphite.txt
- download the file
- start FreeCAD
-adapt the code to your location
- run the code

Code: Select all

f = open("C:/Users/BHA/Desktop/Graphite.txt", encoding="utf8")
for line in f:
    print(line)

Code: Select all

>>> 
>>> f = open("C:/Users/BHA/Desktop/Graphite.txt", encoding="utf8")
>>> for line in f:
...     print(line)
... 
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\0_BHA_privat\progr\FreeCAD_0.19.xxxxx_Py3Qt5\bin\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 20: invalid start byte
>>> 
AFAIKS the problem ist just the file is no utf-8 but ANSI instead.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: collection of material issues

Post by uwestoehr »

bernd wrote: Mon Mar 22, 2021 4:47 pm AFAIKS the problem is just the file is no utf-8 but ANSI instead.
Yes. But I created the file using the material card editor and then saved it from there. So there is something wrong in the material editor or the saving routine.
You can reproduce this by creating a new card and using e.g. the text "Björn Überbächle" as author. Save this card, then load this card in a new material.

Besides this, we have another encoding bug: existing material cards like e.g. the PET-generic and when I load this, I see in the author field not the name that is actually in the card.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: collection of material issues

Post by bernd »

uwestoehr wrote: Mon Mar 22, 2021 6:58 pm ... But I created the file using the material card editor and then saved it from there. So there is something wrong in the material editor or the saving routine ...
confirmed


screen.png
screen.png (66.14 KiB) Viewed 2594 times
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: collection of material issues

Post by uwestoehr »

For information, other users start to suffer from the Unicode issue in material cards as well:
https://forum.freecadweb.org/viewtopic.php?f=3&t=58892
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: collection of material issues

Post by bernd »

only happens on windows for me and only happens if there are special character. If there is no special character the file is saved on Windows with UTF-8 as well.

On Linux the mat card is saved with UTF-8 in any case. I will try to have a look ...
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: collection of material issues

Post by bernd »

User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: collection of material issues

Post by uwestoehr »

bernd wrote: Tue Jul 13, 2021 3:57 pm git commit 9a564dd906f
Many thanks for having a look. I took today's master and recompiled.

The problem persists:

- open the material card editor
- input as card name "Östrogen"
- input as Author And License "Björn Überbächle"
- save the material card as Östrogen.FCMat

Here is the result I get:
Östrogen.zip
zipped FCMat file
(461 Bytes) Downloaded 50 times

Now create a new simulation, add there a material and use the material editor to load the just created material card.

result: the author is lost:
FreeCAD_sklaklNZs1.png
FreeCAD_sklaklNZs1.png (21.3 KiB) Viewed 2212 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: collection of material issues

Post by bernd »

damn I added a regression ...

- start FreeCAD
- switch to FEM
- start the material editor (icon with 3 yellow balls)
- choose whatever material from existent cards
- no property at all is shown ... :o
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: collection of material issues

Post by bernd »

User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: collection of material issues

Post by uwestoehr »

bernd wrote: Wed Jul 14, 2021 2:09 pm git commit cfcf8df4cee1
many thanks! This fixed 2 issues. :D

I updated the list of known material card bugs:
https://forum.freecadweb.org/viewtopic. ... 66#p489666

If you could have a look at bug 8 and 9, that would be very kind. ;)
Post Reply