material editor

A forum to discuss the implementation of a good Materials system in FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

material editor

Post by bernd »

how do I start MaterialEditor from Python konsole?
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: material editor

Post by yorik »

Code: Select all

import MaterialEditor
MaterialEditor.openEditor()
or

Code: Select all

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

Re: material editor

Post by bernd »

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

Re: material editor

Post by bernd »

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
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: material editor

Post by yorik »

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

Re: material editor

Post by bernd »

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
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: material editor

Post by yorik »

bernd wrote: Wed May 30, 2018 6:19 amThe 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

Post by damian »

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
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: material editor

Post by bernd »

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

Post by damian »

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)
Post Reply