meshlabxml/create.py
def cube(script, size=1.0, center=False, color=None):
    """Create a cube primitive

    Note that this is made of 6 quads, not triangles
    """

    """# 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)
    if script.ml_version == '1.3.4BETA':
        filter_name = 'Box'
    else:
        filter_name = 'Box/Cube'
    filter_xml = ''.join([
        '  <filter name="{}">\n'.format(filter_name),
        '    <Param name="size" ',
        'value="1.0" ',
        'description="Scale factor" ',
        'type="RichFloat" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    if isinstance(script, FilterScript):
        script.add_layer('Cube', change_layer=True)
    transform.scale(script, value=size)
    # Box is centered on origin at creation
    if not center:
        transform.translate(script, value=[size[0]/2, size[1]/2, size[2]/2])
    if color is not None:
        vert_color.function(script, color=color)
    return None
def cube(script, size=1.0, 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)
    if script.ml_version == '1.3.4BETA':
        filter_name = 'Box'
    else:
        filter_name = 'Box/Cube'
    filter_xml = ''.join([
        '  <filter name="{}">\n'.format(filter_name),
        '    <Param name="size" ',
        'value="1.0" ',
        'description="Scale factor" ',
        'type="RichFloat" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    if isinstance(script, FilterScript):
        script.add_layer('Cube', change_layer=True)
    transform.scale(script, value=size)
    # Box is centered on origin at creation
    if not center:
        transform.translate(script, value=[size[0]/2, size[1]/2, size[2]/2])
    if color is not None:
        vert_color.function(script, color=color)
    return None
def cube ( script , size = 1.0 , 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 ) if script . ml_version == '1.3.4BETA' : filter_name = 'Box' else : filter_name = 'Box/Cube' filter_xml = '' . join ( [ '  <filter name="{}">\n' . format ( filter_name ) , '    <Param name="size" ' , 'value="1.0" ' , 'description="Scale factor" ' , 'type="RichFloat" ' , '/>\n' , '  </filter>\n' ] ) util . write_filter ( script , filter_xml ) if isinstance ( script , FilterScript ) : script . add_layer ( 'Cube' , change_layer = True ) transform . scale ( script , value = size ) # Box is centered on origin at creation if not center : transform . translate ( script , value = [ size [ 0 ] / 2 , size [ 1 ] / 2 , size [ 2 ] / 2 ] ) if color is not None : vert_color . function ( script , color = color ) return None
Create a cube primitive

    Note that this is made of 6 quads, not triangles
Create a cube primitive