meshlabxml/select.py
def vert_function(script, function='(q < 0)', strict_face_select=True):
    """Boolean function using muparser lib to perform vertex selection over current mesh.

    See help(mlx.muparser_ref) for muparser reference documentation.

    It's possible to use parenthesis, per-vertex variables and boolean operator:
        (, ), and, or, <, >, =
    It's possible to use the following per-vertex variables in the expression:

    Variables:
        x, y, z (coordinates)
        nx, ny, nz (normal)
        r, g, b, a (color)
        q (quality)
        rad
        vi (vertex index)
        vtu, vtv (texture coordinates)
        ti (texture index)
        vsel (is the vertex selected? 1 yes, 0 no)
        and all custom vertex attributes already defined by user.

    Args:
        script: the FilterScript object or script filename to write
            the filter] to.
        function (str): a boolean function that will be evaluated in order
            to select a subset of vertices. Example: (y > 0) and (ny > 0)
        strict_face_select (bool): if True a face is selected if ALL its
            vertices are selected. If False a face is selected if at least
            one of its vertices is selected. ML v1.3.4BETA only; this is
            ignored in 2016.12. In 2016.12 only vertices are selected.

    Layer stack:
        No impacts

    MeshLab versions:
        2016.12
        1.3.4BETA
    """
    if script.ml_version == '1.3.4BETA':
        strict_select = ''.join([
            '    <Param name="strictSelect" ',
            'value="{}" '.format(str(strict_face_select).lower()),
            'description="Strict face selection" ',
            'type="RichBool" ',
            '/>\n',
            ])
    else:
        strict_select = ''

    filter_xml = ''.join([
        '  <filter name="Conditional Vertex Selection">\n',
        '    <Param name="condSelect" ',
        'value="{}" '.format(str(function).replace('&', '&amp;').replace('<', '&lt;')),
        'description="boolean function" ',
        'type="RichString" ',
        '/>\n',
        strict_select,
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    return None
def vert_function(script, function='(q < 0)', strict_face_select=True):
    if script.ml_version == '1.3.4BETA':
        strict_select = ''.join([
            '    <Param name="strictSelect" ',
            'value="{}" '.format(str(strict_face_select).lower()),
            'description="Strict face selection" ',
            'type="RichBool" ',
            '/>\n',
            ])
    else:
        strict_select = ''

    filter_xml = ''.join([
        '  <filter name="Conditional Vertex Selection">\n',
        '    <Param name="condSelect" ',
        'value="{}" '.format(str(function).replace('&', '&amp;').replace('<', '&lt;')),
        'description="boolean function" ',
        'type="RichString" ',
        '/>\n',
        strict_select,
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    return None
def vert_function ( script , function = '(q < 0)' , strict_face_select = True ) : if script . ml_version == '1.3.4BETA' : strict_select = '' . join ( [ '    <Param name="strictSelect" ' , 'value="{}" ' . format ( str ( strict_face_select ) . lower ( ) ) , 'description="Strict face selection" ' , 'type="RichBool" ' , '/>\n' , ] ) else : strict_select = '' filter_xml = '' . join ( [ '  <filter name="Conditional Vertex Selection">\n' , '    <Param name="condSelect" ' , 'value="{}" ' . format ( str ( function ) . replace ( '&' , '&amp;' ) . replace ( '<' , '&lt;' ) ) , 'description="boolean function" ' , 'type="RichString" ' , '/>\n' , strict_select , '  </filter>\n' ] ) util . write_filter ( script , filter_xml ) return None
Boolean function using muparser lib to perform vertex selection over current mesh.

    See help(mlx.muparser_ref) for muparser reference documentation.

    It's possible to use parenthesis, per-vertex variables and boolean operator:
        (, ), and, or, <, >, =
    It's possible to use the following per-vertex variables in the expression:

    Variables:
        x, y, z (coordinates)
        nx, ny, nz (normal)
        r, g, b, a (color)
        q (quality)
        rad
        vi (vertex index)
        vtu, vtv (texture coordinates)
        ti (texture index)
        vsel (is the vertex selected? 1 yes, 0 no)
        and all custom vertex attributes already defined by user.

    Args:
        script: the FilterScript object or script filename to write
            the filter] to.
        function (str): a boolean function that will be evaluated in order
            to select a subset of vertices. Example: (y > 0) and (ny > 0)
        strict_face_select (bool): if True a face is selected if ALL its
            vertices are selected. If False a face is selected if at least
            one of its vertices is selected. ML v1.3.4BETA only; this is
            ignored in 2016.12. In 2016.12 only vertices are selected.

    Layer stack:
        No impacts

    MeshLab versions:
        2016.12
        1.3.4BETA
Boolean function using muparser lib to perform vertex selection over current mesh .