Skip to content

Entity Mixin

Low-level entity property access and deletion by handle.

adapters.mixins.entity_mixin.EntityMixin

Mixin for entity property operations.

delete_entity

delete_entity(handle: str) -> bool

Delete a drawing entity identified by its COM handle.

PARAMETER DESCRIPTION
handle

The entity handle string as returned by AutoCAD COM.

TYPE: str

RETURNS DESCRIPTION
bool

True if deleted successfully, False otherwise.

get_entity_properties

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

Retrieve common properties of a drawing entity via COM.

PARAMETER DESCRIPTION
handle

The entity handle string as returned by AutoCAD COM.

TYPE: str

RETURNS DESCRIPTION
Dict[str, Any]

Dictionary with keys: handle, object_name, layer, color, lineweight.

Dict[str, Any]

Returns an empty dict if the entity cannot be accessed.

set_entity_properties

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

Modify one or more properties of a drawing entity via COM.

Supported keys in properties: layer (str), color (str or int ACI index), lineweight (int).

PARAMETER DESCRIPTION
handle

The entity handle string as returned by AutoCAD COM.

TYPE: str

properties

Dictionary of property names to new values.

TYPE: Dict[str, Any]

RETURNS DESCRIPTION
bool

True if the update succeeded, False otherwise.