kopia lustrzana https://github.com/vilemduha/blendercam
curve camtools improve
rodzic
8602073c50
commit
65ba22a148
|
|
@ -69,7 +69,7 @@ from .curvecamtools import (
|
|||
CamCurveRemoveDoubles,
|
||||
CamMeshGetPockets,
|
||||
CamOffsetSilhouete,
|
||||
CamObjectSilhouete,
|
||||
#CamObjectSilhouete,
|
||||
)
|
||||
from .engine import (
|
||||
CNCCAM_ENGINE,
|
||||
|
|
@ -231,7 +231,7 @@ classes = [
|
|||
CamCurveRemoveDoubles,
|
||||
CamMeshGetPockets,
|
||||
CamOffsetSilhouete,
|
||||
CamObjectSilhouete,
|
||||
#CamObjectSilhouete,
|
||||
|
||||
# .engine
|
||||
CNCCAM_ENGINE,
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ class CamCurveBoolean(Operator):
|
|||
else:
|
||||
self.report({'ERROR'}, 'at least 2 curves must be selected')
|
||||
return {'CANCELLED'}
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
|
||||
class CamCurveConvexHull(Operator):
|
||||
|
|
@ -193,6 +195,8 @@ class CamCurveIntarsion(Operator):
|
|||
o4.select_set(True)
|
||||
o3.select_set(True)
|
||||
return {'FINISHED'}
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
|
||||
# intarsion or joints
|
||||
|
|
@ -301,7 +305,8 @@ class CamCurveOvercuts(Operator):
|
|||
utils.shapelyToCurve(o1.name + '_overcuts', fs, o1.location.z)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
# Overcut type B
|
||||
class CamCurveOvercutsB(Operator):
|
||||
|
|
@ -572,13 +577,29 @@ class CamCurveOvercutsB(Operator):
|
|||
|
||||
utils.shapelyToCurve(o1.name + '_overcuts', fs, o1.location.z)
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
class CamCurveRemoveDoubles(Operator):
|
||||
"""Curve Remove Doubles"""
|
||||
bl_idname = "object.curve_remove_doubles"
|
||||
bl_label = "Remove Curve Doubles"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
|
||||
merg_distance: FloatProperty(
|
||||
name="Merge distance",
|
||||
default=0.0001,
|
||||
min=0.0,
|
||||
max=.01,
|
||||
|
||||
)
|
||||
|
||||
keep_bezier: BoolProperty(
|
||||
name="Keep bezier",
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
|
@ -586,17 +607,47 @@ class CamCurveRemoveDoubles(Operator):
|
|||
|
||||
def execute(self, context):
|
||||
obs = bpy.context.selected_objects
|
||||
for ob in obs:
|
||||
bpy.context.view_layer.objects.active = ob
|
||||
if bpy.context.mode == 'OBJECT':
|
||||
if self.keep_bezier:
|
||||
for ob in obs:
|
||||
bpy.ops.curvetools.operatorsplinesremoveshort()
|
||||
bpy.context.view_layer.objects.active = ob
|
||||
if bpy.context.mode == 'OBJECT':
|
||||
bpy.ops.object.editmode_toggle()
|
||||
bpy.ops.curve.select_all()
|
||||
bpy.ops.curve.spline_type_set(type='BEZIER')
|
||||
bpy.ops.curve.remove_double(distance = self.merg_distance)
|
||||
bpy.ops.object.editmode_toggle()
|
||||
bpy.ops.curve.select_all()
|
||||
bpy.ops.curve.spline_type_set(type='BEZIER')
|
||||
bpy.ops.curve.remove_double(distance=0.00001)
|
||||
bpy.ops.object.editmode_toggle()
|
||||
else:
|
||||
for ob in obs:
|
||||
bpy.context.view_layer.objects.active = ob
|
||||
|
||||
mode = False
|
||||
if bpy.context.mode == 'EDIT_CURVE':
|
||||
bpy.ops.object.editmode_toggle()
|
||||
mode = True
|
||||
bpy.ops.object.convert(target='MESH')
|
||||
bpy.ops.object.editmode_toggle()
|
||||
bpy.ops.mesh.select_all(action='TOGGLE')
|
||||
bpy.ops.mesh.remove_doubles()
|
||||
bpy.ops.object.editmode_toggle()
|
||||
bpy.ops.object.convert(target='CURVE')
|
||||
|
||||
if mode:
|
||||
bpy.ops.object.editmode_toggle()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.prop(self, "keep_bezier", text="Keep Bezier")
|
||||
|
||||
if self.keep_bezier:
|
||||
layout.prop(self, "merg_distance", text="Merge Distance")
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
|
||||
class CamMeshGetPockets(Operator):
|
||||
"""Detect Pockets in a Mesh and Extract Them as Curves"""
|
||||
|
|
@ -725,7 +776,7 @@ class CamOffsetSilhouete(Operator):
|
|||
)
|
||||
mitrelimit: FloatProperty(
|
||||
name="Mitre Limit",
|
||||
default=.003,
|
||||
default=2,
|
||||
min=0.00000001,
|
||||
max=20,
|
||||
precision=4,
|
||||
|
|
@ -776,15 +827,24 @@ class CamOffsetSilhouete(Operator):
|
|||
|
||||
dilated = line.buffer(self.offset, cap_style=1, resolution=16,
|
||||
mitre_limit=self.mitrelimit) # use shapely to expand
|
||||
polygon_utils_cam.shapelyToCurve("dilation", dilated, 0)
|
||||
polygon_utils_cam.shape2lyToCurve("dilation", dilated, 0)
|
||||
else:
|
||||
utils.silhoueteOffset(context, self.offset,
|
||||
int(self.style), self.mitrelimit)
|
||||
return {'FINISHED'}
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.prop(self, "offset", text="Offset")
|
||||
layout.prop(self, "style", text="Type of Curve")
|
||||
if self.style == '2':
|
||||
layout.prop(self, "mitrelimit", text="Mitre Limit")
|
||||
layout.prop(self, "opencurve", text="Dialate Open Curve")
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
|
||||
# Finds object silhouette, usefull for meshes, since with curves it's not needed.
|
||||
class CamObjectSilhouete(Operator):
|
||||
'''class CamObjectSilhouete(Operator):
|
||||
"""Object Silhouette"""
|
||||
bl_idname = "object.silhouete"
|
||||
bl_label = "Object Silhouette"
|
||||
|
|
@ -813,6 +873,5 @@ class CamObjectSilhouete(Operator):
|
|||
bpy.context.scene.cursor.location = ob.location
|
||||
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
|
||||
bpy.ops.object.curve_remove_doubles()
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'FINISHED'}'''
|
||||
# ---------------------------------------------------
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue