View Issue Details

IDProjectCategoryView StatusLast Update
0003199FreeCADFeaturepublic2019-01-16 14:12
Reportersherif Assigned Towmayer  
Status closedResolutionfixed 
Product Version0.17 
Target Version0.18Fixed in Version0.18 
Summary0003199: It is impossible to get to the ShapeMaterial field without gui
Im using FreeCad as a library for a file conversion program
Ie calling from FreeCAD import Base load my input file (usually step) and then write my output format.
Recently I wanted to access the ShapeMaterial variable, which is located in the ViewObject field.

The problem is that the view object is not initialized if there is no gui.
This makes sense but in this case The ShapeMaterial is not an attribute of the ViewObject and should not be stored there.

Can you please provide a workaround ? or how can I get the material without FreeCADGui.showMainWindow() and ImportGui.insert

Steps To Reproduce
from FreeCAD import Base
Additional InformationOS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10101 (Git)
Build type: Unknown
Branch: master
Hash: 99fa203f323927b0dd027420d4421b577b7420c3
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

Tags#lowhangingfruit, headless, python
FreeCAD Information



2017-09-27 17:03

administrator   ~0010202

Please open a thread on the forum and then link bi-directionally thread <=> ticket


2017-09-28 08:38

reporter   ~0010206


2019-01-16 14:11

administrator   ~0012439

The function has been reworked (for several months now) to return a dict of Part feature and list of colors. So you can write:
print (data)
The output can be e.g.:

[(<Part::PartFeature>, [(0.0, 0.3333333432674408, 0.0, 0.0), (0.800000011920929, 0.800000011920929, 0.800000011920929, 0.0), (0.800000011920929, 0.800000011920929, 0.800000011920929, 0.0)])]


Issue History

Date Modified Username Field Change
2017-09-27 15:59 sherif New Issue
2017-09-27 17:03 Kunda1 Tag Attached: #post-to-forum
2017-09-27 17:03 Kunda1 Note Added: 0010202
2017-09-27 17:04 Kunda1 Steps to Reproduce Updated
2017-09-27 17:04 Kunda1 Additional Information Updated
2017-09-27 17:04 Kunda1 Tag Attached: python
2017-09-27 17:04 Kunda1 Tag Attached: headless
2017-09-28 08:38 sherif Note Added: 0010206
2017-10-09 14:29 Kunda1 Tag Detached: #post-to-forum
2017-10-19 12:39 Kunda1 Tag Attached: #lowhangingfruit
2017-10-19 17:45 wmayer Category Bug => Feature
2018-02-13 02:47 Kunda1 Target Version => 0.18
2019-01-16 14:11 wmayer Note Added: 0012439
2019-01-16 14:12 wmayer Assigned To => wmayer
2019-01-16 14:12 wmayer Status new => closed
2019-01-16 14:12 wmayer Resolution open => fixed
2019-01-16 14:12 wmayer Fixed in Version => 0.18