Source code for genedom.StandardDomesticatorsSet

from box import Box

[docs]class StandardDomesticatorsSet: """Class to gather several domesticators defining an assembly standard. Parameters ---------- domesticators A dictionnary {name: domesticator} of PartDomesticators. """ def __init__(self, domesticators): self.domesticators = domesticators def list_overhangs(self): """Utility to list all overhangs of all domesticators in the standard (if they have overhangs)""" domesticators = list(self.domesticators.values()) overhangs = [domesticators[0].left_overhang] for d in domesticators: if hasattr(d, 'left_overhang'): for o in (d.right_overhang, d.left_overhang): if o not in overhangs: overhangs.append(o) return overhangs def record_to_domesticator(self, record): """Automatically find the right domesticator for the given part. By default this method expects that the record.id will be of the form domesticatorname_partname. """ return self.domesticators[record.id.split("_")[0]]