Barrel position solver
This commit is contained in:
parent
0fb88a97d3
commit
63c2c74e02
|
@ -160,11 +160,22 @@ class Onbashira(Model):
|
||||||
.circle(self.rotor_bind_bolt_diam/2, mode="s")
|
.circle(self.rotor_bind_bolt_diam/2, mode="s")
|
||||||
)
|
)
|
||||||
def bearing_stator(self) -> Cq.Workplane:
|
def bearing_stator(self) -> Cq.Workplane:
|
||||||
return (
|
result = (
|
||||||
Cq.Workplane()
|
Cq.Workplane()
|
||||||
.placeSketch(self.profile_bearing_stator())
|
.placeSketch(self.profile_bearing_stator())
|
||||||
.extrude(self.bearing_disk_thickness)
|
.extrude(self.bearing_disk_thickness)
|
||||||
)
|
)
|
||||||
|
for i in range(self.n_side):
|
||||||
|
angle = (i+0.5) * math.radians(360 / self.n_side)
|
||||||
|
result.faces(">Z").moveTo(
|
||||||
|
self.stator_bind_radius * math.cos(angle),
|
||||||
|
self.stator_bind_radius * math.sin(angle),
|
||||||
|
).tagPlane(f"holeF{i}")
|
||||||
|
result.faces("<Z").moveTo(
|
||||||
|
self.stator_bind_radius * math.cos(-angle),
|
||||||
|
self.stator_bind_radius * math.sin(-angle),
|
||||||
|
).tagPlane(f"holeB{i}", direction="-Z")
|
||||||
|
return result
|
||||||
@target(name="bearing-rotor", kind=TargetKind.DXF)
|
@target(name="bearing-rotor", kind=TargetKind.DXF)
|
||||||
def profile_bearing_rotor(self) -> Cq.Sketch:
|
def profile_bearing_rotor(self) -> Cq.Sketch:
|
||||||
bolt_angle = 180 / self.n_side
|
bolt_angle = 180 / self.n_side
|
||||||
|
@ -236,7 +247,7 @@ class Onbashira(Model):
|
||||||
)
|
)
|
||||||
return outer - inner
|
return outer - inner
|
||||||
|
|
||||||
def assembly_rotor(self) -> Cq.Assembly:
|
def assembly_barrel(self) -> Cq.Assembly:
|
||||||
z_lower = -self.bearing_disk_gap/2 - self.bearing_disk_thickness
|
z_lower = -self.bearing_disk_gap/2 - self.bearing_disk_thickness
|
||||||
a = (
|
a = (
|
||||||
Cq.Assembly()
|
Cq.Assembly()
|
||||||
|
@ -665,6 +676,32 @@ class Onbashira(Model):
|
||||||
result.tagAbsolute(f"holeRPO{i}", (dr, x, -py), direction="+X")
|
result.tagAbsolute(f"holeRPO{i}", (dr, x, -py), direction="+X")
|
||||||
#result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X")
|
#result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X")
|
||||||
result.tagAbsolute(f"holeRSO{i}", locrot * Cq.Location(dr, -x, -py), direction="+X")
|
result.tagAbsolute(f"holeRSO{i}", locrot * Cq.Location(dr, -x, -py), direction="+X")
|
||||||
|
|
||||||
|
th = math.pi / self.n_side
|
||||||
|
r = self.bulk_radius
|
||||||
|
flange = (
|
||||||
|
Cq.Workplane()
|
||||||
|
.sketch()
|
||||||
|
.push([
|
||||||
|
(r, r * math.tan(th))
|
||||||
|
])
|
||||||
|
.circle(self.angle_joint_flange_radius)
|
||||||
|
.reset()
|
||||||
|
.regularPolygon(self.side_width_inner, self.n_side, mode="i")
|
||||||
|
.finalize()
|
||||||
|
.extrude(self.angle_joint_flange_thickness)
|
||||||
|
.translate((0, 0, -self.angle_joint_flange_thickness/2))
|
||||||
|
)
|
||||||
|
ri = self.stator_bind_radius
|
||||||
|
h = self.angle_joint_flange_thickness
|
||||||
|
cyl = Cq.Solid.makeCylinder(
|
||||||
|
radius=self.rotor_bind_bolt_diam/2,
|
||||||
|
height=h,
|
||||||
|
pnt=(ri * math.cos(th), ri * math.sin(th), -h/2),
|
||||||
|
)
|
||||||
|
result = result + flange - cyl
|
||||||
|
result.tagAbsolute("holeStatorL", (ri * math.cos(th), ri * math.sin(th), h/2), direction="+Z")
|
||||||
|
result.tagAbsolute("holeStatorR", (ri * math.cos(th), ri * math.sin(th), -h/2), direction="-Z")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@target(name="angle-joint-chamber-back")
|
@target(name="angle-joint-chamber-back")
|
||||||
|
@ -737,7 +774,6 @@ class Onbashira(Model):
|
||||||
.extrude(self.angle_joint_depth)
|
.extrude(self.angle_joint_depth)
|
||||||
.translate((0, 0, -self.angle_joint_depth/2))
|
.translate((0, 0, -self.angle_joint_depth/2))
|
||||||
.cut(slot.translate((0, 0, self.angle_joint_gap/2)))
|
.cut(slot.translate((0, 0, self.angle_joint_gap/2)))
|
||||||
.cut(slot.translate((0, 0, -self.angle_joint_depth-self.angle_joint_gap/2)))
|
|
||||||
.intersect(intersector)
|
.intersect(intersector)
|
||||||
.cut(chamber_intersector)
|
.cut(chamber_intersector)
|
||||||
.cut(mating1n)
|
.cut(mating1n)
|
||||||
|
@ -777,6 +813,33 @@ class Onbashira(Model):
|
||||||
result.tagAbsolute(f"holeLPO{i}", (dr, x, py), direction="+X")
|
result.tagAbsolute(f"holeLPO{i}", (dr, x, py), direction="+X")
|
||||||
#result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X")
|
#result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X")
|
||||||
result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X")
|
result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X")
|
||||||
|
|
||||||
|
th = math.pi / self.n_side
|
||||||
|
r = self.bulk_radius
|
||||||
|
flange_z = self.angle_joint_depth / 2 - self.side_thickness
|
||||||
|
flange = (
|
||||||
|
Cq.Workplane()
|
||||||
|
.sketch()
|
||||||
|
.push([
|
||||||
|
(r, r * math.tan(th))
|
||||||
|
])
|
||||||
|
.circle(self.angle_joint_flange_radius)
|
||||||
|
.reset()
|
||||||
|
.regularPolygon(self.side_width_inner, self.n_side, mode="i")
|
||||||
|
.finalize()
|
||||||
|
.extrude(self.angle_joint_flange_thickness)
|
||||||
|
.translate((0, 0, -flange_z))
|
||||||
|
)
|
||||||
|
ri = self.stator_bind_radius
|
||||||
|
h = self.angle_joint_flange_thickness
|
||||||
|
cyl = Cq.Solid.makeCylinder(
|
||||||
|
radius=self.rotor_bind_bolt_diam/2,
|
||||||
|
height=h,
|
||||||
|
pnt=(ri * math.cos(th), ri * math.sin(th), -flange_z),
|
||||||
|
)
|
||||||
|
result = result + flange - cyl
|
||||||
|
result.tagAbsolute("holeStatorL", (ri * math.cos(th), ri * math.sin(th), -flange_z+h/2), direction="+Z")
|
||||||
|
result.tagAbsolute("holeStatorR", (ri * math.cos(th), ri * math.sin(th), -flange_z-h/2), direction="-Z")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@target(name="angle-joint")
|
@target(name="angle-joint")
|
||||||
|
@ -903,17 +966,15 @@ class Onbashira(Model):
|
||||||
th = math.pi / self.n_side
|
th = math.pi / self.n_side
|
||||||
r = self.bulk_radius
|
r = self.bulk_radius
|
||||||
flange = (
|
flange = (
|
||||||
Cq.Sketch()
|
Cq.Workplane()
|
||||||
|
.sketch()
|
||||||
.push([
|
.push([
|
||||||
(r, r * math.tan(th))
|
(r, r * math.tan(th))
|
||||||
])
|
])
|
||||||
.circle(self.angle_joint_flange_radius)
|
.circle(self.angle_joint_flange_radius)
|
||||||
.reset()
|
.reset()
|
||||||
.regularPolygon(self.side_width_inner, self.n_side, mode="i")
|
.regularPolygon(self.side_width_inner, self.n_side, mode="i")
|
||||||
)
|
.finalize()
|
||||||
flange = (
|
|
||||||
Cq.Workplane()
|
|
||||||
.placeSketch(flange)
|
|
||||||
.extrude(self.angle_joint_flange_thickness)
|
.extrude(self.angle_joint_flange_thickness)
|
||||||
.translate((0, 0, -self.angle_joint_flange_thickness/2))
|
.translate((0, 0, -self.angle_joint_flange_thickness/2))
|
||||||
)
|
)
|
||||||
|
@ -979,6 +1040,7 @@ class Onbashira(Model):
|
||||||
self.assembly_ring(self.angle_joint_chamber_back()),
|
self.assembly_ring(self.angle_joint_chamber_back()),
|
||||||
name="chamber_back",
|
name="chamber_back",
|
||||||
)
|
)
|
||||||
|
.add(self.assembly_barrel(), name="barrel")
|
||||||
)
|
)
|
||||||
for i in range(self.n_side):
|
for i in range(self.n_side):
|
||||||
j = (i + 1) % self.n_side
|
j = (i + 1) % self.n_side
|
||||||
|
@ -993,6 +1055,11 @@ class Onbashira(Model):
|
||||||
f"chamber_back/side{i}?holeLSO{ih}",
|
f"chamber_back/side{i}?holeLSO{ih}",
|
||||||
"Plane",
|
"Plane",
|
||||||
)
|
)
|
||||||
|
a = a.constrain(
|
||||||
|
f"barrel/stator2?holeB{i}",
|
||||||
|
f"ring1/side{i}?holeStatorR",
|
||||||
|
"Plane",
|
||||||
|
)
|
||||||
for (nl, nc, nr) in [
|
for (nl, nc, nr) in [
|
||||||
("section1", "ring1", "section2"),
|
("section1", "ring1", "section2"),
|
||||||
("section2", "ring2", "section3"),
|
("section2", "ring2", "section3"),
|
||||||
|
@ -1009,7 +1076,5 @@ class Onbashira(Model):
|
||||||
f"{nc}/side{i}?holeRSM{ih}",
|
f"{nc}/side{i}?holeRSM{ih}",
|
||||||
"Plane",
|
"Plane",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
a = a.add(self.assembly_rotor(), name="rotor")
|
|
||||||
return a.solve()
|
return a.solve()
|
||||||
|
|
Loading…
Reference in New Issue