Class SceneBuilder
The SceneBuilder class provides methods to add various diagram elements. The elemnts include rectangles, diamonds, ellipses, arrows, lines, text, images, groups, and frames. Additionally, it offers serialization of the diagram to JSON and allows saving it to a file. The fluent API allows chaining method calls for a more concise code.
Methods
init
Initialize self. See help(type(self)) for accurate signature.arrow
Add an arrow element to the diagram.Arguments
| Name | Type | Description |
|---|---|---|
label |
str or Text or None |
The text label for the arrow. |
Returns
Type: Arrow
The Arrow element.
background
Set the background color of the diagram.Arguments
| Name | Type | Description |
|---|---|---|
color |
str |
The background color. |
Returns
Type: Self
The current instance of the Excaligen class.
color
Create a color object. It can be used as an argument for setting stroke and background colors.Returns
Type: Color
The Color object.
defaults
Retrieve the default parameters for elements.Returns
Type: Defaults
The Defaults parameters for elements.
diamond
Add a diamond element to the diagram.Arguments
| Name | Type | Description |
|---|---|---|
label |
str or Text or None |
The text label for the diamond. |
Returns
Type: Diamond
The Diamond element.
ellipse
Add an ellipse element to the diagram.Arguments
| Name | Type | Description |
|---|---|---|
label |
str or Text or None |
The text label for the ellipse. |
Returns
Type: Ellipse
The Ellipse element.
frame
Add a frame element to the diagram.Arguments
| Name | Type | Description |
|---|---|---|
title |
str or None |
The title of the frame. |
Returns
Type: Frame
The Frame element.
grid
Set the grid properties for the diagram.Arguments
| Name | Type | Description |
|---|---|---|
size |
int |
The size of the grid. |
step |
int |
The step size of the grid. |
enabled |
bool |
Whether the grid is enabled. |
Returns
Type: Self
The current instance of the Excaligen class.
group
Generate a group (virtual container).Returns
Type: Group
The Group container.
image
Add an image element to the diagram.Returns
Type: Image
The Image element.
json
Serialize the diagram to a JSON string.Returns
Type: str
The JSON representation of the diagram.
line
Add a line element to the diagram.Returns
Type: Line
The Line element.
rectangle
Add a rectangle element to the diagram.Arguments
| Name | Type | Description |
|---|---|---|
label |
str or Text or None |
The text label for the rectangle. |
Returns
Type: Rectangle
The Rectangle element.
save
Save the current diagram to a file.Arguments
| Name | Type | Description |
|---|---|---|
file |
str |
The path to the file where the diagram will be saved. |
Returns
Type: Self
The current instance of the Excaligen class.
text
Add a text element to the diagram.Arguments
| Name | Type | Description |
|---|---|---|
text |
str or None |
The text string. |
Returns
Type: Text
The Text element.