find_free_position
Determine free coordinates on the canvas near an existing Petri net element to place a new node without overlapping. Call this before adding a place or transition to get usable x,y positions.
Instructions
Find canvas coordinates for a new element near an existing one, avoiding overlaps.
Call this BEFORE add_place or add_transition to get good x,y coordinates. Then pass those coordinates directly to add_place/add_transition.
Recommended workflow when adding a place connected to an existing element:
find_free_position(near_element_id=, direction=)
add_place(name=..., tokens=..., x=, y=)
add_arc(source_id=..., target_id=...)
Args: near_element_id: ID of the place or transition to position near (use list_elements to find IDs and current coordinates) direction: Where to place the new element relative to the anchor: "above" (same x, lower y) | "below" | "left" | "right"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| near_element_id | Yes | ||
| direction | No | above |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |