Skip to content

Polygon

Polygon represents arbitrary closed shapes extracted from the drawing. It contains ordered vertex coordinates, optional arc segments, and unit metadata so you can reconstruct the outline faithfully. Polygons are used for redaction zones, inspection areas, or complex profiles that do not fit simple primitives. By storing them in a consistent format, the API enables spatial analysis like area calculations, overlap detection, or highlighting regions in visualization tools. The model also records which view or annotation produced the polygon to maintain traceability and captures confidence scores that indicate when manual validation may be beneficial. You can even combine polygons with measurement data to derive surface areas for quoting.

Bases: BaseModel

Represents a polygon area in the drawing.

PARAMETER DESCRIPTION
coordinate_space

The coordinate space used to define the polygon, such as absolute or relative.

TYPE: CoordinateSpace

coordinates

A list of x,y tuples representing the vertices of the polygon.

TYPE: list[tuple[int, int]]

Source code in werk24/models/v2/models.py
class Polygon(BaseModel):
    """
    Represents a polygon area in the drawing.
    """

    coordinate_space: CoordinateSpace = Field(
        ...,
        description="The coordinate space used to define the polygon, such as absolute or relative.",
    )
    coordinates: list[tuple[int, int]] = Field(
        ...,
        description="A list of x,y tuples representing the vertices of the polygon.",
    )