material editor

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

Re: material editor

Postby bernd » Wed May 30, 2018 7:53 pm

test on 0.17 on win

Code: Select all

import MaterialEditor
MaterialEditor.openEditor()
the material editor opens. press open nothing happens, press ok nothing happens ...

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13510 +12 (Git)
Build type: Release
Branch:
Hash: 3bb5ff4e70c0c526f2d9dd69b1004155b2f527f2
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Switzerland (de_CH)
User avatar
bernd
Posts: 8468
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: material editor

Postby bernd » Wed May 30, 2018 7:54 pm

test on 0.18 on win

Code: Select all

import MaterialEditor
MaterialEditor.openEditor()
the material editor opens. press open nothing happens, press ok nothing happens ...

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13826 (Git)
Build type: Release
Branch: master
Hash: 3b02ff2a9481f0883063c7e24c312978ef0ce642
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Switzerland (de_CH)
[/quote]
User avatar
bernd
Posts: 8468
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: material editor

Postby bernd » Wed May 30, 2018 8:23 pm

https://github.com/berndhahnebach/FreeC ... diff=split but exec_ blocks FreeCAD while the mat editor runs.

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

Re: material editor

Postby bernd » Fri Jun 01, 2018 6:30 am

User avatar
yorik
Site Admin
Posts: 11574
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: material editor

Postby yorik » Fri Jun 01, 2018 2:30 pm

Ah indeed there were a lot of fixes needed :D thanks!
User avatar
yorik
Site Admin
Posts: 11574
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: material editor

Postby yorik » Fri Jun 01, 2018 2:34 pm

damian wrote:
Wed May 30, 2018 6:26 pm
I've got in my agenda, of June, a very similar question. I would like to learn about this ...
I recenly did that here if you want an example: https://github.com/yorikvanhavre/BIM_Wo ... lements.py

Basically you need to use a QTreeView instead of a QTreeWidget, and make a model yourself, which is the "entity" whick keeps/organizes the data of a tree widget, and give it a custom QStyledItemDelegate which handles the actions when you want to edit an item of the tree
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Postby damian » Sat Jun 02, 2018 6:46 am

from this ugly 'text box'
material_editor.png
material_editor.png (66.99 KiB) Viewed 469 times
to a nice widget
ifc.png
ifc.png (38.04 KiB) Viewed 469 times
okey
Jee-Bee
Posts: 1966
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: material editor

Postby Jee-Bee » Sat Jun 02, 2018 6:57 am

A note based on above figure. Poisson ratio is a mechanical property. Could that move??
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Postby damian » Sat Jun 02, 2018 7:05 am

yorik wrote:
Fri Jun 01, 2018 2:34 pm
to use a QTreeView instead of a QTreeWidget
is there any inconvenient in to use QTreeWidget with setItemWidget()?
Edit:
https://stackoverflow.com/questions/278 ... treewidget
But the Model/View approach is more general and flexible IMO. You can create your own subclasses of model and view which enables you to do whatever you like.
okey
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: material editor

Postby damian » Sat Jun 02, 2018 10:53 am

Off topic:

I'm seeing the mechanism
Gui::InputField
but I see it exclusively with ui files

If I do it from python, only pySide no ui file,

Code: Select all

ui = FreeCADGui.UiLoader()
widget = ui.createWidget("Gui::InputField")
widget.
Could have I got the unit parser system working in my widget (exclusively with pySide, no ui)?
Is mandatory the ui file for this?
Are there more options than Gui::InputField and Gui::QuantitySpinBox?