Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pyslm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def getBitmapSlice(self, z: float, resolution: float, origin: Optional = None)
# Construct a merged grid for this layer (fixed layer)
gridSize = (self.geometry.extents[:2] / resolution) + 1 # Padded to prevent rounding issues

sliceImg = np.zeros(gridSize.astype(dtype=np.int), dtype=np.bool)
sliceImg = np.zeros(gridSize.astype(dtype=int), dtype=np.bool)

# ToDO for now assume an empty slice -> should be a None Type
if z < self.boundingBox[2] and z > self.boundingBox[4]:
Expand All @@ -608,15 +608,15 @@ def getBitmapSlice(self, z: float, resolution: float, origin: Optional = None)
polys = self.getVectorSlice(z)

gridSize = (self.geometry.extents[:2] / resolution) + 1 # Padded to prevent rounding issues
sliceImg = np.zeros(gridSize.astype(dtype=np.int), dtype=np.bool)
sliceImg = np.zeros(gridSize.astype(dtype=int), dtype=np.bool)

for poly in polys:
bounds = self._geometry.bounds
localOffset, grid, gridPoints = trimesh.path.raster.rasterize_polygon(poly, resolution)

startPos = np.floor((localOffset - bounds[0, :2]) / resolution).astype(np.int)
endPos = (startPos + grid.shape).astype(np.int)
startPos = np.floor((localOffset - bounds[0, :2]) / resolution).astype(int)
endPos = (startPos + grid.shape).astype(int)

sliceImg[startPos[0]:endPos[0], startPos[1]:endPos[1]] += grid

return sliceImg
return sliceImg
4 changes: 2 additions & 2 deletions pyslm/hatching/hatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def getExposurePoints(layer: Layer, models: List[Model], includePowerDeposited:
dir = -1.0 * delta / lineDist

# Calculate the number of exposure points across the hatch vector based on its length
numPoints = np.ceil(lineDist / pointDistance).astype(np.int)
numPoints = np.ceil(lineDist / pointDistance).astype(int)

# Pre-populate some arrays to extrapolate the exposure points from
totalPoints = int(np.sum(numPoints))
Expand Down Expand Up @@ -102,7 +102,7 @@ def getExposurePoints(layer: Layer, models: List[Model], includePowerDeposited:
dir = 1.0 * delta / lineDist

# Calculate the number of exposure points across the hatch vector based on its length
numPoints = np.ceil(lineDist / pointDistance).astype(np.int)
numPoints = np.ceil(lineDist / pointDistance).astype(int)

# Pre-populate some arrays to extrapolate the exposure points from
totalPoints = int(np.sum(numPoints))
Expand Down
4 changes: 2 additions & 2 deletions pyslm/visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,10 @@ def plotHeatMap(part: Part, z: float, exposurePoints: np.ndarray, resolution: fl

# Offset the coordinates based on the resolution and the bounding box of the part
exposurePoints[:, :2] -= part.boundingBox[:2] + resolution / 2
expPointTrans = np.floor(exposurePoints[:, :2] / resolution).astype(np.int)
expPointTrans = np.floor(exposurePoints[:, :2] / resolution).astype(int)

# Get a bitmap object to work on
bitmapSlice = part.getBitmapSlice(z, resolution).astype(np.int)
bitmapSlice = part.getBitmapSlice(z, resolution).astype(int)
slice = np.zeros(bitmapSlice.shape)

for i in range(len(expPointTrans)):
Expand Down