fix( ballcone,cylcone) with ocl ,exact and sim

pull/194/head
abosafia 2021-07-28 13:34:42 +02:00
rodzic 27b6d167a9
commit 44710d44a5
5 zmienionych plików z 31 dodań i 18 usunięć

Wyświetl plik

@ -578,8 +578,8 @@ class camOperation(bpy.types.PropertyGroup):
max=180.0, default=60.0, precision=PRECISION, update=updateOffsetImage)
ball_radius: FloatProperty(name="Ball radius", description="Radius of", min=0.0,
max=0.035, default=0.001, unit="LENGTH", precision=PRECISION, update=updateOffsetImage)
ball_cone_flute: FloatProperty(name="BallCone Flute Length", description="length of flute", min=0.0,
max=0.1, default=0.017, unit="LENGTH", precision=PRECISION, update=updateOffsetImage)
#ball_cone_flute: FloatProperty(name="BallCone Flute Length", description="length of flute", min=0.0,
# max=0.1, default=0.017, unit="LENGTH", precision=PRECISION, update=updateOffsetImage)
bull_corner_radius: FloatProperty(name="Bull Corner Radius", description="Radius tool bit corner", min=0.0,
max=0.035, default=0.005, unit="LENGTH", precision=PRECISION, update=updateOffsetImage)

Wyświetl plik

@ -95,7 +95,10 @@ def getCutterBullet(o):
cutter = bpy.context.active_object
cutter.rigid_body.collision_shape = 'CONVEX_HULL'
elif type == 'BALLCONE':
conedepth = o.ball_cone_flute-o.ball_radius
angle =math.radians(o.cutter_tip_angle)/2
conedepth = (o.cutter_diameter/2 - o.ball_radius)/math.tan(angle)
Ball_R = o.ball_radius/math.cos(angle)
D_ofset = o.ball_radius * math.tan(angle)
bpy.ops.mesh.primitive_cone_add(vertices=32,
radius1=o.cutter_diameter / 2,
radius2=o.ball_radius,
@ -103,7 +106,7 @@ def getCutterBullet(o):
end_fill_type='NGON',
align='WORLD',
enter_editmode=False,
location=(0, 0, o.conedepth/2),
location=(0, 0,conedepth/2 - D_ofset),
rotation=(math.pi, 0, 0))
# bpy.ops.rigidbody.object_add(type='ACTIVE')
@ -111,7 +114,7 @@ def getCutterBullet(o):
ob1 = bpy.context.active_object
ob1.name = "ConeTool"
bpy.ops.mesh.primitive_uv_sphere_add(radius=o.ball_radius,
bpy.ops.mesh.primitive_uv_sphere_add(radius = Ball_R,
enter_editmode=False,
align='WORLD',
location=(0, 0, 0),
@ -131,7 +134,7 @@ def getCutterBullet(o):
bpy.data.objects['ConeTool'].select_set(True)
bpy.ops.object.delete()
bpy.data.objects['BallConeTool'].select_set(True)
bpy.ops.object.duplicate()
cutter = bpy.context.active_object
cutter.scale *= BULLET_SCALE
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)

Wyświetl plik

@ -38,8 +38,9 @@ def ocl_sample(operation, chunks):
op_cutter_type = operation.cutter_type
op_cutter_diameter = operation.cutter_diameter
op_minz = operation.minz
if op_cutter_type == "VCARVE" or op_cutter_type == "CYLCONE":
op_cutter_tip_angle = math.radians(operation.cutter_tip_angle)/2
op_cutter_tip_angle = math.radians(operation.cutter_tip_angle)/2
if op_cutter_type == "VCARVE":
cutter_length = (op_cutter_diameter/math.tan(op_cutter_tip_angle))/2
else:
cutter_length = 10
@ -55,11 +56,11 @@ def ocl_sample(operation, chunks):
elif op_cutter_type =='CYLCONE':
cutter = ocl.CylConeCutter((operation.cylcone_diameter/2+operation.skin)*2000,(op_cutter_diameter + operation.skin * 2) * 1000, op_cutter_tip_angle)
elif op_cutter_type == 'BALLCONE':
angle = math.degrees(math.atan((op_cutter_diameter / 2) - operation.ball_radius) / (
operation.ball_cone_flute - operation.ball_radius))
print("BallCone angle:" + str(angle))
#angle = math.degrees(math.atan((op_cutter_diameter / 2) - operation.ball_radius) / (
# operation.ball_cone_flute - operation.ball_radius))
#print("BallCone angle:" + str(angle))
cutter = ocl.BallConeCutter((operation.ball_radius + operation.skin) * 2000,
(op_cutter_diameter + operation.skin * 2) * 1000, math.radians(angle))
(op_cutter_diameter + operation.skin * 2) * 1000, op_cutter_tip_angle)
elif op_cutter_type =='BULLNOSE':
cutter = ocl.BullCutter((op_cutter_diameter + operation.skin * 2) * 1000,operation.bull_corner_radius*1000, cutter_length)
else:

Wyświetl plik

@ -343,21 +343,30 @@ def getCutterArray(operation, pixsize):
v.y = (b + 0.5 - m) * ps
if v.length <= r:
z = (-(v.length - cyl_r) * s)
if v.length <= cyl_r:
z =0
car.itemset((a, b), z)
elif type == 'BALLCONE':
#angle = operation.cutter_tip_angle
angle =math.radians(operation.cutter_tip_angle)/2
ball_r = operation.ball_radius
cutter_r = operation.cutter_diameter / 2
cutter_l = operation.ball_cone_flute
s = (cutter_l)/(cutter_r - ball_r)
conedepth = (cutter_r - ball_r)/math.tan(angle)
Ball_R = ball_r/math.cos(angle)
D_ofset = ball_r * math.tan(angle)
print("angle", operation.cutter_tip_angle/2)
print("conedepth", conedepth)
print("D_ofset", D_ofset)
print("Ball_R", Ball_R)
s = math.tan(math.pi/2-angle)
print("slope", s)
for a in range(0, res):
v.x = (a + 0.5 - m) * ps
for b in range(0, res):
v.y = (b + 0.5 - m) * ps
if v.length <= cutter_r:
z = (-(v.length - ball_r ) * s) - ball_r
z = -(v.length - ball_r ) * s -Ball_R + D_ofset
if v.length <= ball_r:
z = math.sin(math.acos(v.length / ball_r)) * ball_r - ball_r
z = math.sin(math.acos(v.length / Ball_R)) * Ball_R - Ball_R
car.itemset((a, b), z)
elif type == 'CUSTOM':
cutob = bpy.data.objects[operation.cutter_object_name]

Wyświetl plik

@ -97,7 +97,7 @@ class CAM_CUTTER_Panel(CAMButtonsPanel, bpy.types.Panel):
if ao.cutter_type == 'BALLCONE':
layout.prop(ao,'ball_radius')
EngagementDisplay(ao,layout)
layout.prop(ao,'ball_cone_flute')
layout.prop(ao,'cutter_tip_angle')
layout.label(text='Cutter diameter = shank diameter')
if ao.cutter_type == 'CYLCONE':
layout.prop(ao,'cylcone_diameter')