FME Geometry, PythonCaller, GenerativeArt

#main_script import fmeobjects import numpy as np from fmeobjects import FMELine, FMEPoint, FMEPolygon import numpy as np def node_garden_ring(n=10, r=1.0, thresh=0.4): a = np.linspace(0, 2*np.pi, n, endpoint=False) pts = np.c_[r*np.cos(a), r*np.sin(a)] lines = [] for i in range(n): for j in range(i+1, n): d = np.linalg.norm(pts[i] - pts[j]) if d thresh: lines.append((tuple(pts[i]), tuple(pts[j]))) return pts, lines class FeatureProcessor(object): def __init__(self): pass def input(self, feature: fmeobjects.FMEFeature): nodes, lines = node_garden_ring(n=21, r=1.0, thresh=1.8) # output the star boundary for line in lines: print(line) tri_ring = (list(map(tuple, line))) tri_line = FMELine([tuple(p) for p in tri_ring]) out_feat = fmeobjects.FMEFeature(feature) out_feat.setGeometry(tri_line) self.pyoutput(out_feat)