Skip to content

Commit

Permalink
Fixes for core
Browse files Browse the repository at this point in the history
  • Loading branch information
drlukeparry committed Dec 8, 2023
1 parent 99c7a47 commit e407d53
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pyslm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@ def getTrimeshSlice(self, z: float) -> trimesh.path.Path2D:
return planarSection

def getVectorSlice(self, z: float, returnCoordPaths: bool = True,
fixPolygons: bool = True,
simplificationFactor:float = None, simplificationPreserveTopology: Optional[bool] = True,
simplificationFactorMode:str = 'absolute') -> Any:
fixPolygons: Optional[bool] = True,
simplificationFactor: Optional[float] = None, simplificationPreserveTopology: Optional[bool] = True,
simplificationFactorMode: Optional[str] = 'absolute') -> Any:
"""
The vector slice is created by using `trimesh` to slice the mesh into a polygon
Expand Down Expand Up @@ -546,11 +546,12 @@ def getVectorSlice(self, z: float, returnCoordPaths: bool = True,
polygons = fixPolys

if returnCoordPaths:
return self.path2DToPathList(polygons)
return Part.path2DToPathList(polygons)
else:
return polygons

def path2DToPathList(self, shapes: List[Polygon]) -> List[np.ndarray]:
@staticmethod
def path2DToPathList(shapes: List[Polygon]) -> List[np.ndarray]:
"""
Returns the list of paths and coordinates from a cross-section (i.e. Trimesh Path2D). This is required to be
done for performing boolean operations and offsetting with the internal PyClipper package.
Expand Down Expand Up @@ -585,7 +586,7 @@ def getBitmapSlice(self, z: float, resolution: float, origin: Optional = None)

vectorSlice = self.getTrimeshSlice(z)

bitmapOrigin = self.boundingBox[:2] if origin is None else origin
bitmapOrigin = self.boundingBox[:2] if origin is None else origin

sliceImage = vectorSlice.rasterize(pitch=resolution, origin=bitmapOrigin)
return np.array(sliceImage)
Expand Down

0 comments on commit e407d53

Please sign in to comment.