feat: Remove fixed rotation constraints
There is currently a bug when it comes to solving deeply nested assemblies. We need to come up with a solution.
This commit is contained in:
parent
e744250c6c
commit
a0ae8c91eb
|
@ -458,7 +458,7 @@ class DiskJoint(Model):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
result.faces("<Z").tag("mate")
|
result.faces("<Z").tag("mate")
|
||||||
result.copyWorkplane(Cq.Workplane('XY')).tagPlane("dir", direction="-X")
|
result.copyWorkplane(Cq.Workplane('XY')).tagPlane("dir", direction="+X")
|
||||||
result = result.faces(">Z").hole(self.radius_axle * 2)
|
result = result.faces(">Z").hole(self.radius_axle * 2)
|
||||||
|
|
||||||
# tube which holds the spring interior
|
# tube which holds the spring interior
|
||||||
|
@ -491,11 +491,11 @@ class DiskJoint(Model):
|
||||||
disk: str,
|
disk: str,
|
||||||
angle: float,
|
angle: float,
|
||||||
) -> Cq.Assembly:
|
) -> Cq.Assembly:
|
||||||
(
|
return (
|
||||||
assembly
|
assembly
|
||||||
.constrain(f"{disk}?mate_bot", f"{housing_lower}?mate", "Plane")
|
.constrain(f"{disk}?mate_bot", f"{housing_lower}?mate", "Plane")
|
||||||
.constrain(f"{disk}?mate_top", f"{housing_upper}?mate", "Plane")
|
.constrain(f"{disk}?mate_top", f"{housing_upper}?mate", "Plane")
|
||||||
.constrain(f"{housing_lower}?dirX", f"{housing_upper}?dir", "Axis")
|
.constrain(f"{housing_lower}?dirX", f"{housing_upper}?dir", "Axis", param=0)
|
||||||
.constrain(f"{housing_lower}?dirX", f"{disk}?dir", "Axis", param=angle)
|
.constrain(f"{housing_lower}?dirX", f"{disk}?dir", "Axis", param=angle)
|
||||||
.constrain(f"{housing_lower}?dirY", f"{disk}?dir", "Axis", param=angle - 90)
|
.constrain(f"{housing_lower}?dirY", f"{disk}?dir", "Axis", param=angle - 90)
|
||||||
)
|
)
|
||||||
|
@ -513,9 +513,9 @@ class DiskJoint(Model):
|
||||||
.add(self.disk(), name="disk", color=Role.CHILD.color)
|
.add(self.disk(), name="disk", color=Role.CHILD.color)
|
||||||
.add(self.housing_lower(), name="housing_lower", color=Role.PARENT.color)
|
.add(self.housing_lower(), name="housing_lower", color=Role.PARENT.color)
|
||||||
.add(self.housing_upper(), name="housing_upper", color=Role.CASING.color)
|
.add(self.housing_upper(), name="housing_upper", color=Role.CASING.color)
|
||||||
.constrain("housing_lower", "Fixed")
|
#.constrain("housing_lower", "Fixed")
|
||||||
)
|
)
|
||||||
self.add_constraints(
|
result = self.add_constraints(
|
||||||
result,
|
result,
|
||||||
housing_lower="housing_lower",
|
housing_lower="housing_lower",
|
||||||
housing_upper="housing_upper",
|
housing_upper="housing_upper",
|
||||||
|
@ -574,10 +574,10 @@ class ElbowJoint:
|
||||||
self.child_beam.beam()
|
self.child_beam.beam()
|
||||||
.add(self.disk_joint.disk(), name="disk",
|
.add(self.disk_joint.disk(), name="disk",
|
||||||
loc=flip * Cq.Location((-self.child_arm_radius, 0, -dz), (0, 0, 1), angle))
|
loc=flip * Cq.Location((-self.child_arm_radius, 0, -dz), (0, 0, 1), angle))
|
||||||
.constrain("disk", "Fixed")
|
#.constrain("disk", "Fixed")
|
||||||
.constrain("top", "Fixed")
|
#.constrain("top", "Fixed")
|
||||||
.constrain("bot", "Fixed")
|
#.constrain("bot", "Fixed")
|
||||||
.solve()
|
#.solve()
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -607,22 +607,21 @@ class ElbowJoint:
|
||||||
loc=axial_offset * Cq.Location((0, 0, housing_dz)))
|
loc=axial_offset * Cq.Location((0, 0, housing_dz)))
|
||||||
.add(connector, name="connector",
|
.add(connector, name="connector",
|
||||||
loc=axial_offset)
|
loc=axial_offset)
|
||||||
.constrain("housing", "Fixed")
|
#.constrain("housing", "Fixed")
|
||||||
.constrain("connector", "Fixed")
|
#.constrain("connector", "Fixed")
|
||||||
.solve()
|
#.solve()
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def assembly(self, angle: float = 0) -> Cq.Assembly:
|
def assembly(self, angle: float = 0) -> Cq.Assembly:
|
||||||
da = self.disk_joint.tongue_span / 2 + 180
|
|
||||||
result = (
|
result = (
|
||||||
Cq.Assembly()
|
Cq.Assembly()
|
||||||
.add(self.child_joint(), name="child", color=Role.CHILD.color)
|
.add(self.child_joint(), name="child", color=Role.CHILD.color)
|
||||||
.add(self.parent_joint_lower(), name="parent_lower", color=Role.CASING.color)
|
.add(self.parent_joint_lower(), name="parent_lower", color=Role.CASING.color)
|
||||||
.add(self.parent_joint_upper(), name="parent_upper", color=Role.PARENT.color)
|
.add(self.parent_joint_upper(), name="parent_upper", color=Role.PARENT.color)
|
||||||
#.constrain("parent_lower", "Fixed")
|
#.constrain("child/disk?mate_bot", "Fixed")
|
||||||
)
|
)
|
||||||
self.disk_joint.add_constraints(
|
result = self.disk_joint.add_constraints(
|
||||||
result,
|
result,
|
||||||
housing_lower="parent_lower",
|
housing_lower="parent_lower",
|
||||||
housing_upper="parent_upper/housing",
|
housing_upper="parent_upper/housing",
|
||||||
|
|
|
@ -364,8 +364,8 @@ class WingProfile:
|
||||||
abscissa = 200
|
abscissa = 200
|
||||||
return [
|
return [
|
||||||
(0, -abscissa),
|
(0, -abscissa),
|
||||||
(self.wrist_x - self.wrist_s * abscissa,
|
(self.wrist_x, -abscissa),
|
||||||
self.wrist_y - self.wrist_c * abscissa),
|
(self.wrist_x, self.wrist_y),
|
||||||
(self.wrist_top_x, self.wrist_top_y),
|
(self.wrist_top_x, self.wrist_top_y),
|
||||||
(0, abscissa),
|
(0, abscissa),
|
||||||
]
|
]
|
||||||
|
@ -410,9 +410,9 @@ class WingProfile:
|
||||||
profile = (
|
profile = (
|
||||||
self.profile()
|
self.profile()
|
||||||
.reset()
|
.reset()
|
||||||
.polygon(self._mask_wrist(), mode='i')
|
|
||||||
.reset()
|
|
||||||
.polygon(self._mask_elbow(), mode='s')
|
.polygon(self._mask_elbow(), mode='s')
|
||||||
|
.reset()
|
||||||
|
.polygon(self._mask_wrist(), mode='i')
|
||||||
)
|
)
|
||||||
return profile
|
return profile
|
||||||
def surface_s2(self,
|
def surface_s2(self,
|
||||||
|
|
|
@ -48,7 +48,7 @@ def tagPlane(self, tag: str,
|
||||||
else:
|
else:
|
||||||
v = Cq.Vector(direction)
|
v = Cq.Vector(direction)
|
||||||
edge = Cq.Edge.makeLine(v * (-1), v)
|
edge = Cq.Edge.makeLine(v * (-1), v)
|
||||||
self.eachpoint(edge.moved, useLocalCoordinates=True).tag(tag)
|
return self.eachpoint(edge.located, useLocalCoordinates=True).tag(tag)
|
||||||
|
|
||||||
Cq.Workplane.tagPlane = tagPlane
|
Cq.Workplane.tagPlane = tagPlane
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue