Browse Source

Add minor grid lines

Makes it feel very professional and technical.

Contributes to issue CURA-4150.
Ghostkeeper 7 years ago
parent
commit
38e907b3ae
2 changed files with 21 additions and 0 deletions
  1. 20 0
      cura/BuildVolume.py
  2. 1 0
      resources/themes/cura/theme.json

+ 20 - 0
cura/BuildVolume.py

@@ -45,6 +45,7 @@ class BuildVolume(SceneNode):
         self._disallowed_area_color = None
         self._error_area_color = None
         self._grid_color = None
+        self._grid_minor_color = None
 
         self._width = 0
         self._height = 0
@@ -250,6 +251,7 @@ class BuildVolume(SceneNode):
             self._disallowed_area_color = Color(*theme.getColor("disallowed_area").getRgb())
             self._error_area_color = Color(*theme.getColor("error_area").getRgb())
             self._grid_color = Color(*theme.getColor("buildplate_grid").getRgb())
+            self._grid_minor_color = Color(*theme.getColor("buildplate_grid_minor").getRgb())
 
         min_w = -self._width / 2
         max_w = self._width / 2
@@ -306,6 +308,24 @@ class BuildVolume(SceneNode):
             for y in range(0, int(math.floor(min_d)), -major_grid_size):
                 mb.addLine(Vector(min_w, min_h, y), Vector(max_w, min_h, y), color = self._grid_color)
 
+            minor_grid_size = 1
+            for x in range(0, int(math.ceil(max_w)), minor_grid_size):
+                if x % major_grid_size == 0: #Don't overlap with the major grid.
+                    pass
+                mb.addLine(Vector(x, min_h, min_d), Vector(x, min_h, max_d), color = self._grid_minor_color)
+            for x in range(0, int(math.floor(min_w)), -minor_grid_size):
+                if x % major_grid_size == 0:
+                    pass
+                mb.addLine(Vector(x, min_h, min_d), Vector(x, min_h, max_d), color = self._grid_minor_color)
+            for y in range(0, int(math.ceil(max_d)), minor_grid_size):
+                if y % major_grid_size == 0:
+                    pass
+                mb.addLine(Vector(min_w, min_h, y), Vector(max_w, min_h, y), color = self._grid_minor_color)
+            for y in range(0, int(math.floor(min_d)), -minor_grid_size):
+                if y % major_grid_size == 0:
+                    pass
+                mb.addLine(Vector(min_w, min_h, y), Vector(max_w, min_h, y), color = self._grid_minor_color)
+
             self._grid_mesh = mb.build()
 
         else:

+ 1 - 0
resources/themes/cura/theme.json

@@ -222,6 +222,7 @@
         "buildplate": [244, 244, 244, 255],
         "buildplate_alt": [204, 204, 204, 255],
         "buildplate_grid": [129, 131, 134, 255],
+        "buildplate_grid_minor": [129, 131, 134, 31],
 
         "convex_hull": [35, 35, 35, 127],
         "disallowed_area": [0, 0, 0, 40],