cqparts.constraint package¶
Submodules¶
cqparts.constraint.base module¶
cqparts.constraint.constraints module¶
-
class
cqparts.constraint.constraints.Coincident(mate, to_mate)¶ Bases:
cqparts.constraint.base.ConstraintSet a component’s world coordinates of
mate.componentso thatmate.world_coords==to_mate.world_coords.To successfully determine the component’s location, the relative component must be solvable.
-
class
cqparts.constraint.constraints.Fixed(mate, world_coords=None)¶ Bases:
cqparts.constraint.base.ConstraintSets a component’s world coordinates so the given
mateis positioned and orientated to the givenworld_coords.There is only 1 possible solution.
-
__init__(mate, world_coords=None)¶ Parameters: - mate (
Mate) – mate to lock - world_coords (
CoordSystem) – world coordinates to lockmateto
Raises: TypeError – if an invalid parameter type is passed
If the
world_coordsparameter is set as aMateinstance, the mate’s.world_coordsis used.If
world_coordsisNone, the object is locked to the origin.- mate (
-
cqparts.constraint.mate module¶
-
class
cqparts.constraint.mate.Mate(component, local_coords=None)¶ Bases:
objectA mate is a coordinate system relative to a component’s origin.
-
__add__(other)¶ Parameters: other – the object being added Behaviour based on type being added:
Mate+CoordSystem:Return a copy of
selfwithotheradded to.local_coordsRaises: TypeError – if type of otheris not supported
-
__init__(component, local_coords=None)¶ Parameters: - component (
Component) – component the mate is relative to - local_coords (
CoordSystem) – coordinate system of mate relative to component’s origin
If
componentis explicitly set to None, the mate’sworld_coords()==local_coords.If
local_coordsis not set, the component’s origin is used (ie: coords at0,0,0, with no rotation)- component (
-
world_coords¶ Returns: world coordinates of mate. Return type: CoordSystemRaises: ValueError – if .componentdoes not have valid world coordinates.If
.componentisNone, then the.local_coordsare returned.
-
cqparts.constraint.solver module¶
-
cqparts.constraint.solver.solver(constraints, coord_sys=None)¶ Solve constraints. Solutions pair
Constraintinstances with their suitableCoordSystemworld coordinates.Parameters: - constraints (iterable of
Constraint) – constraints to solve - coord_sys (
CoordSystem) – coordinate system to offset solutions (default: no offset)
Returns: generator of (
Component,CoordSystem) tuples.- constraints (iterable of
Module contents¶
-
class
cqparts.constraint.Mate(component, local_coords=None)¶ Bases:
objectA mate is a coordinate system relative to a component’s origin.
-
__add__(other)¶ Parameters: other – the object being added Behaviour based on type being added:
Mate+CoordSystem:Return a copy of
selfwithotheradded to.local_coordsRaises: TypeError – if type of otheris not supported
-
__init__(component, local_coords=None)¶ Parameters: - component (
Component) – component the mate is relative to - local_coords (
CoordSystem) – coordinate system of mate relative to component’s origin
If
componentis explicitly set to None, the mate’sworld_coords()==local_coords.If
local_coordsis not set, the component’s origin is used (ie: coords at0,0,0, with no rotation)- component (
-
world_coords¶ Returns: world coordinates of mate. Return type: CoordSystemRaises: ValueError – if .componentdoes not have valid world coordinates.If
.componentisNone, then the.local_coordsare returned.
-
-
class
cqparts.constraint.Constraint¶ Bases:
objectA means to limit the relative position &/or motion of 1 or more components.
Constraints are combined and solved to set world coordinates of the components within an assembly.
-
class
cqparts.constraint.Fixed(mate, world_coords=None)¶ Bases:
cqparts.constraint.base.ConstraintSets a component’s world coordinates so the given
mateis positioned and orientated to the givenworld_coords.There is only 1 possible solution.
-
__init__(mate, world_coords=None)¶ Parameters: - mate (
Mate) – mate to lock - world_coords (
CoordSystem) – world coordinates to lockmateto
Raises: TypeError – if an invalid parameter type is passed
If the
world_coordsparameter is set as aMateinstance, the mate’s.world_coordsis used.If
world_coordsisNone, the object is locked to the origin.- mate (
-
-
class
cqparts.constraint.Coincident(mate, to_mate)¶ Bases:
cqparts.constraint.base.ConstraintSet a component’s world coordinates of
mate.componentso thatmate.world_coords==to_mate.world_coords.To successfully determine the component’s location, the relative component must be solvable.