kopia lustrzana https://github.com/vilemduha/blendercam
Porównaj commity
26 Commity
2cea4b694a
...
79fcd0b920
Autor | SHA1 | Data |
---|---|---|
Alain Pelletier | 79fcd0b920 | |
palain | cf6dfb14dd | |
Alain Pelletier | e351735e8e | |
palain | 9c69718d1d | |
abosafia | 911d5bf464 | |
abosafia | 76e68783b6 | |
palain | a3f523839c | |
palain | 02dd7d0da2 | |
palain | 3025e30a1a | |
palain | 362b6d3cff | |
palain | 34b02d3716 | |
palain | 18599720be | |
palain | 52f8c7620f | |
palain | ba8563a001 | |
Alain Pelletier | 2f770c82e1 | |
Alain Pelletier | 72423c598d | |
abosafia | 58d28c3cbb | |
palain | 929d5ea373 | |
palain | d69333e333 | |
palain | 4f42e6f15a | |
Alain Pelletier | bb2174e214 | |
abosafia | 3590fae45a | |
Alain Pelletier | cb624c1307 | |
abosafia | 19b0dc1b5e | |
abosafia | 73fd399115 | |
palain | c17c2cc6aa |
|
@ -603,8 +603,8 @@ class camOperation(bpy.types.PropertyGroup):
|
|||
|
||||
# pocket options
|
||||
pocket_option: EnumProperty(name='Start Position', items=(
|
||||
('INSIDE', 'Inside', 'a'), ('OUTSIDE', 'Outside', 'a'), ('MIDDLE', 'Middle', 'a')),
|
||||
description='Pocket starting position', default='MIDDLE', update=updateRest)
|
||||
('INSIDE', 'Inside', 'a'), ('OUTSIDE', 'Outside', 'a')),
|
||||
description='Pocket starting position', default='INSIDE', update=updateRest)
|
||||
pocketToCurve: bpy.props.BoolProperty(name="Pocket to curve",
|
||||
description="generates a curve instead of a path",
|
||||
default=False, update=updateRest)
|
||||
|
|
|
@ -43,8 +43,11 @@ class CamCurveHatch(bpy.types.Operator):
|
|||
angle: bpy.props.FloatProperty(name="angle", default=0, min=-math.pi/2, max=math.pi/2, precision=4, subtype="ANGLE")
|
||||
distance: bpy.props.FloatProperty(name="spacing", default=0.015, min=0, max=3.0, precision=4, unit="LENGTH")
|
||||
offset: bpy.props.FloatProperty(name="Margin", default=0.001, min=-1.0, max=3.0, precision=4, unit="LENGTH")
|
||||
height: bpy.props.FloatProperty(name="Height", default=0.000, min=-1.0, max=1.0, precision=4, unit="LENGTH")
|
||||
amount: bpy.props.IntProperty(name="amount", default=10, min=1, max=10000)
|
||||
hull: bpy.props.BoolProperty(name="Convex Hull", default=False)
|
||||
contour: bpy.props.BoolProperty(name="Contour Curve", default=False)
|
||||
contour_separate: bpy.props.BoolProperty(name="Contour separate", default=False)
|
||||
pocket_type: EnumProperty(name='Type pocket',
|
||||
items=(('BOUNDS', 'makes a bounds rectangle', 'makes a bounding square'),
|
||||
('POCKET', 'Pocket', 'makes a pocket inside a closed loop')),
|
||||
|
@ -54,12 +57,35 @@ class CamCurveHatch(bpy.types.Operator):
|
|||
def poll(cls, context):
|
||||
return context.active_object is not None and context.active_object.type in ['CURVE', 'FONT']
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.prop(self, 'angle')
|
||||
layout.prop(self, 'distance')
|
||||
layout.prop(self, 'offset')
|
||||
layout.prop(self, 'height')
|
||||
|
||||
layout.prop(self, 'pocket_type')
|
||||
if self.pocket_type == 'POCKET':
|
||||
if self.hull:
|
||||
layout.prop(self, 'hull')
|
||||
layout.prop(self, 'contour')
|
||||
if self.contour:
|
||||
layout.prop(self, 'contour_separate')
|
||||
else:
|
||||
layout.prop(self, 'hull')
|
||||
if self.contour:
|
||||
layout.prop(self, 'contour')
|
||||
|
||||
def execute(self, context):
|
||||
simple.remove_multiple("crosshatch")
|
||||
ob = context.active_object
|
||||
ob.select_set(True)
|
||||
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
|
||||
depth = ob.location[2]
|
||||
if self.hull:
|
||||
bpy.ops.object.convex_hull()
|
||||
simple.active_name('crosshatch_hull')
|
||||
from shapely import affinity
|
||||
from shapely.ops import voronoi_diagram
|
||||
shapes = utils.curveToShapely(bpy.context.active_object)
|
||||
for s in shapes.geoms:
|
||||
coords = []
|
||||
|
@ -68,15 +94,12 @@ class CamCurveHatch(bpy.types.Operator):
|
|||
miny -= self.offset
|
||||
maxx += self.offset
|
||||
maxy += self.offset
|
||||
|
||||
centery = (miny + maxy) / 2
|
||||
height = maxy - miny
|
||||
width = maxx - minx
|
||||
centerx = (minx+maxx) / 2
|
||||
diagonal = math.hypot(width, height)
|
||||
|
||||
simple.add_bound_rectangle(minx, miny, maxx, maxy, 'crosshatch_bound')
|
||||
|
||||
amount = int(2*diagonal/self.distance) + 1
|
||||
|
||||
for x in range(amount):
|
||||
|
@ -96,13 +119,33 @@ class CamCurveHatch(bpy.types.Operator):
|
|||
xing = translated.intersection(s.buffer(self.offset))
|
||||
# Shapely detects intersections with the original curve or hull
|
||||
|
||||
utils.shapelyToCurve('crosshatch_lines', xing, 0)
|
||||
utils.shapelyToCurve('crosshatch_lines', xing, self.height)
|
||||
|
||||
# remove temporary shapes
|
||||
simple.remove_multiple('crosshatch_bound')
|
||||
simple.remove_multiple('crosshatch_hull')
|
||||
|
||||
simple.select_multiple('crosshatch')
|
||||
bpy.ops.object.editmode_toggle()
|
||||
bpy.ops.curve.select_all(action='SELECT')
|
||||
bpy.ops.curve.subdivide()
|
||||
bpy.ops.object.editmode_toggle()
|
||||
simple.join_multiple('crosshatch')
|
||||
simple.remove_doubles()
|
||||
|
||||
# add contour
|
||||
if self.contour:
|
||||
simple.deselect()
|
||||
bpy.context.view_layer.objects.active = ob
|
||||
ob.select_set(True)
|
||||
bpy.ops.object.silhouete_offset(offset=self.offset)
|
||||
if self.contour_separate:
|
||||
simple.active_name('contour_hatch')
|
||||
simple.deselect()
|
||||
else:
|
||||
simple.active_name('crosshatch_contour')
|
||||
simple.join_multiple('crosshatch')
|
||||
simple.remove_doubles()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
|
|
@ -330,6 +330,11 @@ def pocket(o):
|
|||
nchunks = shapelyToChunks(p, o.min.z)
|
||||
# print("nchunks")
|
||||
pnew = p.buffer(-o.dist_between_paths, o.circle_detail)
|
||||
if pnew.is_empty:
|
||||
|
||||
pt = p.buffer(-c_offset, o.circle_detail) # test if the last curve will leave material
|
||||
if not pt.is_empty:
|
||||
pnew = pt
|
||||
# print("pnew")
|
||||
|
||||
nchunks = limitChunks(nchunks, o)
|
||||
|
|
|
@ -1074,6 +1074,8 @@ def sortChunks(chunks, o):
|
|||
# chunks[:] = []
|
||||
|
||||
i -= 1
|
||||
if o.strategy == 'POCKET' and o.pocket_option == 'OUTSIDE':
|
||||
sortedchunks.reverse()
|
||||
|
||||
sys.setrecursionlimit(1000)
|
||||
if o.strategy != 'DRILL' and o.strategy != 'OUTLINEFILL':
|
||||
|
|
Ładowanie…
Reference in New Issue