Skip to content

Commit

Permalink
suppress coloring of faces in headless mode
Browse files Browse the repository at this point in the history
to prevent problems with the IGES export
  • Loading branch information
jreinhardt committed Apr 24, 2014
1 parent 4835cc0 commit 107d5e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions freecad/hex/hex.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@
from Part import makeBox
import Part
import math
import FreeCADGui

thread_color = (0.5,1.,5.,0.)

def runs_headless():
return 'setupWithoutGUI' in FreeCADGui.__dict__

def color_face(part,n):
if runs_headless():
return
color = part.ViewObject.DiffuseColor[0]
n_faces = len(part.Shape.Faces)
part.ViewObject.DiffuseColor = [color if i != n else thread_color for i in range(n_faces)]
Expand Down
6 changes: 6 additions & 0 deletions freecad/nut/nut.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@
from Part import makeBox
import Part
import math
import FreeCADGui

thread_color = (0.5,1.,5.,0.)

def runs_headless():
return 'setupWithoutGUI' in FreeCADGui.__dict__

def color_face(part,n):
if runs_headless():
return
color = part.ViewObject.DiffuseColor[0]
n_faces = len(part.Shape.Faces)
part.ViewObject.DiffuseColor = [color if i != n else thread_color for i in range(n_faces)]
Expand Down

0 comments on commit 107d5e3

Please sign in to comment.