kopia lustrzana https://github.com/vilemduha/blendercam
prepare crosshatch for parallel pocket
rodzic
1017149377
commit
cd2e65623f
|
@ -46,7 +46,6 @@ def generate_crosshatch(context, angle, distance, offset, pocket_shape):
|
||||||
Returns:
|
Returns:
|
||||||
shapely.geometry.MultiLineString: The resulting intersection geometry of the crosshatch.
|
shapely.geometry.MultiLineString: The resulting intersection geometry of the crosshatch.
|
||||||
"""
|
"""
|
||||||
simple.remove_multiple("crosshatch")
|
|
||||||
ob = context.active_object
|
ob = context.active_object
|
||||||
ob.select_set(True)
|
ob.select_set(True)
|
||||||
|
|
||||||
|
@ -103,6 +102,7 @@ def generate_crosshatch(context, angle, distance, offset, pocket_shape):
|
||||||
|
|
||||||
# Return the intersection result
|
# Return the intersection result
|
||||||
return xing
|
return xing
|
||||||
|
|
||||||
class CamCurveHatch(Operator):
|
class CamCurveHatch(Operator):
|
||||||
"""Perform Hatch Operation on Single or Multiple Curves""" # by Alain Pelletier September 2021
|
"""Perform Hatch Operation on Single or Multiple Curves""" # by Alain Pelletier September 2021
|
||||||
bl_idname = "object.curve_hatch"
|
bl_idname = "object.curve_hatch"
|
||||||
|
@ -122,6 +122,12 @@ class CamCurveHatch(Operator):
|
||||||
name="Contour Curve",
|
name="Contour Curve",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
xhatch: BoolProperty(
|
||||||
|
name="Crosshatch #",
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
contour_separate: BoolProperty(
|
contour_separate: BoolProperty(
|
||||||
name="Contour Separate",
|
name="Contour Separate",
|
||||||
default=False,
|
default=False,
|
||||||
|
@ -139,14 +145,18 @@ class CamCurveHatch(Operator):
|
||||||
layout.prop(self, 'offset')
|
layout.prop(self, 'offset')
|
||||||
layout.prop(self, 'pocket_shape')
|
layout.prop(self, 'pocket_shape')
|
||||||
layout.prop(self, 'contour')
|
layout.prop(self, 'contour')
|
||||||
|
layout.prop(self, 'xhatch')
|
||||||
if self.contour:
|
if self.contour:
|
||||||
layout.prop(self, 'contour_separate')
|
layout.prop(self, 'contour_separate')
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
ob = context.active_object
|
ob = context.active_object
|
||||||
|
obname = ob.name
|
||||||
ob.select_set(True)
|
ob.select_set(True)
|
||||||
|
simple.remove_multiple("crosshatch")
|
||||||
depth = ob.location[2]
|
depth = ob.location[2]
|
||||||
xingOffset = self.offset
|
xingOffset = self.offset
|
||||||
|
|
||||||
if self.contour:
|
if self.contour:
|
||||||
xingOffset -= self.distance/2 # contour does not touch the crosshatch
|
xingOffset -= self.distance/2 # contour does not touch the crosshatch
|
||||||
xing = generate_crosshatch(
|
xing = generate_crosshatch(
|
||||||
|
@ -157,6 +167,18 @@ class CamCurveHatch(Operator):
|
||||||
self.pocket_shape,
|
self.pocket_shape,
|
||||||
)
|
)
|
||||||
utils.shapelyToCurve('crosshatch_lines', xing, depth)
|
utils.shapelyToCurve('crosshatch_lines', xing, depth)
|
||||||
|
|
||||||
|
if self.xhatch:
|
||||||
|
simple.make_active(obname)
|
||||||
|
xingra = generate_crosshatch(
|
||||||
|
context,
|
||||||
|
self.angle + 1.570796327,
|
||||||
|
self.distance,
|
||||||
|
xingOffset,
|
||||||
|
self.pocket_shape,
|
||||||
|
)
|
||||||
|
utils.shapelyToCurve('crosshatch_lines_ra', xingra, depth)
|
||||||
|
|
||||||
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
|
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
|
||||||
if self.contour:
|
if self.contour:
|
||||||
simple.deselect()
|
simple.deselect()
|
||||||
|
|
Ładowanie…
Reference in New Issue