Skip to content

Dimension Controller

dimension_controller special

add_segment(element, point)

Adds a segment to a dimension

Parameters:

Name Type Description Default
element int

element ID

required
point point_3d

point

required
Source code in dimension_controller/__init__.py
def add_segment(element: int, point: point_3d) -> None:
    """ Adds a segment to a dimension

    Args:
        element (int): element ID
        point (point_3d): point
    """

create_dimension(direction, plane_normal, distance_from_origin, dimension_points)

Creates a 3d dimension

Examples:

>>> dimension = create_dimension(point_3d(0,0,1), point_3d(1,0,0), point_3d(0,0,0), [point_3d(0,0,0), point_3d(0,0,1000)])

Parameters:

Name Type Description Default
direction point_3d

a dimension direction

required
plane_normal point_3d

plane normal

required
distance_from_origin point_3d

distance from origin (0,0,0)

required
dimension_points List[point_3d]

dimension points

required

Returns:

Type Description
int

element ID

Source code in dimension_controller/__init__.py
def create_dimension(direction: point_3d, plane_normal: point_3d, distance_from_origin: point_3d, dimension_points: List[point_3d]) -> int:
    """ Creates a 3d dimension


    Examples:
        >>> dimension = create_dimension(point_3d(0,0,1), point_3d(1,0,0), point_3d(0,0,0), [point_3d(0,0,0), point_3d(0,0,1000)])

    Args:
        direction (point_3d): a dimension direction
        plane_normal (point_3d): plane normal
        distance_from_origin (point_3d): distance from origin (0,0,0)
        dimension_points (List[point_3d]): dimension points

    Returns:
        int: element ID
    """

set_default_anchor_length(element_ids, length)

Sets the default anchor length of a dimension

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
length float

anchor length

required
Source code in dimension_controller/__init__.py
def set_default_anchor_length(element_ids: List[int], length: float) -> None:
    """ Sets the default anchor length of a dimension

    Args:
        element_ids (List[int]): dimension element IDs
        length (float): anchor length
    """

set_line_color(element_ids, color)

Sets the line color of a dimension

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
color int

color number

required
Source code in dimension_controller/__init__.py
def set_line_color(element_ids: List[int], color: int) -> None:
    """ Sets the line color of a dimension

    Args:
        element_ids (List[int]): dimension element IDs
        color (int): color number
    """

set_line_thickness(element_ids, thickness)

Sets the line thickness of a dimension

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
thickness float

line thickness

required
Source code in dimension_controller/__init__.py
def set_line_thickness(element_ids: List[int], thickness: float) -> None:
    """ Sets the line thickness of a dimension

    Args:
        element_ids (List[int]): dimension element IDs
        thickness (float): line thickness
    """

set_orientation(element_ids, view_direction, view_up_direction)

Sets the orientation of a dimension

Examples:

>>> dimension = create_dimension(point_3d(0,0,1), point_3d(1,0,0), point_3d(0,0,0), point_3d(0,0,0), [point_3d(0,0,0), point_3d(0,0,1000)])
>>> set_orientation([dimension], point_3d(1,0,0).invert(), point_3d(0,0,1))

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
view_direction point_3d

view direction

required
view_up_direction point_3d

view up direction

required
Source code in dimension_controller/__init__.py
def set_orientation(element_ids: List[int], view_direction: point_3d, view_up_direction: point_3d) -> None:
    """ Sets the orientation of a dimension

    Examples:
        >>> dimension = create_dimension(point_3d(0,0,1), point_3d(1,0,0), point_3d(0,0,0), point_3d(0,0,0), [point_3d(0,0,0), point_3d(0,0,1000)])
        >>> set_orientation([dimension], point_3d(1,0,0).invert(), point_3d(0,0,1))

    Args:
        element_ids (List[int]): dimension element IDs
        view_direction (point_3d): view direction
        view_up_direction (point_3d): view up direction
    """

set_precision(element_ids, precision)

Sets the precision of a dimension

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
precision int

precision

required
Source code in dimension_controller/__init__.py
def set_precision(element_ids: List[int], precision: int) -> None:
    """ Sets the precision of a dimension

    Args:
        element_ids (List[int]): dimension element IDs
        precision (int): precision
    """

set_text_color(element_ids, color)

Sets the text color of a dimension

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
color int

color number

required
Source code in dimension_controller/__init__.py
def set_text_color(element_ids: List[int], color: int) -> None:
    """ Sets the text color of a dimension

    Args:
        element_ids (List[int]): dimension element IDs
        color (int): color number
    """

set_text_size(element_ids, size)

Sets the text size of a dimension

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
size float

text size

required
Source code in dimension_controller/__init__.py
def set_text_size(element_ids: List[int], size: float) -> None:
    """ Sets the text size of a dimension

    Args:
        element_ids (List[int]): dimension element IDs
        size (float): text size
    """

set_total_dimension(element_ids, total_dimension)

Sets the total dimension of a dimension

Parameters:

Name Type Description Default
element_ids List[int]

dimension element IDs

required
total_dimension bool

total dimension

required
Source code in dimension_controller/__init__.py
def set_total_dimension(element_ids: List[int], total_dimension: bool) -> None:
    """ Sets the total dimension of a dimension

    Args:
        element_ids (List[int]): dimension element IDs
        total_dimension (bool): total dimension
    """

rendering: show_root_heading: false show_source: true