mapteksdk.data.facets module¶
This module contains data types where the distinguishing trait is its use of facet primitives.
There is only one such data type at this time which is Surface.
-
class
mapteksdk.data.facets.
Surface
(object_id=None, lock_type=<LockType.READWRITE: 2>)¶ Bases:
mapteksdk.data.primitives.point_properties.PointProperties
,mapteksdk.data.primitives.edge_properties.EdgeProperties
,mapteksdk.data.primitives.facet_properties.FacetProperties
,mapteksdk.data.base.Topology
Surfaces are represented by triangular facets defined by three points. This means a square or rectangle is represented by two facets, a cube is represented as twelve facets (six squares, each made of two facets). More complicated surfaces may require hundreds, thousands or more facets to be represented.
Defining a surface requires the points and the facets to be defined - the edges are automatically populated when the object is saved. A facet is a three element long list where each element is the index of a point, for example the facet [0, 1, 4] would indicate the facet is the triangle between points 0, 1 and 4.
Notes
The edges of a facet network are derived from the points and facets and cannot be directly set.
Examples
Creating a pyramid with a square base.
>>> from mapteksdk.project import Project >>> from mapteksdk.data import Surface >>> project = Project() >>> with project.new("surfaces/pyramid", Surface) as new_pyramid: >>> new_pyramid.points = [[0, 0, 0], [2, 0, 0], [2, 2, 0], >>> [0, 2, 0], [1, 1, 1]] >>> new_pyramid.facets = [[0, 1, 2], [0, 2, 3], [0, 1, 4], [1, 2, 4], >>> [2, 3, 4], [3, 0, 4]]
-
classmethod
static_type
()¶ Return the type of surface as stored in a Project.
This can be used for determining if the type of an object is a surface.
-
save
()¶ Saves the changes to the point primitives. This is called during save() of the inheriting object and should not be called manually.
- Returns
True if successful.
- Return type
bool
- Raises
Exception – If in read-only mode.
-
classmethod