def sew(self, *other_parts): """ Sew with other parts and rebuild all parts. :param afem.structure.entities.SurfacePart other_parts: The other part(s). :return: *True* if sewed, *False* if not. :rtype: bool """ parts = [self] + list(other_parts) shapes = [self._shape] + [part.shape for part in other_parts] tol = float(mean([shape.tol_avg for shape in shapes], dtype=float)) max_tol = max([shape.tol_max for shape in shapes]) sew = SewShape(tol=tol, max_tol=max_tol, cut_free_edges=True, non_manifold=True) for part in parts: sew.add(part.shape) sew.perform() for part in parts: if not sew.is_modified(part.shape): continue mod_shape = sew.modified(part.shape) part.set_shape(mod_shape) return True
def __init__(self, parts, tol=None, max_tol=None): parts = list(parts) shapes = [part.shape for part in parts] if tol is None: tol = mean([shape.tol_avg for shape in shapes], dtype=float) if max_tol is None: max_tol = max([shape.tol_max for shape in shapes]) sew = SewShape(tol=tol, max_tol=max_tol, cut_free_edges=True, non_manifold=True) for part in parts: sew.add(part.shape) sew.perform() for part in parts: if not sew.is_modified(part.shape): continue mod_shape = sew.modified(part.shape) part.set_shape(mod_shape)