MuesliMix/prototype/plate.py

57 lines
1.3 KiB
Python

import os
from FreeCAD import Rotation, Base, newDocument
os.chdir('/home/bt304019/programming/imaginaerraum/cerealist/prototype')
from circles import PlateLayout
N = 5
plate_radius = 150.0
plate_layout = PlateLayout(N, plate_radius)
tube1, tube2 = plate_layout.compute_layout()
print("tube1 = {}".format(tube1))
print("tube2 = {}".format(tube2))
# use slightly smaller radius so we have some gap
tube1['radius'] = 50.0
tube2['radius'] = 20.0
doc = newDocument()
# set parameters (in mm)
height = 1.0
# create plate
plate = Part.makeCylinder(plate_radius, height, Base.Vector(0,0,0), Base.Vector(0,0,1))
r = tube1['radius']
for k in range(0,len(tube1['coords'].values())):
print(k)
v = Base.Vector(tube1['coords'][k][0], tube1['coords'][k][1], -1)
big_circle_template = Part.makeCylinder(tube1['radius'], height+2, v, Base.Vector(0,0,1))
plate = plate.cut(big_circle_template)
del big_circle_template # remove the template
Part.show(plate)
# blades
blade_template = Part.makeCylinder(height/2, thickness, Base.Vector(height/2,0, -thickness/2))
#Part.show(blade_template)
blades1 = blade_template.cut(rod)
blades2 = blades1.copy()
blades2.Placement.Rotation = Rotation(0, 0, 90)
del blade_template # remove the template
# show all the stuff we created just now
Part.show(pierced_rod)
Part.show(blades1)
Part.show(blades2)
doc.recompute()