kopia lustrzana https://github.com/vilemduha/blendercam
Merge branch 'master' of https://github.com/vilemnovak/blendercam into master-org
commit
70a420f246
|
|
@ -787,6 +787,8 @@ def meshFromCurve(o):
|
|||
storage = makeVisible(o)#this is here because all of this doesn't work when object is not visible or on current layer
|
||||
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
|
||||
bpy.ops.group.objects_remove_all()
|
||||
bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')
|
||||
|
||||
co=bpy.context.active_object
|
||||
if co.type=='FONT':#support for text objects is only and only here, just convert them to curves.
|
||||
bpy.ops.object.convert(target='CURVE', keep_original=False)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Creator(iso_modal.Creator):
|
|||
if self.output_tool_change:
|
||||
return( 'T0' + self.SPACE() + 'M06' + self.SPACE() + 'M02')
|
||||
else:
|
||||
return('MO2')
|
||||
return('M02')
|
||||
|
||||
def dwell(self, t):
|
||||
self.write('\n')
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ def getPathPatternParallel(o,angle):
|
|||
#ar=numpy.array((1.1,1.1))
|
||||
#ar.resize()
|
||||
#defaultar=numpy.arange(int(-dim/pathd), int(dim/pathd)).tolist()
|
||||
if bpy.app.debug_value==1:# by default off
|
||||
if bpy.app.debug_value==0:# by default off
|
||||
#this is the original pattern method, slower, but well tested:
|
||||
dirvect=Vector((0,1,0))
|
||||
dirvect.rotate(e)
|
||||
|
|
|
|||
|
|
@ -441,18 +441,6 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel):
|
|||
layout.prop(ao,'dist_between_paths')
|
||||
layout.prop(ao,'movement_insideout')
|
||||
layout.prop(ao,'dont_merge')
|
||||
layout.prop(ao,'use_bridges')
|
||||
if ao.use_bridges:
|
||||
#layout.prop(ao,'bridges_placement')
|
||||
layout.prop(ao,'bridges_width')
|
||||
layout.prop(ao,'bridges_height')
|
||||
|
||||
layout.prop_search(ao, "bridges_group_name", bpy.data, "groups")
|
||||
#layout.prop(ao,'bridges_group_name')
|
||||
#if ao.bridges_placement == 'AUTO':
|
||||
# layout.prop(ao,'bridges_per_curve')
|
||||
# layout.prop(ao,'bridges_max_distance')
|
||||
layout.operator("scene.cam_bridges_add", text="Autogenerate bridges")
|
||||
elif ao.strategy=='WATERLINE':
|
||||
layout.prop(ao,'slice_detail')
|
||||
layout.prop(ao,'waterline_fill')
|
||||
|
|
@ -489,6 +477,20 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel):
|
|||
layout.prop(ao,'parallel_angle')
|
||||
|
||||
layout.prop(ao,'inverse')
|
||||
if ao.type!='POCKET' or ao.type!='DRILL' or ao.type !='CURVE' or ao.type != 'MEDIAL_AXIS':
|
||||
layout.prop(ao,'use_bridges')
|
||||
if ao.use_bridges:
|
||||
#layout.prop(ao,'bridges_placement')
|
||||
layout.prop(ao,'bridges_width')
|
||||
layout.prop(ao,'bridges_height')
|
||||
|
||||
layout.prop_search(ao, "bridges_group_name", bpy.data, "groups")
|
||||
#layout.prop(ao,'bridges_group_name')
|
||||
#if ao.bridges_placement == 'AUTO':
|
||||
# layout.prop(ao,'bridges_per_curve')
|
||||
# layout.prop(ao,'bridges_max_distance')
|
||||
layout.operator("scene.cam_bridges_add", text="Autogenerate bridges")
|
||||
|
||||
#elif ao.strategy=='SLICES':
|
||||
# layout.prop(ao,'slice_detail')
|
||||
#first attempt to draw object list for orientations:
|
||||
|
|
|
|||
|
|
@ -1658,7 +1658,16 @@ def getOperationSilhouete(operation):
|
|||
stype='CURVES'
|
||||
else:
|
||||
stype='IMAGE'
|
||||
if stype == 'OBJECTS' or stype=='IMAGE':
|
||||
|
||||
totfaces=0
|
||||
if stype=='OBJECTS':
|
||||
for ob in operation.objects:
|
||||
if ob.type=='MESH':
|
||||
totfaces+=len(ob.data.polygons)
|
||||
|
||||
|
||||
|
||||
if (stype == 'OBJECTS' and totfaces>200000) or stype=='IMAGE':
|
||||
print('image method')
|
||||
samples = renderSampleImage(operation)
|
||||
if stype=='OBJECTS':
|
||||
|
|
@ -1714,19 +1723,18 @@ def getObjectSilhouete(stype, objects=None):
|
|||
#n=mathutils.geometry.normal(verts[0],verts[1],verts[2])
|
||||
if f.area>0 and n.z!=0:#n.z>0.0 and f.area>0.0 :
|
||||
s=[]
|
||||
c=f.center.xy
|
||||
c=mw * f.center
|
||||
c=c.xy
|
||||
for i in f.vertices:
|
||||
v=mw* m.vertices[i].co
|
||||
x=v.x
|
||||
y=v.y
|
||||
x=x+(x-c.x)*e
|
||||
y=y+(y-c.y)*e
|
||||
s.append((x,y))
|
||||
if len(v)>2:
|
||||
s.append((v.x,v.y))
|
||||
if len(s)>2:
|
||||
#print(s)
|
||||
p=spolygon.Polygon(s)
|
||||
#print(dir(p))
|
||||
if p.is_valid:
|
||||
polys.append(p)
|
||||
#polys.append(p)
|
||||
polys.append(p.buffer(e,resolution = 0))
|
||||
#if id==923:
|
||||
# m.polygons[923].select
|
||||
id+=1
|
||||
|
|
@ -1975,9 +1983,9 @@ def addBridge(x,y,rot,sizex, sizey):
|
|||
def addAutoBridges(o):
|
||||
'''attempt to add auto bridges as set of curves'''
|
||||
getOperationSources(o)
|
||||
if not o.onlycurves:
|
||||
o.warnings+=('not curves')
|
||||
return;
|
||||
#if not o.onlycurves:
|
||||
# o.warnings+=('not curves')
|
||||
# return;
|
||||
bridgegroupname=o.bridges_group_name
|
||||
if bridgegroupname == '' or bpy.data.groups.get(bridgegroupname) == None:
|
||||
bridgegroupname = 'bridges_'+o.name
|
||||
|
|
@ -1986,26 +1994,28 @@ def addAutoBridges(o):
|
|||
o.bridges_group_name = bridgegroupname
|
||||
for ob in o.objects:
|
||||
|
||||
if ob.type=='CURVE':
|
||||
if ob.type=='CURVE' or ob.type=='TEXT':
|
||||
curve = curveToShapely(ob)
|
||||
#curve = shapelyToMultipolygon(curve)
|
||||
for c in curve:
|
||||
c=c.exterior
|
||||
minx, miny, maxx, maxy = c.bounds
|
||||
d1 = c.project(sgeometry.Point(maxx+1000, (maxy+miny)/2.0))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,-pi/2,o.bridges_width, o.cutter_diameter*1))
|
||||
d1 = c.project(sgeometry.Point(minx-1000, (maxy+miny)/2.0))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,pi/2,o.bridges_width, o.cutter_diameter*1))
|
||||
d1 = c.project(sgeometry.Point((minx + maxx)/2.0, maxy + 1000))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,0,o.bridges_width, o.cutter_diameter*1))
|
||||
d1 = c.project(sgeometry.Point((minx + maxx) / 2.0 , miny - 1000))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,pi,o.bridges_width, o.cutter_diameter*1))
|
||||
if ob.type == 'MESH':
|
||||
|
||||
curve = getObjectSilhouete('OBJECTS',[ob])
|
||||
#curve = shapelyToMultipolygon(curve)
|
||||
for c in curve:
|
||||
c=c.exterior
|
||||
minx, miny, maxx, maxy = c.bounds
|
||||
d1 = c.project(sgeometry.Point(maxx+1000, (maxy+miny)/2.0))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,-pi/2,o.bridges_width, o.cutter_diameter*1))
|
||||
d1 = c.project(sgeometry.Point(minx-1000, (maxy+miny)/2.0))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,pi/2,o.bridges_width, o.cutter_diameter*1))
|
||||
d1 = c.project(sgeometry.Point((minx + maxx)/2.0, maxy + 1000))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,0,o.bridges_width, o.cutter_diameter*1))
|
||||
d1 = c.project(sgeometry.Point((minx + maxx) / 2.0 , miny - 1000))
|
||||
p = c.interpolate(d1)
|
||||
g.objects.link( addBridge(p.x,p.y,pi,o.bridges_width, o.cutter_diameter*1))
|
||||
|
||||
mw=ob.matrix_world
|
||||
|
||||
def getBridgesPoly(o):
|
||||
if not hasattr(o, 'bridgespolyorig'):
|
||||
|
|
@ -2535,6 +2545,8 @@ def strategy_drill( o ):
|
|||
|
||||
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
|
||||
bpy.ops.group.objects_remove_all()
|
||||
bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')
|
||||
|
||||
ob=bpy.context.active_object
|
||||
if ob.type=='CURVE':
|
||||
ob.data.dimensions='3D'
|
||||
|
|
@ -2844,7 +2856,7 @@ def getPath3axis(context, operation):
|
|||
#return
|
||||
if o.strategy=='BLOCK' or o.strategy=='SPIRAL' or o.strategy=='CIRCLES' or o.strategy=='OUTLINEFILL':
|
||||
pathSamples=connectChunksLow(pathSamples,o)
|
||||
|
||||
|
||||
#print (minz)
|
||||
|
||||
|
||||
|
|
@ -2867,7 +2879,9 @@ def getPath3axis(context, operation):
|
|||
for ch in chunks:
|
||||
for vi in range(0,len(ch.points)):
|
||||
ch.points[vi]=(ch.points[vi][0],ch.points[vi][1],ch.points[vi][2]-o.carve_depth)
|
||||
|
||||
if o.use_bridges:
|
||||
for chunk in chunks:
|
||||
useBridges(chunk,o)
|
||||
chunksToMesh(chunks,o)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,45 @@ def reconstructmTransform(context):
|
|||
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
|
||||
ob.location=(0,0,0)
|
||||
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
|
||||
|
||||
class RemoveSmallParts(bpy.types.Operator):
|
||||
"""Transform import from reconstructme to blender axes/scale"""
|
||||
bl_idname = "object.remove_small_parts"
|
||||
bl_label = "Remove small parts"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object is not None
|
||||
|
||||
def execute(self, context):
|
||||
removeSmallParts(context)
|
||||
return {'FINISHED'}
|
||||
|
||||
def removeSmallParts(context):
|
||||
actob=bpy.context.active_object
|
||||
bpy.ops.object.editmode_toggle()
|
||||
bpy.ops.mesh.separate(type='LOOSE')
|
||||
bpy.ops.object.editmode_toggle()
|
||||
obs=bpy.context.selected_objects
|
||||
rem=[]
|
||||
nrem=[]
|
||||
for ob in obs:
|
||||
if len(ob.data.vertices)<300:
|
||||
print(ob.name)
|
||||
rem.append(ob)
|
||||
else:
|
||||
nrem.append(ob)
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
for ob in rem:
|
||||
ob.select=True
|
||||
bpy.ops.object.delete(use_global=False)
|
||||
for ob in nrem:
|
||||
ob.select=True
|
||||
bpy.context.scene.objects.active=nrem[0]
|
||||
bpy.ops.object.join()
|
||||
|
||||
|
||||
|
||||
#panel containing all tools
|
||||
class VIEW3D_PT_tools_scantools(bpy.types.Panel):
|
||||
|
|
@ -253,12 +291,14 @@ class VIEW3D_PT_tools_scantools(bpy.types.Panel):
|
|||
layout.operator("object.reconstructme_trans")
|
||||
layout.operator("object.align_floor")
|
||||
layout.operator("object.remove_floor")
|
||||
layout.operator("object.remove_small_parts")
|
||||
layout.operator("object.make_lod")
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(ObjectFloor)
|
||||
bpy.utils.register_class(RemoveFloor)
|
||||
bpy.utils.register_class(ReconstructmeTransform)
|
||||
bpy.utils.register_class(RemoveSmallParts)
|
||||
bpy.utils.register_class(MakeLOD)
|
||||
bpy.utils.register_class(VIEW3D_PT_tools_scantools)
|
||||
|
||||
|
|
@ -267,6 +307,7 @@ def unregister():
|
|||
bpy.utils.unregister_class(ObjectFloor)
|
||||
bpy.utils.unregister_class(RemoveFloor)
|
||||
bpy.utils.unregister_class(ReconstructmeTransform)
|
||||
bpy.utils.unregister_class(RemoveSmallParts)
|
||||
bpy.utils.unregister_class(MakeLOD)
|
||||
bpy.utils.unregister_class(VIEW3D_PT_tools_scantools)
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue