material editor

A forum to discuss the implementation of a good Materials system in FreeCAD
User avatar
bernd
Posts: 8438
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

material editor

Postby bernd » Sat May 26, 2018 8:07 pm

how do I start MaterialEditor from Python konsole?
User avatar
yorik
Site Admin
Posts: 11552
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: material editor

Postby yorik » Sat May 26, 2018 8:58 pm

Code: Select all

import MaterialEditor
MaterialEditor.openEditor()
or

Code: Select all

mat = MaterialEditor.editMaterial(myMaterialDictionary)
to directly edit an existing material
User avatar
bernd
Posts: 8438
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: material editor

Postby bernd » Sun May 27, 2018 7:46 am

:)
User avatar
bernd
Posts: 8438
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: material editor

Postby bernd » Mon May 28, 2018 4:54 am

just realized, whereas:
yorik wrote:
Sat May 26, 2018 8:58 pm

Code: Select all

import MaterialEditor
mat = MaterialEditor.editMaterial(myMaterialDictionary)
works great


but
yorik wrote:
Sat May 26, 2018 8:58 pm

Code: Select all

import MaterialEditor
MaterialEditor.openEditor()
does only open the editor, but none of the buttons works. Even ok or cancel do not work at all on

OS: Debian GNU/Linux 9.4 (stretch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13805 (Git)
Build type: Debug
Branch: master
Hash: 468946bcde23e7e1e39714b2c5a7e786108fb5ba
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
Locale: German/Switzerland (de_CH)
User avatar
yorik
Site Admin
Posts: 11552
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: material editor

Postby yorik » Tue May 29, 2018 6:22 pm

hm I'll have a look... There is a long time I didn't use it.
User avatar
bernd
Posts: 8438
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: material editor

Postby bernd » Wed May 30, 2018 6:19 am

yorik wrote:
Tue May 29, 2018 6:22 pm
hm I'll have a look... There is a long time I didn't use it.
great! Found another one. The save as does not work at all, no matter how the material editor was started.

BTW: In FEM we gone use an own task panel to edit all material parameter. I'm on the way to switch to the material editor for this. I tried to fix the above problems, but have no glue what's going wrong ... Once the material editor is fixed I may try to improve it a bit in the regard of keeping track of the right unit while editing a property. We have this in our material task panel. If this works in material editor we gone switch to material editor in FEM completely. Than we only need to implement the new stuff of einvind only once in the material editor if it is in master. How does that sounds?
User avatar
yorik
Site Admin
Posts: 11552
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: material editor

Postby yorik » Wed May 30, 2018 2:32 pm

bernd wrote:
Wed May 30, 2018 6:19 am
The save as does not work at all, no matter how the material editor was started.
It is working for me here apparently... Any error message? Some non-ascii/encoding problem maybe?

My plans for the material editor, regardless of Eivind's project (it only affects mat cards, so it should stay compatible):

- replace the material choosing combo box by a button that would open a more complex dialog to choose existing materials, either from cards or from a material already existing in the document. This will allow to use a tree widget and sort the materials by Father (steels, plastics, etc...)

- add SVG graphics at the top, that display a preview of the material

- implement a QStyledItemDelegate for the material editor, that would allow to use the FreeCAD unit widget in fields that expect a unit (and perform other checks if needed)

In Arch I'm still using a "simplified" UI when adding/editing materials (there is a button to open the full-dledged material editor too), I'm wondering if I want to keep that or not...
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Postby damian » Wed May 30, 2018 6:26 pm

yorik wrote:
Wed May 30, 2018 2:32 pm
- implement a QStyledItemDelegate for the material editor, that would allow to use the FreeCAD unit widget in fields that expect a unit (and perform other checks if needed)
I've got in my agenda, of June, a very similar question. I would like to learn about this ...
yorik wrote:
Wed May 30, 2018 2:32 pm
I'm wondering if I want to keep that or not...
I'll see it. There always is something reusable ..., especially the structure or general idea
User avatar
bernd
Posts: 8438
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: material editor

Postby bernd » Wed May 30, 2018 6:45 pm

double checked ...

Code: Select all

import MaterialEditor
MaterialEditor.openEditor()
the material editor opens. press open nothing happens, press ok nothing happens ... tested on a Debian Stretch in brand new virtual box same issue. No error, no warning. Tried

Code: Select all

LC_ALL=C   ./bin/FreeCAD
same problems ...

I can close the windwo by click on the cross in upper right corner of the widget only. Does it really work for you? Are you on Py3 and Qt5? I'm still on py2.7 and Qt4.8.7.

bernd
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Postby damian » Wed May 30, 2018 7:00 pm

bernd wrote:
Wed May 30, 2018 6:45 pm
Does it really work for you?
For me, no!
I suppose it must be revisited from the first line


OS: Ubuntu 16.04.4 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13826 (Git)
Build type: None
Branch: master
Hash: 3b02ff2a9481f0883063c7e24c312978ef0ce642
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)