#main_script import fme import fmeobjects import numpy as np import random import math from fmeobjects import FMELine, FMEGeometryTools def _line_maker(start_x, start_y, _length, num_pts): array_x, array_y = [],[] _lines = [] for i in range(num_pts): TAU = 2 * math.pi angle = TAU / num_pts * i array_x.append(start_x + _length * math.cos(angle)) array_y.append(start_y + _length * math.sin(angle)) for i in range(num_pts): obj1 = [(array_x[i], array_y[i]), (array_x[(i+1) % num_pts], array_y[(i+1) % num_pts])] _lines.append(obj1) return _lines class FeatureProcessor(object): def __init__(self): pass def has_support_for(self, support_type: int): return support_type == fmeobjects.FME_SUPPORT_FEATURE_TABLE_SHIM def input(self, feature: fmeobjects.FMEFeature): x, y = feature.getAttribute('_x'), feature.getAttribute('_y') edge_num = feature.getAttribute('_count') lines = _line_maker(x, y, 100, edge_num) for i in lines: feature.setAttribute('i', str(i)) line = FMELine(i) feature.setGeometry(line) self.pyoutput(feature) def close(self): pass def process_group(self): pass