meshlabxml/create.py
def icosphere(script, radius=1.0, diameter=None, subdivisions=3, color=None):
    """create an icosphere mesh

    radius Radius of the sphere
    # subdivisions = Subdivision level; Number of the recursive subdivision of the
    # surface. Default is 3 (a sphere approximation composed by 1280 faces).
    # Admitted values are in the range 0 (an icosahedron) to 8 (a 1.3 MegaTris
    # approximation of a sphere). Formula for number of faces: F=20*4^subdiv
    # color = specify a color name to apply vertex colors to the newly
    # created mesh"""
    if diameter is not None:
        radius = diameter / 2
    filter_xml = ''.join([
        '  <filter name="Sphere">\n',
        '    <Param name="radius" ',
        'value="%s" ' % radius,
        'description="Radius" ',
        'type="RichFloat" ',
        '/>\n',
        '    <Param name="subdiv" ',
        'value="%d" ' % subdivisions,
        'description="Subdiv. Level" ',
        'type="RichInt" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    if isinstance(script, FilterScript):
        script.add_layer('Sphere', change_layer=True)
    if color is not None:
        vert_color.function(script, color=color)
    return None
def icosphere(script, radius=1.0, diameter=None, subdivisions=3, color=None):
    """create an icosphere mesh

    radius Radius of the sphere
    # subdivisions = Subdivision level; Number of the recursive subdivision of the
    # surface. Default is 3 (a sphere approximation composed by 1280 faces).
    # Admitted values are in the range 0 (an icosahedron) to 8 (a 1.3 MegaTris
    # approximation of a sphere). Formula for number of faces: F=20*4^subdiv
    # color = specify a color name to apply vertex colors to the newly
    # created mesh"""
    if diameter is not None:
        radius = diameter / 2
    filter_xml = ''.join([
        '  <filter name="Sphere">\n',
        '    <Param name="radius" ',
        'value="%s" ' % radius,
        'description="Radius" ',
        'type="RichFloat" ',
        '/>\n',
        '    <Param name="subdiv" ',
        'value="%d" ' % subdivisions,
        'description="Subdiv. Level" ',
        'type="RichInt" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    if isinstance(script, FilterScript):
        script.add_layer('Sphere', change_layer=True)
    if color is not None:
        vert_color.function(script, color=color)
    return None
def icosphere ( script , radius = 1.0 , diameter = None , subdivisions = 3 , color = None ) : if diameter is not None : radius = diameter / 2 filter_xml = '' . join ( [ '  <filter name="Sphere">\n' , '    <Param name="radius" ' , 'value="%s" ' % radius , 'description="Radius" ' , 'type="RichFloat" ' , '/>\n' , '    <Param name="subdiv" ' , 'value="%d" ' % subdivisions , 'description="Subdiv. Level" ' , 'type="RichInt" ' , '/>\n' , '  </filter>\n' ] ) util . write_filter ( script , filter_xml ) if isinstance ( script , FilterScript ) : script . add_layer ( 'Sphere' , change_layer = True ) if color is not None : vert_color . function ( script , color = color ) return None
create an icosphere mesh

    radius Radius of the sphere
    # subdivisions = Subdivision level; Number of the recursive subdivision of the
    # surface. Default is 3 (a sphere approximation composed by 1280 faces).
    # Admitted values are in the range 0 (an icosahedron) to 8 (a 1.3 MegaTris
    # approximation of a sphere). Formula for number of faces: F=20*4^subdiv
    # color = specify a color name to apply vertex colors to the newly
    # created mesh
create an icosphere mesh