Skip to content

Core

Interfaces, configuration, and exception hierarchy.

CAD Interface (Abstract Base Class)

core.cad_interface.CADInterface

Bases: ABC

Abstract interface for CAD application adapters.

connect abstractmethod

connect() -> bool

Connect to a CAD application. Try to get existing instance first, then start new if needed.

RETURNS DESCRIPTION
bool

True if connection successful, False otherwise

TYPE: bool

disconnect abstractmethod

disconnect() -> bool

Disconnect from CAD application.

RETURNS DESCRIPTION
bool

True if disconnection successful

TYPE: bool

is_connected abstractmethod

is_connected() -> bool

Check if currently connected to CAD.

RETURNS DESCRIPTION
bool

True if connected

TYPE: bool

draw_line abstractmethod

draw_line(
    start: Coordinate,
    end: Coordinate,
    layer: str = "0",
    color: str | int = "white",
    lineweight: int = 0,
    _skip_refresh: bool = False,
) -> str

Draw a line from start to end point.

PARAMETER DESCRIPTION
start

Start point (x, y) or (x, y, z)

TYPE: Coordinate

end

End point (x, y) or (x, y, z)

TYPE: Coordinate

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

lineweight

Line weight value

TYPE: int DEFAULT: 0

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_circle abstractmethod

draw_circle(
    center: Coordinate,
    radius: float,
    layer: str = "0",
    color: str | int = "white",
    lineweight: int = 0,
    _skip_refresh: bool = False,
) -> str

Draw a circle.

PARAMETER DESCRIPTION
center

Center point (x, y) or (x, y, z)

TYPE: Coordinate

radius

Circle radius

TYPE: float

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

lineweight

Line weight value

TYPE: int DEFAULT: 0

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_arc abstractmethod

draw_arc(
    center: Coordinate,
    radius: float,
    start_angle: float,
    end_angle: float,
    layer: str = "0",
    color: str | int = "white",
    lineweight: int = 0,
    _skip_refresh: bool = False,
) -> str

Draw an arc.

PARAMETER DESCRIPTION
center

Center point

TYPE: Coordinate

radius

Arc radius

TYPE: float

start_angle

Start angle in degrees

TYPE: float

end_angle

End angle in degrees

TYPE: float

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

lineweight

Line weight value

TYPE: int DEFAULT: 0

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_rectangle abstractmethod

draw_rectangle(
    corner1: Coordinate,
    corner2: Coordinate,
    layer: str = "0",
    color: str | int = "white",
    lineweight: int = 0,
    _skip_refresh: bool = False,
) -> str

Draw a rectangle from two opposite corners.

PARAMETER DESCRIPTION
corner1

First corner (x, y)

TYPE: Coordinate

corner2

Opposite corner (x, y)

TYPE: Coordinate

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

lineweight

Line weight value

TYPE: int DEFAULT: 0

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID (may be multiple for rectangle polyline)

TYPE: str

draw_polyline abstractmethod

draw_polyline(
    points: List[Coordinate],
    closed: bool = False,
    layer: str = "0",
    color: str | int = "white",
    lineweight: int = 0,
    _skip_refresh: bool = False,
) -> str

Draw a polyline through multiple points.

PARAMETER DESCRIPTION
points

List of points

TYPE: List[Coordinate]

closed

Whether to close the polyline

TYPE: bool DEFAULT: False

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

lineweight

Line weight value

TYPE: int DEFAULT: 0

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_ellipse abstractmethod

draw_ellipse(
    center: Coordinate,
    major_axis_end: Coordinate,
    minor_axis_ratio: float,
    layer: str = "0",
    color: str | int = "white",
    lineweight: int = 0,
) -> str

Draw an ellipse.

PARAMETER DESCRIPTION
center

Center point

TYPE: Coordinate

major_axis_end

End of major axis vector

TYPE: Coordinate

minor_axis_ratio

Ratio of minor to major axis (0-1)

TYPE: float

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

lineweight

Line weight value

TYPE: int DEFAULT: 0

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_text abstractmethod

draw_text(
    position: Coordinate,
    text: str,
    height: float = 2.5,
    rotation: float = 0.0,
    layer: str = "0",
    color: str | int = "white",
    _skip_refresh: bool = False,
) -> str

Add text to the drawing.

PARAMETER DESCRIPTION
position

Text position

TYPE: Coordinate

text

Text content

TYPE: str

height

Text height

TYPE: float DEFAULT: 2.5

rotation

Rotation angle in degrees

TYPE: float DEFAULT: 0.0

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_hatch abstractmethod

draw_hatch(
    boundary_points: List[Coordinate],
    pattern: str = "SOLID",
    scale: float = 1.0,
    angle: float = 0.0,
    color: str | int = "white",
    layer: str = "0",
) -> str

Create a hatch (filled area) with pattern.

PARAMETER DESCRIPTION
boundary_points

Points defining the boundary

TYPE: List[Coordinate]

pattern

Hatch pattern name (SOLID, ANGLE, CROSS, etc.)

TYPE: str DEFAULT: 'SOLID'

scale

Pattern scale

TYPE: float DEFAULT: 1.0

angle

Pattern angle in degrees

TYPE: float DEFAULT: 0.0

color

Fill color

TYPE: str | int DEFAULT: 'white'

layer

Layer name

TYPE: str DEFAULT: '0'

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

add_dimension abstractmethod

add_dimension(
    start: Coordinate,
    end: Coordinate,
    text: Optional[str] = None,
    layer: str = "0",
    color: str | int = "white",
    offset: float = 10.0,
) -> str

Add a dimension annotation.

PARAMETER DESCRIPTION
start

Start point

TYPE: Coordinate

end

End point

TYPE: Coordinate

text

Optional custom text

TYPE: Optional[str] DEFAULT: None

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

offset

Distance to offset the dimension line from the edge (default: 10.0)

TYPE: float DEFAULT: 10.0

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_spline abstractmethod

draw_spline(
    points: List[Coordinate],
    closed: bool = False,
    degree: int = 3,
    layer: str = "0",
    color: str | int = "white",
    lineweight: int = 0,
    _skip_refresh: bool = False,
) -> str

Draw a spline curve through points.

PARAMETER DESCRIPTION
points

List of control points (minimum 2)

TYPE: List[Coordinate]

closed

Whether the spline should be closed

TYPE: bool DEFAULT: False

degree

Degree of the spline (1-3, default 3 = cubic)

TYPE: int DEFAULT: 3

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

lineweight

Line weight value

TYPE: int DEFAULT: 0

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_leader abstractmethod

draw_leader(
    points: List[Coordinate],
    text: Optional[str] = None,
    text_height: float = 2.5,
    layer: str = "0",
    color: str | int = "white",
    leader_type: str = "line_with_arrow",
    _skip_refresh: bool = False,
) -> str

Draw a leader (dimension leader line) with optional text annotation.

PARAMETER DESCRIPTION
points

List of control points (minimum 2 for simple, multiple for multi-arrow)

TYPE: List[Coordinate]

text

Optional annotation text

TYPE: Optional[str] DEFAULT: None

text_height

Height of annotation text (default: 2.5)

TYPE: float DEFAULT: 2.5

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

leader_type

Type of leader: - "line_with_arrow": Straight lines with arrow (default) - "line_no_arrow": Straight lines without arrow - "spline_with_arrow": Smooth spline with arrow - "spline_no_arrow": Smooth spline without arrow

TYPE: str DEFAULT: 'line_with_arrow'

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

draw_mleader abstractmethod

draw_mleader(
    base_point: Coordinate,
    leader_groups: List[List[Coordinate]],
    text: Optional[str] = None,
    text_height: float = 2.5,
    layer: str = "0",
    color: str | int = "white",
    arrow_style: str = "_ARROW",
    _skip_refresh: bool = False,
) -> str

Draw a multi-leader with multiple arrow lines pointing to same annotation.

PARAMETER DESCRIPTION
base_point

Base point where annotation text is placed

TYPE: Coordinate

leader_groups

List of leader line paths, each with 2+ points Example: [[(0,0), (10,10)], [(0,0), (20,-5)], [(0,0), (15,20)]]

TYPE: List[List[Coordinate]]

text

Optional annotation text

TYPE: Optional[str] DEFAULT: None

text_height

Height of annotation text (default: 2.5)

TYPE: float DEFAULT: 2.5

layer

Layer name

TYPE: str DEFAULT: '0'

color

Color name or index

TYPE: str | int DEFAULT: 'white'

arrow_style

Arrow head style (default: "_ARROW") Supported: "_ARROW", "_DOT", "_CLOSED_FILLED", "_OBLIQUE", "_OPEN", etc.

TYPE: str DEFAULT: '_ARROW'

_skip_refresh

Internal flag to skip view refresh (used for batch operations)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
str

Entity handle/ID

TYPE: str

create_rectangular_array abstractmethod

create_rectangular_array(
    handles: List[str],
    rows: int,
    columns: int,
    row_spacing: float,
    column_spacing: float,
) -> List[str]

Create a rectangular array of entities.

PARAMETER DESCRIPTION
handles

Entity handles to array

TYPE: List[str]

rows

Number of rows

TYPE: int

columns

Number of columns

TYPE: int

row_spacing

Distance between rows

TYPE: float

column_spacing

Distance between columns

TYPE: float

RETURNS DESCRIPTION
List[str]

List[str]: Handles of all created copies

create_polar_array abstractmethod

create_polar_array(
    handles: List[str],
    center_x: float,
    center_y: float,
    count: int,
    angle_to_fill: float = 360.0,
    rotate_items: bool = True,
) -> List[str]

Create a polar (circular) array of entities.

PARAMETER DESCRIPTION
handles

Entity handles to array

TYPE: List[str]

center_x

X coordinate of rotation center

TYPE: float

center_y

Y coordinate of rotation center

TYPE: float

count

Number of items in the array

TYPE: int

angle_to_fill

Total angle to fill (default: 360 degrees)

TYPE: float DEFAULT: 360.0

rotate_items

Whether to rotate items as they are copied

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
List[str]

List[str]: Handles of all created copies

create_path_array abstractmethod

create_path_array(
    handles: List[str],
    path_points: List[Coordinate],
    count: int,
    align_items: bool = True,
) -> List[str]

Create an array of entities along a path.

PARAMETER DESCRIPTION
handles

Entity handles to array

TYPE: List[str]

path_points

Points defining the path

TYPE: List[Coordinate]

count

Number of items in the array

TYPE: int

align_items

Whether to align items to path direction

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
List[str]

List[str]: Handles of all created copies

create_layer abstractmethod

create_layer(
    name: str,
    color: str | int = "white",
    lineweight: int = 0,
) -> bool

Create a new layer.

PARAMETER DESCRIPTION
name

Layer name

TYPE: str

color

Layer color

TYPE: str | int DEFAULT: 'white'

lineweight

Layer lineweight

TYPE: int DEFAULT: 0

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

set_current_layer abstractmethod

set_current_layer(name: str) -> bool

Set the active/current layer.

PARAMETER DESCRIPTION
name

Layer name

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

get_current_layer abstractmethod

get_current_layer() -> str

Get the name of the current active layer.

RETURNS DESCRIPTION
str

Layer name

TYPE: str

list_layers abstractmethod

list_layers() -> List[str]

Get list of all layers in the drawing.

RETURNS DESCRIPTION
List[str]

List[str]: Layer names

rename_layer abstractmethod

rename_layer(old_name: str, new_name: str) -> bool

Rename an existing layer.

PARAMETER DESCRIPTION
old_name

Current layer name

TYPE: str

new_name

New layer name

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

RAISES DESCRIPTION
LayerError

If layer not found or cannot be renamed

delete_layer abstractmethod

delete_layer(name: str) -> bool

Delete a layer from the drawing. Cannot delete layer 0 (standard layer).

PARAMETER DESCRIPTION
name

Layer name to delete

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

RAISES DESCRIPTION
LayerError

If layer not found, is in use, or cannot be deleted

turn_layer_on abstractmethod

turn_layer_on(name: str) -> bool

Turn on (make visible) a layer.

PARAMETER DESCRIPTION
name

Layer name

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

RAISES DESCRIPTION
LayerError

If layer not found

turn_layer_off abstractmethod

turn_layer_off(name: str) -> bool

Turn off (hide) a layer.

PARAMETER DESCRIPTION
name

Layer name

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

RAISES DESCRIPTION
LayerError

If layer not found

is_layer_on abstractmethod

is_layer_on(name: str) -> bool

Check if a layer is visible (turned on).

PARAMETER DESCRIPTION
name

Layer name

TYPE: str

RETURNS DESCRIPTION
bool

True if layer is on, False if off

TYPE: bool

RAISES DESCRIPTION
LayerError

If layer not found

set_layer_color abstractmethod

set_layer_color(layer_name: str, color: str | int) -> bool

Set the color of a layer.

PARAMETER DESCRIPTION
layer_name

Name of the layer to modify

TYPE: str

color

Color name (from COLOR_MAP) or ACI index (1-255)

TYPE: str | int

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

RAISES DESCRIPTION
LayerError

If layer not found

ColorError

If color is invalid

set_entities_color_bylayer abstractmethod

set_entities_color_bylayer(
    handles: List[str],
) -> Dict[str, Any]

Set entities to use their layer's color (ByLayer).

PARAMETER DESCRIPTION
handles

List of entity handles to modify

TYPE: List[str]

RETURNS DESCRIPTION
dict

Result summary with counts and details

TYPE: Dict[str, Any]

RAISES DESCRIPTION
CADOperationError

If operation fails

save_drawing abstractmethod

save_drawing(
    filepath: str = "",
    filename: str = "",
    format: str = "dwg",
) -> bool

Save the current drawing to a file.

PARAMETER DESCRIPTION
filepath

Full path where to save (e.g., 'C:/drawings/myfile.dwg')

TYPE: str DEFAULT: ''

filename

Just the filename (e.g., 'myfile.dwg'). Uses configured output directory

TYPE: str DEFAULT: ''

format

File format (dwg, dxf, etc.). Default: dwg

TYPE: str DEFAULT: 'dwg'

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

Note
  • If both filepath and filename provided, filepath takes precedence
  • If only filename provided, saved to config output directory
  • If neither provided, uses current document name or generates timestamp-based name

open_drawing abstractmethod

open_drawing(filepath: str) -> bool

Open an existing drawing file.

PARAMETER DESCRIPTION
filepath

Path to the drawing file

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

new_drawing abstractmethod

new_drawing() -> bool

Create a new blank drawing.

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

close_drawing abstractmethod

close_drawing(save_changes: bool = False) -> bool

Close the current drawing.

PARAMETER DESCRIPTION
save_changes

Whether to save changes before closing (default: False)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

get_open_drawings abstractmethod

get_open_drawings() -> list

Get list of all open drawing filenames.

RETURNS DESCRIPTION
list

Drawing names (e.g., ["drawing1.dwg", "drawing2.dwg"])

TYPE: list

switch_drawing abstractmethod

switch_drawing(drawing_name: str) -> bool

Switch to a different open drawing.

PARAMETER DESCRIPTION
drawing_name

Name of the drawing to switch to

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

zoom_extents abstractmethod

zoom_extents() -> bool

Zoom to show all entities in view.

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

refresh_view abstractmethod

refresh_view() -> bool

Refresh/redraw the current view.

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

get_screenshot abstractmethod

get_screenshot() -> Dict[str, str]

Capture a screenshot of the CAD application window.

RETURNS DESCRIPTION
dict

Dictionary with keys: - path: Path to the temporary screenshot file - data: Base64 encoded image data (for embedding)

TYPE: Dict[str, str]

delete_entity abstractmethod

delete_entity(handle: str) -> bool

Delete an entity by its handle.

PARAMETER DESCRIPTION
handle

Entity handle/ID

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

get_entity_properties abstractmethod

get_entity_properties(handle: str) -> Dict[str, Any]

Get properties of an entity.

PARAMETER DESCRIPTION
handle

Entity handle/ID

TYPE: str

RETURNS DESCRIPTION
Dict

Entity properties

TYPE: Dict[str, Any]

set_entity_properties abstractmethod

set_entity_properties(
    handle: str, properties: Dict[str, Any]
) -> bool

Modify entity properties.

PARAMETER DESCRIPTION
handle

Entity handle/ID

TYPE: str

properties

Properties to set

TYPE: Dict[str, Any]

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

select_by_color abstractmethod

select_by_color(color: str | int) -> List[str]

Select all entities of a specific color.

PARAMETER DESCRIPTION
color

Color name or index

TYPE: str | int

RETURNS DESCRIPTION
List[str]

List[str]: List of entity handles

select_by_layer abstractmethod

select_by_layer(layer_name: str) -> List[str]

Select all entities on a specific layer.

PARAMETER DESCRIPTION
layer_name

Layer name

TYPE: str

RETURNS DESCRIPTION
List[str]

List[str]: List of entity handles

select_by_type abstractmethod

select_by_type(entity_type: str) -> List[str]

Select all entities of a specific type.

PARAMETER DESCRIPTION
entity_type

Entity type (line, circle, etc.)

TYPE: str

RETURNS DESCRIPTION
List[str]

List[str]: List of entity handles

get_selected_entities abstractmethod

get_selected_entities() -> List[str]

Get list of currently selected entities.

RETURNS DESCRIPTION
List[str]

List[str]: List of entity handles

clear_selection abstractmethod

clear_selection() -> bool

Clear current selection.

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

create_block_from_entities abstractmethod

create_block_from_entities(
    block_name: str,
    entity_handles: List[str],
    insertion_point: Coordinate = (0.0, 0.0, 0.0),
    description: str = "",
) -> Dict[str, Any]

Create a block from specified entities.

PARAMETER DESCRIPTION
block_name

Name for the new block

TYPE: str

entity_handles

List of entity handles to include in block

TYPE: List[str]

insertion_point

Base point for block definition (default: 0,0,0)

TYPE: Coordinate DEFAULT: (0.0, 0.0, 0.0)

description

Optional block description

TYPE: str DEFAULT: ''

RETURNS DESCRIPTION
Dict[str, Any]

Dict[str, Any]: Dictionary with operation status and details - success: bool - block_name: str - total_handles: int - entities_added: int - failed_handles: List[str] - insertion_point: Tuple[float, float, float]

create_block_from_selection abstractmethod

create_block_from_selection(
    block_name: str,
    insertion_point: Coordinate = (0.0, 0.0, 0.0),
    description: str = "",
) -> Dict[str, Any]

Create a block from currently selected entities.

PARAMETER DESCRIPTION
block_name

Name for the new block

TYPE: str

insertion_point

Base point for block definition (default: 0,0,0)

TYPE: Coordinate DEFAULT: (0.0, 0.0, 0.0)

description

Optional block description

TYPE: str DEFAULT: ''

RETURNS DESCRIPTION
Dict[str, Any]

Dict[str, Any]: Dictionary with operation status and details - success: bool - block_name: str - entities_added: int - insertion_point: Tuple[float, float, float]

move_entities abstractmethod

move_entities(
    handles: List[str], offset_x: float, offset_y: float
) -> bool

Move entities by an offset.

PARAMETER DESCRIPTION
handles

List of entity handles

TYPE: List[str]

offset_x

X offset

TYPE: float

offset_y

Y offset

TYPE: float

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

rotate_entities abstractmethod

rotate_entities(
    handles: List[str],
    center_x: float,
    center_y: float,
    angle: float,
) -> bool

Rotate entities around a point.

PARAMETER DESCRIPTION
handles

List of entity handles

TYPE: List[str]

center_x

Rotation center X

TYPE: float

center_y

Rotation center Y

TYPE: float

angle

Rotation angle in degrees

TYPE: float

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

scale_entities abstractmethod

scale_entities(
    handles: List[str],
    center_x: float,
    center_y: float,
    scale_factor: float,
) -> bool

Scale entities around a point.

PARAMETER DESCRIPTION
handles

List of entity handles

TYPE: List[str]

center_x

Scale center X

TYPE: float

center_y

Scale center Y

TYPE: float

scale_factor

Scale factor

TYPE: float

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

copy_entities abstractmethod

copy_entities(handles: List[str]) -> bool

Copy entities to clipboard.

PARAMETER DESCRIPTION
handles

List of entity handles

TYPE: List[str]

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

paste_entities abstractmethod

paste_entities(
    base_point_x: float, base_point_y: float
) -> List[str]

Paste entities from clipboard.

PARAMETER DESCRIPTION
base_point_x

Base point X for pasting

TYPE: float

base_point_y

Base point Y for pasting

TYPE: float

RETURNS DESCRIPTION
List[str]

List[str]: Handles of pasted entities

change_entity_color abstractmethod

change_entity_color(
    handles: List[str], color: str | int
) -> bool

Change color of entities.

PARAMETER DESCRIPTION
handles

List of entity handles

TYPE: List[str]

color

Color name or index

TYPE: str | int

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

change_entity_layer abstractmethod

change_entity_layer(
    handles: List[str], layer_name: str
) -> bool

Move entities to a different layer.

PARAMETER DESCRIPTION
handles

List of entity handles

TYPE: List[str]

layer_name

Target layer name

TYPE: str

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

undo abstractmethod

undo(count: int = 1) -> bool

Undo last action(s).

PARAMETER DESCRIPTION
count

Number of operations to undo (default: 1)

TYPE: int DEFAULT: 1

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

redo abstractmethod

redo(count: int = 1) -> bool

Redo last undone action(s).

PARAMETER DESCRIPTION
count

Number of operations to redo (default: 1)

TYPE: int DEFAULT: 1

RETURNS DESCRIPTION
bool

True if successful

TYPE: bool

normalize_coordinate staticmethod

normalize_coordinate(coord: Coordinate) -> Point

Normalize a coordinate to 3D point (x, y, z).

PARAMETER DESCRIPTION
coord

2D or 3D coordinate

TYPE: Coordinate

RETURNS DESCRIPTION
Point

3D point with z=0 if not provided

TYPE: Point

validate_lineweight

validate_lineweight(weight: int) -> int

Validate and return a proper lineweight value.

PARAMETER DESCRIPTION
weight

Proposed lineweight

TYPE: int

RETURNS DESCRIPTION
int

Valid lineweight (or default if invalid)

TYPE: int

Configuration

core.config

Centralized configuration for multiCAD-MCP server. Loads from config.json with fallback defaults.

CADConfig dataclass

Configuration for a specific CAD application.

OutputConfig dataclass

Configuration for output files.

DashboardConfig dataclass

Configuration for the web dashboard.

ServerConfig dataclass

Complete server configuration.

ConfigManager

Manages loading and accessing configuration (thread-safe singleton).

config property

config: ServerConfig

Get the loaded configuration.

reset classmethod

reset()

Reset singleton (useful for testing).

get_cad_config

get_cad_config(cad_type: str) -> CADConfig

Get configuration for a specific CAD application.

get_supported_cads

get_supported_cads() -> List[str]

Get list of supported CAD applications.

ensure_output_directory

ensure_output_directory() -> Path

Ensure output directory exists, create if needed.

get_config

get_config() -> ServerConfig

Get global configuration instance.

get_cad_config

get_cad_config(cad_type: str) -> CADConfig

Get CAD-specific configuration.

get_supported_cads

get_supported_cads() -> List[str]

Get list of supported CAD applications.

Exceptions

core.exceptions

Custom exceptions for multiCAD-MCP server. Provides domain-specific error handling for CAD operations.

MultiCADError

Bases: Exception

Base exception for all multiCAD-MCP errors.

CADConnectionError

Bases: MultiCADError

Raised when connection to CAD application fails.

CADOperationError

Bases: MultiCADError

Raised when a CAD operation fails.

InvalidParameterError

Bases: MultiCADError

Raised when invalid parameters are provided.

CoordinateError

Bases: InvalidParameterError

Raised when coordinate validation fails.

ColorError

Bases: InvalidParameterError

Raised when color specification is invalid.

LayerError

Bases: MultiCADError

Raised when layer operations fail.

CADNotSupportedError

Bases: MultiCADError

Raised when requested CAD application is not supported.

ConfigError

Bases: MultiCADError

Raised when configuration is invalid or missing.