meshlabxml/create.py
def cube_open_hires_old(script, size=1.0, x_segments=1, y_segments=1, z_segments=1,
                    center=False, color=None):
    """ Creates a square open tube, e.g. a box with no top or bottom.

    Useful if you want to wrap it around and join the open ends together, forming a torus.
    """
    """# Convert size to list if it isn't already
    if not isinstance(size, list):
        size = list(size)
    # If a single value was supplied use it for all 3 axes
    if len(size) == 1:
        size = [size[0], size[0], size[0]]"""
    size = util.make_list(size, 3)

    # X sides
    grid(script, [size[0], size[2]],
         x_segments=x_segments,
         y_segments=z_segments)
    transform.rotate(script, 'x', 90)
    #transform.translate(script, [0, 0, -size[2]])
    layers.duplicate(script)
    # Rotate to correct normals
    transform.rotate(script, 'z', 180)
    transform.translate(script, [size[0], size[1], 0])

    # Y sides
    grid(script, [size[2], size[1]],
         x_segments=z_segments,
         y_segments=y_segments)
    transform.rotate(script, 'y', -90)
    #transform.rotate(script, 'z', 90)
    #transform.translate(script, [0, 0, -size[2]])
    layers.duplicate(script)
    # Rotate to correct normals
    transform.rotate(script, 'z', 180)
    transform.translate(script, [size[0], size[1], 0])

    layers.join(script)
    clean.merge_vert(script, threshold=0.00002)
    # normals.fix(script)
    if center:
        transform.translate(script, [-size[0] / 2, -size[1] / 2, -size[2] / 2])
    if color is not None:
        vert_color.function(script, color=color)
    return None
def cube_open_hires_old(script, size=1.0, x_segments=1, y_segments=1, z_segments=1,
                    center=False, color=None):
    """ Creates a square open tube, e.g. a box with no top or bottom.

    Useful if you want to wrap it around and join the open ends together, forming a torus.
    """
    """# Convert size to list if it isn't already
    if not isinstance(size, list):
        size = list(size)
    # If a single value was supplied use it for all 3 axes
    if len(size) == 1:
        size = [size[0], size[0], size[0]]"""
    size = util.make_list(size, 3)

    # X sides
    grid(script, [size[0], size[2]],
         x_segments=x_segments,
         y_segments=z_segments)
    transform.rotate(script, 'x', 90)
    #transform.translate(script, [0, 0, -size[2]])
    layers.duplicate(script)
    # Rotate to correct normals
    transform.rotate(script, 'z', 180)
    transform.translate(script, [size[0], size[1], 0])

    # Y sides
    grid(script, [size[2], size[1]],
         x_segments=z_segments,
         y_segments=y_segments)
    transform.rotate(script, 'y', -90)
    #transform.rotate(script, 'z', 90)
    #transform.translate(script, [0, 0, -size[2]])
    layers.duplicate(script)
    # Rotate to correct normals
    transform.rotate(script, 'z', 180)
    transform.translate(script, [size[0], size[1], 0])

    layers.join(script)
    clean.merge_vert(script, threshold=0.00002)
    # normals.fix(script)
    if center:
        transform.translate(script, [-size[0] / 2, -size[1] / 2, -size[2] / 2])
    if color is not None:
        vert_color.function(script, color=color)
    return None
def cube_open_hires_old ( script , size = 1.0 , x_segments = 1 , y_segments = 1 , z_segments = 1 , center = False , color = None ) : """# Convert size to list if it isn't already
    if not isinstance(size, list):
        size = list(size)
    # If a single value was supplied use it for all 3 axes
    if len(size) == 1:
        size = [size[0], size[0], size[0]]""" size = util . make_list ( size , 3 ) # X sides grid ( script , [ size [ 0 ] , size [ 2 ] ] , x_segments = x_segments , y_segments = z_segments ) transform . rotate ( script , 'x' , 90 ) #transform.translate(script, [0, 0, -size[2]]) layers . duplicate ( script ) # Rotate to correct normals transform . rotate ( script , 'z' , 180 ) transform . translate ( script , [ size [ 0 ] , size [ 1 ] , 0 ] ) # Y sides grid ( script , [ size [ 2 ] , size [ 1 ] ] , x_segments = z_segments , y_segments = y_segments ) transform . rotate ( script , 'y' , - 90 ) #transform.rotate(script, 'z', 90) #transform.translate(script, [0, 0, -size[2]]) layers . duplicate ( script ) # Rotate to correct normals transform . rotate ( script , 'z' , 180 ) transform . translate ( script , [ size [ 0 ] , size [ 1 ] , 0 ] ) layers . join ( script ) clean . merge_vert ( script , threshold = 0.00002 ) # normals.fix(script) if center : transform . translate ( script , [ - size [ 0 ] / 2 , - size [ 1 ] / 2 , - size [ 2 ] / 2 ] ) if color is not None : vert_color . function ( script , color = color ) return None
Creates a square open tube, e.g. a box with no top or bottom.

    Useful if you want to wrap it around and join the open ends together, forming a torus.
Creates a square open tube e . g . a box with no top or bottom .