Esempio n. 1
0
def callback(forcediagram, k, args):
    if k % 5:
        current_flatness = volmesh_face_flatness(forcediagram)
        face_colordict   = compare_initial_current(current_flatness,
                                                   initial_flatness,
                                                   color_scheme=i_to_red)
        conduit.face_colordict = face_colordict
        conduit.redraw()
Esempio n. 2
0
    def check_eq(self):
        ftol = self.scene.settings['3GS']['tol.flatness']
        fmax = max(volmesh_face_flatness(self.diagram).values())

        atol = self.scene.settings['3GS']['tol.angles']
        halffaces = list(self.diagram.faces())
        amax = max(self.diagram.faces_attribute('_a', faces=halffaces))

        if fmax > ftol or amax > atol:
            self.settings['_is.valid'] = False
        if fmax < ftol and amax < atol:
            self.settings['_is.valid'] = True
forcediagram.draw()

# ------------------------------------------------------------------------------
# 2. pick vertices to fix
# ------------------------------------------------------------------------------
rs.EnableRedraw(True)

vkeys = VolMeshSelector.select_vertices(forcediagram,
                                        message='Select vertices to fix:')

# ------------------------------------------------------------------------------
# 3. planarise
# ------------------------------------------------------------------------------
forcediagram.clear()

initial_flatness = volmesh_face_flatness(forcediagram)

# conduit
conduit = VolmeshConduit(forcediagram)


def callback(forcediagram, k, args, refreshrate=10):
    if k % refreshrate:
        return
    current_flatness = volmesh_face_flatness(forcediagram)
    face_colordict = compare_initial_current(current_flatness,
                                             initial_flatness,
                                             color_scheme=i_to_red)
    conduit.face_colordict = face_colordict
    conduit.redraw()