Skip to content

Instantly share code, notes, and snippets.

@antonioshadji
Created July 27, 2024 20:13
Show Gist options
  • Save antonioshadji/512b0b52c6281e287599594d820d9a1c to your computer and use it in GitHub Desktop.
Save antonioshadji/512b0b52c6281e287599594d820d9a1c to your computer and use it in GitHub Desktop.
Generate evenly spaced connection points for rectangular draw.io diagram shapes
""" Place the resulting output into the style of a draw.io shape.
Edit Style -> paste output at end.
"""
import numpy as np
# generate connection points for draw.io shapes
hnum=16 # sections along the horizontal
vnum=4 # sections along the vertical
precision=4
points=[]
for x in np.linspace(0,1,hnum+1):
for y in np.linspace(0,1,vnum+1):
if 0 in {x, y} or 1 in {x, y}:
points.append([np.round(x,precision),np.round(y,precision)])
print(f"points={points}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment