Asking on behalf of a customer (but it may benefit others as well).
They've recently upgraded FME and get an error in a workspace log:
DeprecationWarning: FMECurve.snip() is deprecated and will be removed in a future release. Use FMEGeometryTools.snip() instead.
After some digging we found it's in a PythonCaller inside a Custom Transformer (the LineDivider, created by
The Python code is;
import fmeobjects, math
class LineDivider(object):
def input(self, feature):
is3D = (feature.getAttribute('__linedivider.dim') == '3D')
mode = feature.getAttribute('__linedivider.mode')
value = float(feature.getAttribute('__linedivider.value'))
output = feature.getAttribute('__linedivider.output')
for attr in ['dim', 'mode', 'value', 'output']:
feature.removeAttribute('__linedivider.' + attr)
coordSys = feature.getCoordSys()
outputLines = output.startswith('Lines')
outputPoints = output.startswith('LinesAndPoints') or output.startswith('Points')
outputEndNodes = outputPoints and not output.endswith('ExceptEndNodes')
length = float(feature.performFunction('@Length(3)') if is3D else feature.performFunction('@Length(2)'))
numLines = int(round(value) if mode == 'ToNumber' else math.ceil(length / value))
len = value if mode == 'ToLength' else length / numLines
for (beg, end) in [(i * len, (i + 1) * len) for i in range(numLines)]:
geom = feature.getGeometry()
geom.snip(fmeobjects.SNIP_DISTANCE, is3D, beg, end if end < length else -1)
if outputLines:
line = feature.cloneAttributes()
line.setGeometry(geom)
line.setCoordSys(coordSys)
self.pyoutput(line)
if outputPoints and (0.0 < beg or outputEndNodes):
point = feature.cloneAttributes()
point.setGeometry(geom.getStartPoint())
point.setCoordSys(coordSys)
self.pyoutput(point)
if outputEndNodes:
geom = feature.getGeometry()
point = feature.cloneAttributes()
point.setGeometry(geom.getEndPoint())
point.setCoordSys(coordSys)
self.pyoutput(point)
Any suggestions to where we need to change the Python code would be much appreciated 😇


