Пример #1
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)))
Пример #2
0
def createBlockFromElements(blockId, elementType, objects=None):
    """ Create a block with elements, limiting it to a specific entity
    :param blockId: the block id
    :param elementType: the element type, eg. hex
    :param objects: list or single element id or entity ids
    :return: None
    """
    try:
        idList = _functions.listIdString(objects)
        if idList[0] == _common.BodyTypes.body:
            idList = _functions.listIdString(_functions.getEntitiesFromObject(objects, _common.BodyTypes.volume))
        cmdStr = 'block {0} {1} in {2[0]} {2[1]}'.format(blockId, elementType, idList)
    except _system.AdvCubitException:
        cmdStr = 'block {0} {1} {2}'.format(blockId, elementType, _functions.listStr(objects))
    _system.cubitCmd(cmdStr)
Пример #3
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)))
Пример #4
0
def createBlockFromElements(blockId, elementType, objects=None):
    """ Create a block with elements, limiting it to a specific entity
    :param blockId: the block id
    :param elementType: the element type, eg. hex
    :param objects: list or single element id or entity ids
    :return: None
    """
    try:
        idList = _functions.listIdString(objects)
        if idList[0] == _common.BodyTypes.body:
            idList = _functions.listIdString(
                _functions.getEntitiesFromObject(objects,
                                                 _common.BodyTypes.volume))
        cmdStr = 'block {0} {1} in {2[0]} {2[1]}'.format(
            blockId, elementType, idList)
    except _system.AdvCubitException:
        cmdStr = 'block {0} {1} {2}'.format(blockId, elementType,
                                            _functions.listStr(objects))
    _system.cubitCmd(cmdStr)