Skip to content

Commit

Permalink
Bug Fix: Added contour offset property
Browse files Browse the repository at this point in the history
Property can be set rather than using the default initialised value. The order the offset is applied has been corrected too.
  • Loading branch information
drlukeparry committed Apr 19, 2021
1 parent 03634bd commit 8b37f5a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pyslm/hatching/hatching.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import abc
import time
from typing import Any, List, Optional, Tuple, Union
import logging

import numpy as np

Expand Down Expand Up @@ -808,6 +809,17 @@ def spotCompensation(self) -> float:
def spotCompensation(self, value: float):
self._spotCompensation = value

@property
def contourOffset(self) -> float:
"""
The contour offset is the distance between the contour or border scans
"""
return self._contourOffset

@contourOffset.setter
def contourOffset(self, offset: float):
self._contourOffset = offset

@property
def volumeOffsetHatch(self) -> float:
"""
Expand All @@ -833,7 +845,7 @@ def hatch(self, boundaryFeature) -> Union[Layer, None]:
layer = Layer(0, 0)
# First generate a boundary with the spot compensation applied

offsetDelta = 0.0
offsetDelta = 1e-6
offsetDelta -= self._spotCompensation

# Store all contour layer geometries to before adding at the end of each layer
Expand All @@ -853,7 +865,6 @@ def hatch(self, boundaryFeature) -> Union[Layer, None]:

# Repeat for inner contours
for i in range(self._numInnerContours):

offsetDelta -= self._contourOffset
offsetBoundary = self.offsetBoundary(boundaryFeature, offsetDelta)

Expand All @@ -864,9 +875,9 @@ def hatch(self, boundaryFeature) -> Union[Layer, None]:
contourGeometry.subType = "inner"
contourLayerGeometries.append(contourGeometry) # Append to the layer

# The final offset is applied to the boundary

offsetDelta -= self._volOffsetHatch
# The final offset is applied to the boundary if there has been existing contour offsets applied
if self._numInnerContours + self._numOuterContours > 0:
offsetDelta -= self._volOffsetHatch

curBoundary = self.offsetBoundary(boundaryFeature, offsetDelta)

Expand Down

0 comments on commit 8b37f5a

Please sign in to comment.