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)))
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)))
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)))
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)))
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)))
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()
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()
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)))
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)))
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()
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)))
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()
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)))
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)))
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()
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()
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)))
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)))
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()
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)))
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)))
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()
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)))
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])