Wrapper interface for CAD geometry defined by Open CASCADE Technology (OCCT). More...
#include <Occt.hpp>
Classes | |
class | Geom |
A Surface_geom that interacts with a CAD object directly. More... | |
Public Member Functions | |
Occt ()=delete | |
Don't instantiate this class. Use its static members. | |
Static Public Member Functions | |
static TopoDS_Shape | read (std::string file_name) |
Reads a CAD file. | |
static opencascade::handle< Poly_Triangulation > | read_stl (std::string file_name, double scale=constants::meter) |
Reads an STL file and returns a triangulation object. | |
static std::vector< Mat< 3, 3 > > | triangles (opencascade::handle< Poly_Triangulation >) |
Creates an array of simplices that can be used to construct a Simplex_geom<3> . | |
static std::vector< Mat< 3, 3 > > | triangles (TopoDS_Shape shape, double angle=10 *constants::degree, double deflection=huge) |
Obtains a triangulation of a CAD geometry. | |
static Simplex_geom< 3 > | triangulate (TopoDS_Shape shape, double angle=10 *constants::degree, double deflection=huge, int n_div_edge=1000) |
static std::vector< Mat< 2, 2 > > | segments (const TopoDS_Shape &, int n_segments) |
Discretizes the curves in a TopoDS_Shape into segments of a polygonal line. | |
Wrapper interface for CAD geometry defined by Open CASCADE Technology (OCCT).
The idea is to make it straightforward to take OCCT objects and turn them into objects that Hexed can work with without needing to understand the complexities of what they really mean in OCCT thinking. The main application for this is reading geometry from CAD files, but this could also be used to pipe in CAD directly from another program that uses OCCT. For usage purposes, this class is just a namespace. Don't actually instantiate it. (In fact, you shouldn't be able to, since the constructor is deleted). It is a class and not a namespace because it has private static data members to facilitate startup tasks for interacting with OCCT.
All length/position values are interpreted dimensionally. OCCT works exclusively in mm and hexed works exclusively in m, so when converting between hexed and OCCT objects all numerical values will be scaled by \( 10^{\pm3} \). That said, unless you're manually interacting with the dimensions/coordinates of the OCCT objects, all the unit conversions are automatic so you don't have to worry about it.
|
static |
Reads a CAD file.
This can then be discretized with triangles(TopoDS_Shape, double, double)
. Coordinates are interpreted dimensionally and automatically converted. Not thread safe. File format is inferred from the file extension. File extension is case insensitive. Supported formats and extensions are:
.igs
, .iges
.stp
, .step
|
static |
Reads an STL file and returns a triangulation object.
File can be in ASCII or binary format. STL files contain no unit information, so it will be assumed to be in meters by default. It will then be converted to mm for consistency with other OCCT objects. If the STL was written with a different unit in mind, you can supply that unit definition from constants.hpp
as the scale
argument and it will be effectively converted from that unit. In general, the geometry coordinates will be multiplied by scale
. Result can be piped to triangles()
to ultimately construct a Simplex_geom<3>
.
|
static |
Discretizes the curves in a TopoDS_Shape
into segments of a polygonal line.
A TopoDS_Shape
can be obtained from read()
, and the results can be used to construct a Simplex_geom<2>
.
|
static |
Creates an array of simplices that can be used to construct a Simplex_geom<3>
.
A Poly_Triangulation
can be obtained from, e.g. read_stl()
.
|
static |
Obtains a triangulation of a CAD geometry.
This is now the preferred way to interact with CAD geometry—Occt_geom
instances are unreliable. Size of the mesh is determined by angle
and deflection
, where in both cases a smaller value results in a finer mesh. Usually, it is preferable to use only angle
, since deflection
doesn't do as well at refining high-curvature regions. The result can be piped to triangles()
to fetch the elements of the triangulation.
shape | CAD object to triangulate. Can be obtained from, e.g., read() . |
angle | Max angle allowed between neighboring triangles (note that as always, angles are radian). |
deflection | Max distance allowed between points on the triangulation and the true surface. Note that this is a dimensional parameter and appropriate values will depend on the length scale of your simulation, which is why the only reasonable default is an irrelevantly large parameter. |