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!
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Post by damian »

yorik wrote: Mon Jul 23, 2018 5:05 pm Or simply copy it over together with the .py files...
better
EDIT: I have the file together with the .py files,
/home/damian/freecad/src/Mod/Material/MatPropDict.xml
but this file is not built and installed
damian@damian-Aspire:~/freecad-build/Mod/Material$ dir
importFCMat.py MaterialEditor.py Material_rc.py
importFCMat.pyc MaterialEditor.pyc materials-editor.ui
InitGui.py Material.py
Init.py Material.pyc
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: material editor

Post by yorik »

did you add it to the cmake file together with the py files? That should be all that is needed...
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Post by damian »

I see it
This weekend I'll do a second commit. I'll fix other minor questions: I've lost doc and some grosses.
Guys! this is the week to demand, not the next week
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 Jul 24, 2018 12:27 am did you add it to the cmake file together with the py files? That should be all that is needed...
https://github.com/FreeCAD/FreeCAD/blob ... txt#L5-L13
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Post by damian »

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

Re: material editor

Post by damian »

Good morning:

I've done a second commit with:

- installation of MatPropDict.xml
- fixes
- recovering doc

https://github.com/caceres/FreeCAD/comm ... 1f6de9e411

The result is more or less convenient, but I see one problem:

when a user is playing with the MaterialEditor and edit a property which is not a QLineEdit, later the property remains with the default value which can not be eliminated by the user. For instance the Gui::PrefColorButton (with a default grey) or Gui::PrefDoubleSpinBox (with a default cero)
MaterialEditor.png
MaterialEditor.png (103.46 KiB) Viewed 16133 times
I'm thinking about the third commit with a new button 'Delete value'

Besides, I'm thinking that the line edit to add and remove custom properties must disappear, facilitating a popup dialog where the user could edit its custom property with Name, Type, Unit, etc. But I understand that this modification requires to improve FreeCAD material format. To me, the ini-file format isn't enough to store a really user custom property. I propose to expand the card format to xml, maintaining the ability to read a write config file.

Thank everyone

EDIT: the button 'Delete property' could make the function of 'Delete value'. Less stuff

EDIT:
yorik wrote: ↑
Mon Jun 11, 2018 3:36 pm
That is easy for the "fixed" properties (we know their type), but when the user adds custom properties, I'm not sure. Ideally there should be a way to specify the property type. Maybe we need one more column that says the type?
For me with the above-mentioned popup dialog, and maintaining hidden the columns of Type, Unit, etc
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: material editor

Post by yorik »

damian wrote: Thu Jul 26, 2018 11:41 amwhen a user is playing with the MaterialEditor and edit a property which is not a QLineEdit, later the property remains with the default value which can not be eliminated by the user. For instance the Gui::PrefColorButton (with a default grey) or Gui::PrefDoubleSpinBox (with a default cero)
Probably the very, very ideal way would be to sublass the QColorDialog (or any other...) and add a new "Remove value" button. But that's a lot of work just for something cosmetic, probably it's indeed best to simply add a "Delete value" button somewhere.
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Post by damian »

Good evening:

From the first day, I've been suffering sporadically segmentation faults.
Today I've been investigating the issue and I can reproduce it frequently, more frequent than I would like.
The fault comes randomly with the change of card in the combobox, and sometimes opening or closing the editor. The main problem is in the first steps, with the model implementation. The QStyledItemDelegate and the Widgets aren't the problems.
I've been testing different compositions, beginning with the original code with the minimum modifications, and always the same result in the first stages (loading model).
I need a width recess. The code is in github, and presumably complete but buggy.

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

Re: material editor

Post by damian »

okay! Two different problems:

FIRST
Buttons cancel y okay: I can't reproduce the segmentation fault with pyside2. Then nothing to do.

SECOND
change of card in the combo material: a new composition of the method updateContents, avoiding the statement model.clear(), solves the problem

I'm finishing!!!
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: material editor

Post by yorik »

The crash is probably due to the expat bug on debian-based systems. Everything that uses xml in python crashes. But @kkremitzki is working on this I think... I propose to postpone to merge your PR until we know a bit more from him because otherwise it will make the mat editor unusable for a large portion of users...
Post Reply