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!
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 »

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

Re: material editor

Post by bernd »

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

Re: material editor

Post by bernd »

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

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

Re: material editor

Post by yorik »

Ah indeed there were a lot of fixes needed :D thanks!
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: 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

Post by damian »

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

Re: material editor

Post by Jee-Bee »

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

Post by damian »

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

Post by damian »

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