Skip to content

Commit 107d5e3

Browse files
committed
suppress coloring of faces in headless mode
to prevent problems with the IGES export
1 parent 4835cc0 commit 107d5e3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

freecad/hex/hex.py

+6
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@
1919
from Part import makeBox
2020
import Part
2121
import math
22+
import FreeCADGui
2223

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

26+
def runs_headless():
27+
return 'setupWithoutGUI' in FreeCADGui.__dict__
28+
2529
def color_face(part,n):
30+
if runs_headless():
31+
return
2632
color = part.ViewObject.DiffuseColor[0]
2733
n_faces = len(part.Shape.Faces)
2834
part.ViewObject.DiffuseColor = [color if i != n else thread_color for i in range(n_faces)]

freecad/nut/nut.py

+6
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@
1919
from Part import makeBox
2020
import Part
2121
import math
22+
import FreeCADGui
2223

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

26+
def runs_headless():
27+
return 'setupWithoutGUI' in FreeCADGui.__dict__
28+
2529
def color_face(part,n):
30+
if runs_headless():
31+
return
2632
color = part.ViewObject.DiffuseColor[0]
2733
n_faces = len(part.Shape.Faces)
2834
part.ViewObject.DiffuseColor = [color if i != n else thread_color for i in range(n_faces)]

0 commit comments

Comments
 (0)