Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2017-08-21 10:24:31 +0300
committerGhostkeeper <rubend@tutanota.com>2017-08-21 10:24:31 +0300
commite7c585469494e22671046fb57ffd52d8aa4262de (patch)
treedf7cfa85335e2a5135bcd8d400f9a508bc607b19 /cura/BuildVolume.py
parent585b6ad8ebcf8933571f2fe6d4d5abe864df826f (diff)
Make grid size into global variables
It doesn't need to be a preference, but it should be easy to modify in the code. Contributes to issue CURA-4150.
Diffstat (limited to 'cura/BuildVolume.py')
-rwxr-xr-xcura/BuildVolume.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py
index 2076c59935..1530346967 100755
--- a/cura/BuildVolume.py
+++ b/cura/BuildVolume.py
@@ -27,8 +27,9 @@ import math
from typing import List
-# Setting for clearance around the prime
-PRIME_CLEARANCE = 6.5
+PRIME_CLEARANCE = 6.5 #Setting for clearance around the prime.
+MAJOR_GRID_SIZE = 10 #Size of the grid cells.
+MINOR_GRID_SIZE = 1
## Build volume is a special kind of node that is responsible for rendering the printable area & disallowed areas.
@@ -297,33 +298,31 @@ class BuildVolume(SceneNode):
self._plate_mesh = mb.build()
#Build plate grid mesh.
- major_grid_size = 10 #In millimetres.
mb = MeshBuilder()
- for x in range(0, int(math.ceil(max_w)), major_grid_size):
+ for x in range(0, int(math.ceil(max_w)), MAJOR_GRID_SIZE):
mb.addLine(Vector(x, min_h, min_d), Vector(x, min_h, max_d), color = self._grid_color)
- for x in range(0, int(math.floor(min_w)), -major_grid_size): #Start from 0 in both cases, so you need to do this in two for loops.
+ for x in range(0, int(math.floor(min_w)), -MAJOR_GRID_SIZE): #Start from 0 in both cases, so you need to do this in two for loops.
mb.addLine(Vector(x, min_h, min_d), Vector(x, min_h, max_d), color = self._grid_color)
- for y in range(0, int(math.ceil(max_d)), major_grid_size):
+ for y in range(0, int(math.ceil(max_d)), MAJOR_GRID_SIZE):
mb.addLine(Vector(min_w, min_h, y), Vector(max_w, min_h, y), color = self._grid_color)
- for y in range(0, int(math.floor(min_d)), -major_grid_size):
+ 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)
#More fine grained grid.
- 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.
+ 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:
+ 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:
+ 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:
+ 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)