Skip to content

compas_cadwork.scene ¤

Classes¤

BeamSceneObject deprecated ¤

BeamSceneObject(item: Beam, **kwargs)
Deprecated

Subject to removal, avoid using

Scene object for COMPAS Timber Beam objects.

Parameters:

  • item (:class:`compas_timber.elements.Beam`) –

    The beam object.

Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Methods:¤

draw ¤
draw()
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Draw the beam object in the scene.

Returns:

  • list –

    List of drawn element ids.

CadworkSceneObject deprecated ¤

CadworkSceneObject(item=None, name=None, color=None, opacity=1.0, show=True, transformation=None, context=None, **kwargs)
Deprecated

Subject to removal, avoid using

Base class for all of cadwork's SceneObject.

Attributes¤

DRAWN_ELEMENTS class-attribute instance-attribute ¤
DRAWN_ELEMENTS = []
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Methods:¤

add_element ¤
add_element(element_id) -> Element
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Records the given element_id to track elements added by the :class:~compas_cadwork.scene.CadworkSceneObject.

Parameters:

  • element_id (int) –

    The element ID to add to tracking.

clear classmethod ¤
clear(*args, **kwargs)
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Removes all elements tracked by the :class:~compas_cadwork.scene.CadworkSceneObject from the cadwork model.

refresh classmethod ¤
refresh()
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Camera deprecated ¤

Camera(frame: Frame, fov: float, fwidth: float, fheight: float, target: Point, projection_type: ProjectionType)
Deprecated

Subject to removal, avoid using

This class is a wrapper for cadwork's camera data which allows to get information and manipulate the camera settings in an object-oriented way.

..note:: While the cadwork document might use millimeters as the unit of length, the camera data is expected in meters. The caller is responsible for converting the data to the correct unit before passing it to the camera.

Parameters:

  • frame (Frame) –

    Position and orientation of the camera.

  • fov (float) –

    The field of view of the camera.

  • fwidth (float) –

    The field width of the camera.

  • fheight (float) –

    The field height of the camera.

  • target (Point) –

    The point the camera is looking at.

  • projection_type (ProjectionType) –

    The projection type of the camera.

Attributes:

  • frame (:class:`~compas.geometry.Frame`, read-only) –

    Position and orientation of the camera.

  • fov ((float, read - only)) –

    The field of view of the camera.

  • fov_width ((float, read - only)) –

    The field width of the camera.

  • fov_height ((float, read - only)) –

    The field height of the camera.

  • position (Point) –

    The position of the camera.

  • target (Point) –

    The point the camera is looking at.

  • up_vector (Vector) –

    The up vector of the camera.

Examples:

>>> from compas_cadwork.scene import Camera
>>> camera = Camera.from_activedoc()
>>> camera.position
Point(0.0, 0.0, 0.0)
>>> # Set the camera position to the center of the active element and zoom to it:
>>> length = element.length * 0.001
>>> target = element.midpoint * 0.001
>>> location = target + element.frame.zaxis * length
>>> camera = Camera.from_activedoc()
>>> camera.look_at(target, up_vector=element.frame.xaxis)
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Attributes¤

__data__ property ¤
__data__: dict[str, Any]
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
fov property ¤
fov: float
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
fov_height property ¤
fov_height: float
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
fov_width property ¤
fov_width: float
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
frame property ¤
frame: Frame
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
position property writable ¤
position: Point
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
target property writable ¤
target: Point
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
up_vector property ¤
up_vector: Vector
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Methods:¤

__repr__ ¤
__repr__() -> str
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026
apply_camera ¤
apply_camera() -> None
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Apply the camera settings to the currently active cadwork document.

from_activedoc classmethod ¤
from_activedoc() -> Camera
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Create a camera from the camera in the currently active cadwork document.

Returns:

  • Camera –

    The camera object created from the active cadwork document.

look_at ¤
look_at(target: Point, up_vector: Vector) -> None
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Set the camera to look at a specific target point.

Raises:

  • ValueError –

    If the up vector and the camera-to-target vector are not orthogonal.

Parameters:

  • target (Point) –

    The point the camera should look at.

  • up_vector (Vector) –

    The up vector of the camera.

reload_camera ¤
reload_camera() -> None
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Load the camera settings from the currently active cadwork document.

reset_view ¤
reset_view() -> None
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Reset the camera to the standard axonometric view.

zoom_active_element ¤
zoom_active_element() -> None
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Zoom the camera to the currently active element.

LinearDimensionSceneObject deprecated ¤

LinearDimensionSceneObject(item: LinearDimension, **kwargs)
Deprecated

Subject to removal, avoid using

Draw a linear dimension instruction.

Parameters:

  • linear_dimension (:class:`~monosashi.sequencer.LineraDimension`) –

    The linear dimension to draw.

Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Methods:¤

draw ¤
draw(*args, **kwargs)
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Adds a new dimension to the cadwork document.

Returns:

  • int –

    cadwork element ID of the added dimension.

Text3dSceneObject deprecated ¤

Text3dSceneObject(item: Text3d, **kwargs)
Deprecated

Subject to removal, avoid using

Draws a 3d text volume instruction onto the view.

Parameters:

  • text_instruction (:class:`~monosashi.sequencer.Text3d`) –

    The text instruction to draw.

Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Methods:¤

draw ¤
draw(*args, **kwargs)
Software compatibility:
✅ Cadwork 2024✅ Cadwork 2025✅ Cadwork 2026

Adds a text element with the text included in the provided text instruction.

Returns:

  • int –

    cadwork element ID of the added text.