Ejemplo n.º 1
0
    def assembly_move_vertex(self):
        key = AssemblyHelper.select_vertex(self.assembly)
        if key is None:
            return

        block = self.assembly.blocks[key]

        xyz_before = self.assembly.get_vertex_attributes(key, 'xyz')
        AssemblyHelper.move_vertex(self.assembly, key)
        xyz_after = self.assembly.get_vertex_attributes(key, 'xyz')

        translation = subtract_vectors(xyz_after, xyz_before)

        for key, attr in block.vertices(True):
            attr['x'] += translation[0]
            attr['y'] += translation[1]
            attr['z'] += translation[2]

        self.assembly.draw(self.settings['layer'])
Ejemplo n.º 2
0
# draw blocks
# ==============================================================================

artist.draw_blocks()
artist.draw_vertices(color={
    key: '#ff0000'
    for key in assembly.vertices_where({'is_support': True})
})

artist.redraw()

# ==============================================================================
# identify support
# ==============================================================================

key = AssemblyHelper.select_vertex(
    assembly, "Select the vertex representing the support block.")

if key is not None:
    assembly.set_vertex_attribute(key, 'is_support', True)

# ==============================================================================
# draw blocks
# ==============================================================================

artist.clear_vertices()
artist.draw_vertices(color={
    key: '#ff0000'
    for key in assembly.vertices_where({'is_support': True})
})

artist.redraw()