Skip to content

Model ¤

Model(name: str | None = None, verbose: bool = False)

Base model for mesh generation.

Parameters:

  • name (str | None, default: None ) –

    The name of the model.

  • verbose (bool, default: False ) –

    Flag indicating if output should be printed to the terminal.

  • options

    The meshing options.

Functions¤

curve_coordinates_at ¤

curve_coordinates_at(tag: int, u: float) -> Array3[float64]

Get the coordinates of a point on a curve in the model.

Parameters:

  • tag (int) –

    The identifier of the curve.

  • u (float) –

    The parameter of the curve.

Returns:

  • list[float]

    The coordinates of the point on the curve.

curve_domain ¤

curve_domain(tag: int) -> tuple[float, float]

Get the domain of a curve in the model.

Parameters:

  • tag (int) –

    The identifier of the curve.

Returns:

curve_to_polyline ¤

curve_to_polyline(tag: int, n: int = 100) -> Polyline

Get the coordinates of a point on a curve in the model.

Parameters:

  • tag (int) –

    The identifier of the curve.

  • n (int, default: 100 ) –

    The number of points on the curve.

Returns:

  • Polyline

    The polyline that is a discretisation of the curve.

curve_vertices ¤

curve_vertices(tag: int) -> dict[int, Array3[float64]]

Get the vertices of a curve.

Parameters:

  • tag (int) –

    The identifier of the curve.

Returns:

find_points_at_xy ¤

find_points_at_xy(xyz: list[float]) -> list[int]

Find the model points at or close to a spatial location.

Parameters:

  • xyz (list[float]) –

    The XY(Z) coordinates of the location.

Returns:

  • list[int]

    The point identifiers.

find_points_at_xyz ¤

find_points_at_xyz(xyz: list[float]) -> list[int]

Find the model points at or close to a spatial location.

Parameters:

  • xyz (list[float]) –

    The XYZ coordinates of the location.

Returns:

  • list[int]

    The point identifiers.

find_points_within_distance_of_location ¤

find_points_within_distance_of_location(location: Point, distance: float) -> list[int]

Find the model points within a distance from a given location.

Parameters:

  • location (Point) –

    The reference location.

  • distance (float) –

    The distance from the reference location.

Returns:

  • list[int]

    The tags of the found points.

find_points_within_horizontal_distance_of_location ¤

find_points_within_horizontal_distance_of_location(
    location: Point, distance: float
) -> list[int]

Find the model points within a horizontal distance from a given location.

Parameters:

  • location (Point) –

    The reference location.

  • distance (float) –

    The horizontal distance from the reference location.

Returns:

  • list[int]

    The tags of the found points.

from_brep classmethod ¤

from_brep(brep: Brep) -> Model

Construct a model from a b-rep geometry.

Parameters:

  • brep (Brep) –

    The b-rep geometry.

Returns:

from_step classmethod ¤

from_step(filepath: str) -> Model

Construct a model from the data contained in a STEP file.

Parameters:

  • filepath (str) –

    The path to the step file.

Returns:

generate_mesh ¤

generate_mesh(dim: int = 2) -> None

Generate a mesh of the current model.

Parameters:

  • dim (int, default: 2 ) –

    The dimension of the mesh.

Returns:

  • None

    The mesh is stored in the model for further refinement and optimisation. To retrieve the generated mesh, use :meth:mesh_to_compas, :meth:mesh_to_openmesh, or :meth:mesh_to_tets.

Notes

The geometry is automatically synchronised with the underlying OCC model. Therefore, there is no need to call :meth:synchronize before generating the mesh. To influence the meshing process, use the options of the model (:attr:options.mesh).

heal ¤

heal() -> None

Heal the underlying OCC model.

Returns:

  • None

mesh_node_xyz ¤

mesh_node_xyz()

Get the coordinates of the mesh nodes.

Returns:

  • dict

    A dictionary mapping node tags to node coordinates.

mesh_targetlength_at_point ¤

mesh_targetlength_at_point(tag: int, target: float) -> None

Set the target length at a particular mesh point.

Parameters:

  • tag (int) –

    The point identifier.

  • target (float) –

    The target length value.

Returns:

  • None

mesh_to_compas ¤

mesh_to_compas() -> Mesh

Convert the model mesh to a COMPAS mesh data structure.

Returns:

  • Mesh

    A COMPAS mesh.

mesh_to_openmesh ¤

mesh_to_openmesh() -> None

Convert the model mesh to a COMPAS mesh data structure.

Returns:

  • TriMesh or PolyMesh

    An OpenMesh mesh.

mesh_to_quads ¤

mesh_to_quads() -> list[list[Point]]

Convert the model mesh to a list of quads.

Returns:

mesh_to_tets ¤

mesh_to_tets() -> list[Polyhedron]

Convert the model mesh to a COMPAS mesh data structure.

Returns:

mesh_to_triangles ¤

mesh_to_triangles() -> list[list[Point]]

Convert the model mesh to a list of triangles.

Returns:

mesh_to_vertices_and_faces ¤

mesh_to_vertices_and_faces() -> tuple[dict[int, Array3[float64]], list[list[int]]]

Convert the model mesh to a COMPAS mesh data structure.

Returns:

  • tuple[dict, list]

    A tuple containing the vertices and faces of the mesh.

optimize_mesh ¤

optimize_mesh(algo: OptimizationAlgorithm = Default, niter: int = 1) -> None

Optimize the model mesh using the specified method.

Parameters:

  • algo (OptimizationAlgorithm, default: Default ) –

    The optimization algorithm to use.

  • niter (int, default: 1 ) –

    The number of iterations.

Returns:

  • None

    Optimisation is applied to the internally stored mesh.

point_coordinates ¤

point_coordinates(tag: int) -> Array3[float64]

Get the coordinates of a point in the model.

Parameters:

  • tag (int) –

    The identifier of the point.

Returns:

  • list[float]

    The coordinates of the point.

point_to_point ¤

point_to_point(tag: int) -> Point

Get the coordinates of a point in the model.

Parameters:

  • tag (int) –

    The identifier of the point.

Returns:

recombine_mesh ¤

recombine_mesh() -> None

Recombine the mesh into quadrilateral faces.

Returns:

  • None

    Recombination is applied to the internally stored mesh.

refine_mesh ¤

refine_mesh() -> None

Refine the model mesh by uniformly splitting the edges.

Returns:

  • None

    Refinement is applied to the internally stored mesh.

surface_coordinates_at ¤

surface_coordinates_at(tag: int, u: float, v: float) -> Array3[float64]

Get the coordinates of a point on a surface in the model.

Parameters:

  • tag (int) –

    The identifier of the surface.

  • u (float) –

    The first parameter of the surface.

  • v (float) –

    The second parameter of the surface.

Returns:

  • list[float]

    The coordinates of the point on the surface.

surface_curves ¤

surface_curves(tag: int) -> list[int]

Get the boundary curves of a surface in the model.

Parameters:

  • tag (int) –

    The identifier of the surface.

Returns:

  • list[int]

    The identifiers of the curves of the surface.

surface_domain ¤

surface_domain(tag: int) -> tuple[tuple[float, float], tuple[float, float]]

Get the domain of a surface in the model.

Parameters:

  • tag (int) –

    The identifier of the surface.

Returns:

surface_faces ¤

surface_faces(tag: int) -> list[list[int]]

Get the faces of a surface.

Parameters:

  • tag (int) –

    The identifier of the surface.

Returns:

surface_mesh ¤

surface_mesh(tag: int) -> Mesh

Get the mesh of a surface entity.

Parameters:

  • tag (int) –

    The identifier of the surface.

Returns:

  • class:`Mesh`

    The mesh of the surface.

surface_vertices ¤

surface_vertices(tag: int) -> dict[int, Array3[float64]]

Get the vertices of a surface.

Parameters:

  • tag (int) –

    The identifier of the surface.

Returns:

synchronize ¤

synchronize()

Syncronize the geometry with the underlying OCC model.

Returns:

  • None

volume_curves ¤

volume_curves(tag: int) -> list[int]

Get the curves of a volume in the model.

Parameters:

  • tag (int) –

    The identifier of the volume.

Returns:

  • list[int]

    The identifiers of the curves of the volume.

volume_faces ¤

volume_faces(tag: int) -> list[list[int]]

Get the faces of a volume.

Parameters:

  • tag (int) –

    The identifier of the volume.

Returns:

volume_mesh ¤

volume_mesh(tag: int) -> Mesh

Get the mesh of a volume entity.

Parameters:

  • tag (int) –

    The identifier of the volume.

Returns:

  • Mesh

    The mesh of the volume.

volume_points ¤

volume_points(tag: int) -> list[int]

Get the points of a volume in the model.

Parameters:

  • tag (int) –

    The identifier of the volume.

Returns:

  • list[int]

    The identifiers of the points of the volume.

volume_surfaces ¤

volume_surfaces(tag: int) -> list[int]

Get the surfaces of a volume in the model.

Parameters:

  • tag (int) –

    The identifier of the volume.

Returns:

  • list[int]

    The identifiers of the surfaces of the volume.

volume_tets ¤

volume_tets(tag: int) -> list[Polyhedron]

Get the tetrahedra of a volume entity.

Parameters:

  • tag (int) –

    The identifier of the volume.

Returns:

volume_vertices ¤

volume_vertices(tag: int) -> dict[int, Array3[float64]]

Get the vertices of a volume.

Parameters:

  • tag (int) –

    The identifier of the volume.

Returns: