Cut (without VTK)

Description

Cut a grid (structured of unstructured) using a given geometrical shape.

Construction

import antares
myt = antares.Treatment('acut')

Parameters

  • base: antares.api.Base

    The input base to be cut.

  • coordinates: list(str)

    The variable names that define the set of coordinates. If no value is given, the default coordinate system of the base is used.

  • nb_cuts: int, default= 1

    The desired number of cuts of the same kind. It defines the length of the list of the varying arguments. Performing multiple cuts at once, ‘origin’, ‘normal’, ‘axis’, ‘angle’, ‘radius’ become lists of parameters.

  • type: str, default= ‘plane’

    The type of geometrical shape used to cut. The values are: - plane - cone - cylinder - sphere - polyline The cone is a right circular cone.

  • origin: tuple(float),

    The coordinates (tuple of 3 floats) of the origin used to define the cutting shape. Used for: - plane - cone - cylinder - sphere

  • normal: tuple(float),

    The coordinates (tuple of 3 floats) of the normal vector used to define a cutting plane (type=’plane’).

  • angle: float,

    Angle (in radian) of the cone at the apex for a cutting cone (type=’cone’).

  • radius: float,

    Radius of the cutting cylinder or sphere (type=’cylinder’ or type=’sphere’).

  • axis: tuple(float),

    The coordinates of the axis of rotation of the cutting cylinder or cone (type=’cylinder’ or type=’cone’).

    • example: axis**=[0., 0., 1.] to set ‘z’ as the axis in 3D with the cartesian **coordinates [‘x’, ‘y’, ‘z’]

    The coordinates of the extrusion direction of the cutting polyline (type=’polyline’)

    • example: axis**=[0., 0., 1.] to set ‘theta’ as the extrusion axis in 3D with the cylindrical **coordinates [‘x’, ‘r’, ‘theta’]

  • line_points: list(tuple(float)),

    List of point coordinates for type=’polyline’. Definition points must be given in the same frame of reference as the base. The points must defined a line in the space made by the coordinates except the extrusion axis.

    • example: line_points**=[(-4., 2., 0.), (1., 2., 0.)]. If ‘theta’ is the extrusion axis with **coordinates [‘x’, ‘r’, ‘theta’], then the last coordinates of points must be the same.

  • expert: dict {int: string, …}, default= {2: ‘bi’, 3: ‘tri’, 4: ‘qua’}

    Options dedicated to expert users. The dict is the set of accepted polygons in resulting mesh. Keys are the number of vertices in polygons. Values are the element types.

  • memory_mode: bool, default= False

    If True, the initial base is deleted on the fly to limit memory usage.

  • cutter: dict, default= None

    If not None, re-use the cutter from a previous cut.

  • return_cutter: bool, default= False

    If True, the treatment also returns the cutters. The returned variable is a dictionary whose keys are the zone names and the values are a list of cutters of type antares.utils.geomcut.cutter.Cutter.

  • with_families: bool, default= False

    If True, the output of the treatment contains rebuilt families based on the input base. All the families and all the levels of sub-families are rebuilt, but only attributes and Zone are transfered (not yet implemented for Boundary and Window).

Preconditions

If shared coordinates, ALL coordinates must be in the shared instant.

Requirements for cut type: - Cone: ‘angle’, ‘axis’, ‘origin’ - Cylinder: ‘axis’, ‘origin’, ‘radius’ - Plane: ‘origin’, ‘normal’ - Sphere: ‘origin’, ‘radius’ - Polyline: ‘axis’, ‘line_points’

Postconditions

If with_families is enabled, the output base contains the reconstructed families of base.

Example

The following example shows a cutting with a plane defined with the point (0., 0., 0.) and the normal vector (1., 0., 0.).

import antares
myt = antares.Treatment('acut')
myt['base'] = base
myt['type'] = 'plane'
myt['origin'] = [0., 0., 0.]
myt['normal'] = [1., 0., 0.]
cutbase = myt.execute()

Main functions

class antares.treatment.TreatmentAcut.TreatmentAcut

Define a cut treatment that does not use the VTK library.

Be aware that the interface for this treatment may not be the same as for the VTK-based cut treatment.

execute()

Execute the treatment.

Returns

an unstructured cut

Return type

antares.api.Base

Examples

Look at examples in antares/examples/treatment:

  • multicut_cylinder.py

  • multicut_plane.py

  • polyline.py