## Using *OpenCascadeLink*

This section shows some of the ways that *OpenCascadeLink* can be applied. To use *OpenCascadeLink,* it must first be loaded.

Since many of the OpenCascade examples interact with the finite element mesh functionality the finite element package is also loaded.

### Solid 3D Primitives

Various Wolfram Language Graphics3D primitives can be represented in *OpenCascade*. These primitives are represented as solids.

#### Ball

#### CapsuleShape

#### Cone

#### Cuboid

#### Cylinder

#### Ellipsoid

#### Hexahedron

#### Parallelepiped

#### Prism

#### Polyhedron

#### Pyramid

#### SphericalShell

#### Tetrahedron

### Surfaces Primitives

It is also possible to create instances of surface graphics primitives embedded in 3D.

#### BSplineSurface

A fully meshed ElementMesh can not be created from a non closed surface.

#### Polygon

A fully meshed ElementMesh can not be created from a non closed surface.

#### Triangle

A fully meshed ElementMesh can not be created from a non closed surface.

### Surfaces Meshes

#### ElementMesh

The conversion is computationally expensive since every surface element is mapped into an *OpenCascade* object and then sewed together.

Both, open and closed surfaces can be converted.

### Edge Primitives

It is also possible to create instances of edge graphics primitives embedded in 3D.

#### Line

A boundary ElementMesh can not be created from an *OpenCascade* shape of type wire. Wire objects can, however, be used for rotational or linear sweeps.

### Operations on Surfaces

#### SurfaceMesh

Surfaces of *OpenCascade* objects can be meshed.

"AngularDeflection" and "LinearDeflection" specify the maximum amount a segment may deviate from the true surface. The concepts are best explained with the following illustration.

"AngularDeflection" specifies the maximum deflection angle α at the end nodes of a segment while "LinearDeflection" specifies the maximum deflection to the true curve within a segment. The Automatic default for the "AngularDeflection" is set to 0.5 and the Automatic default for the "LinearDeflection" is set to 0.01. For more information please consult the OpenCascade Documentation.

"ComputeInParallel" specifies if the surface discretization should be performed on multiple CPU cores. The Automatic default is set to False.

"RelativeDeflection" specifies if the deflection is relative or absolute to the size of the geometry. The Automatic default is set to True.

To make working with *OpenCascade* and the finite element method easier a function to mesh the surface and return a boundary ElementMesh is provided.

All options that are relevant for the ElementMesh generation can be specified via "ElementMeshOptions" and options relevant for OpenCascadeShapeSurfaceMesh can be specified via "ShapeSurfaceMeshOptions".

#### Sewing

Surfaces that share edges can be sewn together.

Sewing of B-Spline surfaces with other objects is possible. However, nodes need to match.

As a further example an Ellipsoid is created from 8 BSplineSurface patches.

Note, here the ordering of the control points is important as explained further down.

A possible issue is that *OpenCascade* is sensitive to the ordering of the surfaces given for sewing. This may be tricky to note as a displayed surface might look good but when, for example, Boolean operations are performed on the object unexpected results may happen.

#### RotationalSweeps

*OpenCascde* can perform rotational sweeps. For this a surface is rotated around an axis. The rotation can be less than a full rotation.

*OpenCascde* can also perform rotational sweeps on wire objects.

#### LinearSweeps

For a linear sweep of a surface a starting point on the surface and destination point are given and the surface is swept to the destination point.

*OpenCascde* can also perform linear sweeps on wire objects.

### Boolean Operations

#### Difference

Compute geometric differences of shapes.

#### Union

Compute geometric unions of shapes.

#### Intersection

Compute geometric intersection of shapes.

Intersections can also be generated from lower dimensional region objects.

#### BooleanRegion

The *OpenCascadeLink* provides functionality to directly work with BooleanRegion objects.

As a convenience it is also possible to use OpenCascadeShape for BooleanRegion objects directly.

#### Internal boundaries

Shape sewing can also be used to generate shapes that have internal boundaries.

Note that computing the intersection returns a closed shape.

Since the intersection of the two shapes is closed by sewing that closed shape into the union of the shapes we have three internal regions. One in the cylinder on top of the cuboid, one in the cylinder that is inside the cuboid and one in the remaining cuboid.

### Fillets

*OpenCascade* provides functionality to fillet shapes.

It is also possible to fillet only selected edges.

In *OpenCasacde* every faces has access to all the edges the face is comprised of. In the case of the cube each face is connected to 4 edges. Since there are 6 faces this makes a total of 24 edges that can be addressed of which 12 are duplicated.

If the requested fillet radius is too large then the filleting will fail.

### Chamfers

Chamfers are similar to fillets. The difference is that chamfers are not rounded but planes.

### Shelling

*OpenCascade* provides functionality to shell shapes.

### De-featuring

*OpenCascade* provides functionality to de-feature shapes.

### Import/Export

*OpenCascade* can read and write various computer aided design relevant file formats. Import and Export of the these file formats is partially implemented.

#### STL Export

*OpenCascade* can export STL files.* *

#### STL Import

*OpenCascade* can import STL files.* *

#### Step Export

*OpenCascade* can export STEP files.* *

#### Step Import

*OpenCascade* can import STEP files.* *

#### BRep Export

*OpenCascade* can export BRep files.* *

#### BRep Import

*OpenCascade* can import BRep files.* *

### Possible issue

The lowest dimensional object that can be returned from an *OpenCascase* Boolean operation is that of the minimal dimension of any argument given to the Boolean operation. For example, a Boolean operation of two *OpenCascade* solids can not return an *OpenCascade* face object.

A boundary mesh can not be generated because the resulting *OpenCascade* shape intersection does not contain information on the lower dimensional face object.

Consider the case of a face and a cuboid touching.

The lowest dimensional argument to the OpenCascade Boolean intersection operation was the face object. Since the resulting operation is also a face object the object information is present in the resulting shape object and can be meshed.