cqparts_fasteners.fasteners package¶
Submodules¶
cqparts_fasteners.fasteners.base module¶
-
class
cqparts_fasteners.fasteners.base.
Fastener
(*largs, **kwargs)¶ Bases:
cqparts.assembly.Assembly
ParametricObject
constructor parameters:Parameters: parts ( list
ofPart
instances) – List of parts being fastened-
class
Applicator
(evaluator, selector, parent=None)¶ Bases:
object
The applicator performs 2 roles to apply a fastener to workpieces
- Translate & rotate given fastener
- Change workpieces to suit a given fastener
Translation is done first because the fastener is sometimes used as a cutting tool to subtract from mating part(s) (eg: thread tapping).
-
__init__
(evaluator, selector, parent=None)¶ Parameters:
-
apply_alterations
()¶ Apply alterations to relevant parts based on the selected parts
-
class
Evaluator
(parts, parent=None)¶ Bases:
object
An evaluator determines which parts may be effected by a fastener, and how.
-
__init__
(parts, parent=None)¶ Parameters: - parts (list of
cqparts.Part
) – parts involved in fastening - parent (
Fastener
) – parent object
- parts (list of
-
eval
¶ Return the result of
perform_evaluation()
, and buffer it so it’s only run once perEvaluator
instance.Returns: result from perform_evaluation()
-
perform_evaluation
()¶ Evaluate the given parts using any additional parameters passed to this instance.
Note
Override this function in your evaluator class to assess what parts are effected, and how.
Default behaviour: do nothing, return nothing
Returns: None
-
-
class
Selector
(evaluator, parent=None)¶ Bases:
object
Facilitates the selection and placement of a fastener’s components based on an evaluation.
Each selector instance has an
Evaluator
for reference, and must have both the methodsget_components()
andget_constraints()
overridden.-
__init__
(evaluator, parent=None)¶ Parameters: - evaluator (
Evaluator
) – evaluator of fastener parts - parent (
Fastener
) – parent object
- evaluator (
-
components
¶
-
constraints
¶
-
get_components
()¶ Return fastener’s components
Returns: components for the fastener Return type: dict
ofComponent
instances
-
get_constraints
()¶ Return fastener’s constraints
Returns: list of constraints Return type: list
ofConstraint
instances
-
-
make_alterations
()¶
-
make_components
()¶
-
make_constraints
()¶
-
class
cqparts_fasteners.fasteners.nutbolt module¶
-
class
cqparts_fasteners.fasteners.nutbolt.
NutAndBoltFastener
(*largs, **kwargs)¶ Bases:
cqparts_fasteners.fasteners.base.Fastener
ParametricObject
constructor parameters:Parameters: parts ( list
ofPart
instances) – List of parts being fastenedNut and Bolt fastener assembly.
Example usage can be found here: Nut & Bolt
-
class
Applicator
(evaluator, selector, parent=None)¶ Bases:
cqparts_fasteners.utils.applicator.Applicator
-
apply_alterations
()¶
-
-
Evaluator
¶ alias of
VectorEvaluator
-
class
Selector
(evaluator, parent=None)¶ Bases:
cqparts_fasteners.utils.selector.Selector
-
get_components
()¶
-
get_constraints
()¶
-
-
class
cqparts_fasteners.fasteners.screw module¶
-
class
cqparts_fasteners.fasteners.screw.
ScrewFastener
(*largs, **kwargs)¶ Bases:
cqparts_fasteners.fasteners.base.Fastener
ParametricObject
constructor parameters:Parameters: parts ( list
ofPart
instances) – List of parts being fastenedScrew fastener assembly.
Example usage can be found here: Screw
-
class
Applicator
(evaluator, selector, parent=None)¶ Bases:
cqparts_fasteners.utils.applicator.Applicator
-
apply_alterations
()¶
-
-
Evaluator
¶ alias of
VectorEvaluator
-
class
Selector
(evaluator, parent=None)¶ Bases:
cqparts_fasteners.utils.selector.Selector
-
get_components
()¶
-
get_constraints
()¶
-
ratio
= 0.8¶
-
-
class
Module contents¶
-
class
cqparts_fasteners.fasteners.
Fastener
(*largs, **kwargs)¶ Bases:
cqparts.assembly.Assembly
ParametricObject
constructor parameters:Parameters: parts ( list
ofPart
instances) – List of parts being fastened-
class
Applicator
(evaluator, selector, parent=None)¶ Bases:
object
The applicator performs 2 roles to apply a fastener to workpieces
- Translate & rotate given fastener
- Change workpieces to suit a given fastener
Translation is done first because the fastener is sometimes used as a cutting tool to subtract from mating part(s) (eg: thread tapping).
-
__init__
(evaluator, selector, parent=None)¶ Parameters:
-
apply_alterations
()¶ Apply alterations to relevant parts based on the selected parts
-
class
Evaluator
(parts, parent=None)¶ Bases:
object
An evaluator determines which parts may be effected by a fastener, and how.
-
__init__
(parts, parent=None)¶ Parameters: - parts (list of
cqparts.Part
) – parts involved in fastening - parent (
Fastener
) – parent object
- parts (list of
-
eval
¶ Return the result of
perform_evaluation()
, and buffer it so it’s only run once perEvaluator
instance.Returns: result from perform_evaluation()
-
perform_evaluation
()¶ Evaluate the given parts using any additional parameters passed to this instance.
Note
Override this function in your evaluator class to assess what parts are effected, and how.
Default behaviour: do nothing, return nothing
Returns: None
-
-
class
Selector
(evaluator, parent=None)¶ Bases:
object
Facilitates the selection and placement of a fastener’s components based on an evaluation.
Each selector instance has an
Evaluator
for reference, and must have both the methodsget_components()
andget_constraints()
overridden.-
__init__
(evaluator, parent=None)¶ Parameters: - evaluator (
Evaluator
) – evaluator of fastener parts - parent (
Fastener
) – parent object
- evaluator (
-
components
¶
-
constraints
¶
-
get_components
()¶ Return fastener’s components
Returns: components for the fastener Return type: dict
ofComponent
instances
-
get_constraints
()¶ Return fastener’s constraints
Returns: list of constraints Return type: list
ofConstraint
instances
-
-
make_alterations
()¶
-
make_components
()¶
-
make_constraints
()¶
-
class