diff --git a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui
index 9b4634878c..983afad5ac 100644
--- a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui
+++ b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui
@@ -17,7 +17,16 @@
6
-
+
+ 9
+
+
+ 9
+
+
+ 9
+
+
9
-
@@ -252,9 +261,9 @@
-
-
-
+
+
+
-
@@ -323,6 +332,25 @@
+ -
+
+
+ <html><head/><body><p>If checked, a human figure silhouette is displayed at the grid center. This option is only effective if the BIM workbench is installed and if "Show grid border" option is enabled.</p></body></html>
+
+
+ Show human figure
+
+
+ true
+
+
+ gridShowHuman
+
+
+ Mod/Draft
+
+
+
-
@@ -525,7 +553,7 @@
The color of the grid
-
+
50
50
@@ -572,7 +600,16 @@
-
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -618,22 +655,31 @@
5
+
+ 10
+
DraftEditMaxObjects
Mod/Draft
-
- 10
-
-
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
diff --git a/src/Mod/Draft/draftguitools/gui_trackers.py b/src/Mod/Draft/draftguitools/gui_trackers.py
index 2756a6786c..ae5ed9a563 100644
--- a/src/Mod/Draft/draftguitools/gui_trackers.py
+++ b/src/Mod/Draft/draftguitools/gui_trackers.py
@@ -1009,6 +1009,13 @@ class gridTracker(Tracker):
self.coords2 = coin.SoCoordinate3()
self.lines2 = coin.SoLineSet() # big squares
+ # human figure
+ mat_human = coin.SoMaterial()
+ mat_human.transparency.setValue(0.3*(1-gtrans))
+ mat_human.diffuseColor.setValue(col)
+ self.coords_human = coin.SoCoordinate3()
+ self.human = coin.SoLineSet()
+
# axes
mat3 = coin.SoMaterial()
mat3.transparency.setValue(gtrans)
@@ -1030,6 +1037,9 @@ class gridTracker(Tracker):
s.addChild(mat2)
s.addChild(self.coords2)
s.addChild(self.lines2)
+ s.addChild(mat_human)
+ s.addChild(self.coords_human)
+ s.addChild(self.human)
s.addChild(mbind3)
s.addChild(mat3)
s.addChild(self.coords3)
@@ -1105,17 +1115,6 @@ class gridTracker(Tracker):
self.text2.string = txt
self.textpos1.translation.setValue((-bound+self.space,-border+self.space,z))
self.textpos2.translation.setValue((-bound-self.space,-bound+self.space,z))
- # human from BIM workbench
- loc = FreeCAD.Vector(-bound+self.space/2,-bound+self.space/2,0)
- try:
- import BimProject
- hpts = BimProject.getHuman(loc)
- except Exception:
- # BIM not installed
- pass
- else:
- mpts.extend([tuple(p) for p in hpts])
- midx.append(len(hpts))
else:
self.text1.string = " "
self.text2.string = " "
@@ -1130,8 +1129,36 @@ class gridTracker(Tracker):
self.coords3.point.setValues(apts)
#self.lines3.numVertices.setValues(aidx)
self.pts = pts
+ self.displayHumanFigure()
self.setAxesColor()
+ def displayHumanFigure(self):
+ """ Display the human figure at the grid corner.
+ The silhouette is displayed only if:
+ - BIM Workbench is available;
+ - preference BaseApp/Preferences/Mod/Draft/gridShowHuman is True;
+ - the working plane normal is vertical.
+ """
+ numlines = self.numlines // self.mainlines // 2 * 2 * self.mainlines
+ bound = (numlines // 2) * self.space
+ pts = []
+ pidx = []
+ param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
+ if param.GetBool("gridShowHuman", True) and \
+ FreeCAD.DraftWorkingPlane.axis.getAngle(FreeCAD.Vector(0,0,1)) < 0.001:
+ try:
+ import BimProject
+ loc = FreeCAD.Vector(-bound+self.space/2,-bound+self.space/2,0)
+ hpts = BimProject.getHuman(loc)
+ pts.extend([tuple(p) for p in hpts])
+ pidx.append(len(hpts))
+ except Exception:
+ # BIM not installed
+ return
+ self.human.numVertices.deleteValues(0)
+ self.coords_human.point.setValues(pts)
+ self.human.numVertices.setValues(pidx)
+
def setAxesColor(self):
"""set axes color"""
cols = [0,0]
@@ -1180,6 +1207,7 @@ class gridTracker(Tracker):
P = FreeCAD.DraftWorkingPlane.position
self.trans.rotation.setValue([Q[0], Q[1], Q[2], Q[3]])
self.trans.translation.setValue([P.x, P.y, P.z])
+ self.displayHumanFigure()
self.setAxesColor()
self.on()