Parsed Diagram
src.drawpyo.drawio_import.drawio_parser.ParsedDiagram
dataclass
High-level diagram representation with convenient access methods.
Source code in src/drawpyo/drawio_import/drawio_parser.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
element_count
property
Total number of elements (shapes + edges).
add_to(page, offset=(0, 0), include_shapes=True, include_edges=True)
Attach diagram elements to a page, optionally applying an offset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
Page
|
Target Page instance to attach elements to |
required |
offset
|
tuple
|
(dx, dy) applied to top-level objects and edge points |
(0, 0)
|
include_shapes
|
bool
|
Whether to add shapes to the page |
True
|
include_edges
|
bool
|
Whether to add edges to the page |
True
|
Source code in src/drawpyo/drawio_import/drawio_parser.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
get_by_id(cell_id)
Get an element by its Draw.io cell ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_id
|
str
|
The Draw.io cell ID |
required |
Returns:
| Type | Description |
|---|---|
Optional[DiagramBase]
|
The diagram element or None if not found |
Source code in src/drawpyo/drawio_import/drawio_parser.py
29 30 31 32 33 34 35 36 37 38 | |