Пример #1
0
def mergeAll(*args, **kwargs):
    """ Unconditional merge command

    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('merge all {0} {1}'.format(_functions.listStr(args),
                                                _functions.listKeywordString(kwargs)))
Пример #2
0
def imprintTolerantAll(*args, **kwargs):
    """ Unconditional tolerant imprint operation

    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('imprint tolerant all {0} {1}'.format(_functions.listStr(args),
                                                           _functions.listKeywordString(kwargs)))
Пример #3
0
def scaleMesh(factor, *args, **kwargs):
    """ Scale created mesh
    :param factor: factor to scale with
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('transform mesh output scale {0} {1} {2}'.format(factor,
                                                                      _functions.listStr(args),
                                                                      _functions.listKeywordString(kwargs)))
Пример #4
0
def sectionCut(entities, plane='x', *args, **kwargs):
    """ Section cut a entity or list of entities
    :param entities: the entity or a list of entities
    :param plane: plane to cut at: x, y, z
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('section {0[0]} {0[1]} {1}plane {2} {3}'.format(_functions.listIdString(entities), plane,
                                                                     _functions.listStr(args),
                                                                     _functions.listKeywordString(kwargs)))
Пример #5
0
def rotate(entities, angle, axis='z', *args, **kwargs):
    """ Rotate a entity
    :param entities: the entity or list of entities
    :param angle: angle in degrees
    :param axis: coordinate system axis x, y, z
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('rotate {0[0]} {0[1]} angle {1} about {2} {3} {4}'.format(
        _functions.listIdString(entities), angle, axis,
        _functions.listStr(args), _functions.listKeywordString(kwargs)))
Пример #6
0
def intersect(bodies, *args, **kwargs):
    """ Create the logical AND of bodies

    :param bodies: list of bodies
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: intersected body
    """
    _system.cubitCmd('intersect {0[0]} {0[1]} {1} {2}'.format(_functions.listIdString(bodies),
                                                              _functions.listStr(args),
                                                              _functions.listKeywordString(kwargs)))
    return _transform.getLastBody()
Пример #7
0
def intersect(bodies, *args, **kwargs):
    """ Create the logical AND of bodies

    :param bodies: list of bodies
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: intersected body
    """
    _system.cubitCmd('intersect {0[0]} {0[1]} {1} {2}'.format(
        _functions.listIdString(bodies), _functions.listStr(args),
        _functions.listKeywordString(kwargs)))
    return _transform.getLastBody()
Пример #8
0
def meshQuality(entities, elementType='', *args, **kwargs):
    """ Function to check the quality of the mesh
    :param entities: list of entities or single body, None gives all
    :param elementType: mesh element type
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('quality {0[0]} {0[1]} {1} {2} {3}'.format(_functions.listIdString(entities),
                                                                elementType,
                                                                _functions.listStr(args),
                                                                _functions.listKeywordString(kwargs)))
Пример #9
0
def setInterval(entities, interval, *args, **kwargs):
    """ Set the number of intervals for a curve

    :param entities: the base curve
    :param interval: number of intervals
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('{0[0]} {0[1]} interval {1} {2} {3}'.format(_functions.listIdString(entities), interval,
                                                                 _functions.listStr(args),
                                                                 _functions.listKeywordString(kwargs)))
Пример #10
0
def sweepCurve(surface, curve, *args, **kwargs):
    """ Creates a volume by sweeping a surface along an arbitrary curve
    :param surface: source surface
    :param curve: sweep curve
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: create volume
    """
    _system.cubitCmd('Sweep surface {0} along curve {1} {2} {3}'.format(surface.id(), curve.id(),
                                                                        _functions.listStr(args),
                                                                        _functions.listKeywordString(kwargs)))
    return _transform.getLastBody()
Пример #11
0
def rotate(entities, angle, axis='z', *args, **kwargs):
    """ Rotate a entity
    :param entities: the entity or list of entities
    :param angle: angle in degrees
    :param axis: coordinate system axis x, y, z
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('rotate {0[0]} {0[1]} angle {1} about {2} {3} {4}'.format(_functions.listIdString(entities),
                                                                               angle, axis,
                                                                               _functions.listStr(args),
                                                                               _functions.listKeywordString(kwargs)))
Пример #12
0
def sweepVector(surface, vector, *args, **kwargs):
    """ Creates a volume by sweeping a surface along an arbitrary curve
    :param surface: source surface
    :param vector: vector in tuple form
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: create volume
    """
    _system.cubitCmd(
        'Sweep surface {0} vector {1[0]} {1[1]} {1[2]} {2} {3}'.format(
            surface.id(), vector, _functions.listStr(args),
            _functions.listKeywordString(kwargs)))
    return _transform.getLastBody()
Пример #13
0
def setAutoSize(entities, factor, *args, **kwargs):
    """ Set auto size on a surface or curve

    :param entities: list or single entity
    :param factor: the auto size factor
    :param propagate: flag for propagation
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('{0[0]} {0[1]} size auto factor {1} {2} {3}'.format(_functions.listIdString(entities), factor,
                                                                         _functions.listStr(args),
                                                                         _functions.listKeywordString(kwargs)))
Пример #14
0
def webcut(entities, plane='x', offset=0, *args, **kwargs):
    """
    :param entities: entities or single one to cut
    :param plane: plane: x, y, z
    :param offset: offset from origin
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd(
        'webcut {0[0]} {0[1]} with plane {1}plane offset {2} {3} {4}'.format(
            _functions.listIdString(entities), plane, offset,
            _functions.listStr(args), _functions.listKeywordString(kwargs)))
Пример #15
0
def sweepVector(surface, vector, *args, **kwargs):
    """ Creates a volume by sweeping a surface along an arbitrary curve
    :param surface: source surface
    :param vector: vector in tuple form
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: create volume
    """
    _system.cubitCmd('Sweep surface {0} vector {1[0]} {1[1]} {1[2]} {2} {3}'.format(surface.id(), vector,
                                                                                    _functions.listStr(args),
                                                                                    _functions.listKeywordString(
                                                                                        kwargs)))
    return _transform.getLastBody()
Пример #16
0
def copyReflect(entities, plane='x', *args, **kwargs):
    """ Reflect and copy a list of entities

    :param entities: list or single base entity
    :param plane: reflection plane x, y, z
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: created entity
    """
    # TODO get list of entities back
    _system.cubitCmd('{0[0]} {0[1]} copy reflect {1} {2} {3}'.format(_functions.listIdString(entities), plane,
                                                                     _functions.listStr(args),
                                                                     _functions.listKeywordString(kwargs)))
    return getLastBody()
Пример #17
0
def imprintCurve(surface, curve, *args, **kwargs):
    """ Imprint a curve onto a surface

    :param surface: Surface to imprint on
    :param curve: Curve to imprint
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd('imprint surface {0} curve {1[1]} {2} {3}'
                     .format(_functions.listIdString(surface, _common.BodyTypes.surface),
                             _functions.listIdString(curve, _common.BodyTypes.curve),
                             _functions.listStr(args),
                             _functions.listKeywordString(kwargs)))
Пример #18
0
def webcut(entities, plane='x', offset=0, *args, **kwargs):
    """
    :param entities: entities or single one to cut
    :param plane: plane: x, y, z
    :param offset: offset from origin
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    _system.cubitCmd(
        'webcut {0[0]} {0[1]} with plane {1}plane offset {2} {3} {4}'.format(_functions.listIdString(entities),
                                                                             plane, offset,
                                                                             _functions.listStr(args),
                                                                             _functions.listKeywordString(kwargs)))
Пример #19
0
def sweepDirection(surface, distance, direction='z', *args, **kwargs):
    """
    :param surface: source surface
    :param distance: distance to sweep
    :param direction: direction: x, y, z, negative: nx, ny, nz
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: created volume
    """
    _system.cubitCmd(
        'sweep surface {0} direction {1} distance {2} {3} {4}'.format(
            surface.id(), direction, distance, _functions.listStr(args),
            _functions.listKeywordString(kwargs)))
    return _transform.getLastBody()
Пример #20
0
def mesh(entities, *args, **kwargs):
    """ Meshes a body using Cubits internal meshing function, that behaves differently

    :param entities: list or single entity to mesh
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    idList = _functions.listIdString(entities)
    if idList[0] == _common.BodyTypes.body:
        idList = _functions.listIdString(_functions.getEntitiesFromObject(entities, _common.BodyTypes.volume))
    _system.cubitCmd('mesh {0[0]} {0[1]} {1} {2}'.format(idList,
                                                         _functions.listStr(args),
                                                         _functions.listKeywordString(kwargs)))
Пример #21
0
def merge(entities=None, *args, **kwargs):
    """ Merge a list of bodies

    :param entities: list of bodies or None
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    if entities is None:
        mergeAll(*args, **kwargs)
    else:
        _system.cubitCmd('merge {0[0]} {0[1]} {1} {2}'.format(_functions.listIdString(entities),
                                                              _functions.listStr(args),
                                                              _functions.listKeywordString(kwargs)))
Пример #22
0
def sweepDirection(surface, distance, direction='z', *args, **kwargs):
    """
    :param surface: source surface
    :param distance: distance to sweep
    :param direction: direction: x, y, z, negative: nx, ny, nz
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: created volume
    """
    _system.cubitCmd('sweep surface {0} direction {1} distance {2} {3} {4}'.format(surface.id(), direction, distance,
                                                                                   _functions.listStr(args),
                                                                                   _functions.listKeywordString(
                                                                                       kwargs)))
    return _transform.getLastBody()
Пример #23
0
def setMeshScheme(entities, meshScheme, *args, **kwargs):
    """ Assign a meshing scheme to a body

    :param entities: list or single entity
    :param meshScheme: the scheme
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    idList = _functions.listIdString(entities)
    if idList[0] == _common.BodyTypes.body:
        idList = _functions.listIdString(_functions.getEntitiesFromObject(entities, _common.BodyTypes.volume))
    _system.cubitCmd('{0[0]} {0[1]} scheme {1} {2} {3}'.format(idList, meshScheme,
                                                               _functions.listStr(args),
                                                               _functions.listKeywordString(kwargs)))
Пример #24
0
def sweepMesh(body, sources, targets, *args, **kwargs):
    """ set the meshing scheme of a volume to sweep

    :param body: the body
    :param sources: list/single source surface
    :param targets: list/single target surface
    :param args: additional parameters for the command: 'option'
    :param kwargs: additional parameter value pairs: option=value
    :return: None
    """
    if not isinstance(body, _system.cubitWrapper.Body) and not isinstance(body, _system.cubitWrapper.Volume):
        raise _system.AdvCubitException('Object is not a valid cubit entity "{0}"'.format(body))
    _system.cubitCmd('volume {0} scheme sweep source {1[1]} target {2[1]} {3} {4}'
                     .format(body.volumes()[0].id(),
                             _functions.listIdString(sources, _common.BodyTypes.surface),
                             _functions.listIdString(targets, _common.BodyTypes.surface),
                             _functions.listStr(args),
                             _functions.listKeywordString(kwargs)))
    mesh(body.volumes()[0])