class Surface(dtcc.Geometry)[source]

Represents a planar surface in 3D.

Public members

calculate_bounds()[source]

Calculate the bounding box of the surface.

property xmin
property ymin
property zmin
property xmax
property ymax
property zmax
property centroid
calculate_normal() ndarray[source]

Calculate the normal of the surface.

is_planar(tol=1e-05)[source]

Check if the surface is planar.

translate(x=0, y=0, z=0)[source]

Translate the surface.

set_z(z)[source]

Set the z-coordinate of the surface.

to_polygon(simplify=0.01) Polygon[source]

Convert the surface to a Shapely Polygon.

from_polygon(polygon: Polygon, height=0)[source]

Convert a Shapely Polygon to a surface.

from_shapely(shape)[source]

Initialize the Surface from a Shapely Polygon.

to_proto() Geometry[source]

Return a protobuf representation of the Surface.

from_proto(pb: Geometry | bytes, only_surface_fields=False)[source]

Initialize Surface from a protobuf representation.

__str__() str[source]

Return str(self).

Surface(...)

Initialize self. See help(type(self)) for accurate signature.

__repr__()

Return repr(self).

__eq__(other)

Return self==value.

mesh(triangle_size=None) Mesh

Mesh a Surface object into a Mesh object.

view()

View a surface in 3D with a GLFW window.

vertices : ndarray
normal : ndarray
holes : list[ndarray]
property bounds
add_field(field: Field)[source]

Add a field to the geometry.

transform : Transform
fields : list[Field]
to_json() str

Return a JSON representation of the object.

copy(**kwargs)

Return a copy of the object.

classmethod add_methods(module, name=None)

Adds methods from a module or function to the class.

classmethod print_methods(verbose=False)

Print the methods that have been added to the class.