Skip to main content
Question

FMECurve.snip() function deprecation

  • April 20, 2026
  • 3 replies
  • 16 views

redgeographics
Celebrity
Forum|alt.badge.img+62

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 ​@takashi in 2014).

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 😇

3 replies

david_r
Celebrity
  • April 20, 2026

Interestingly, the current fmeobjects documentation does not mention the deprecation of the snip() method:

https://docs.safe.com/fme/html/fmepython/api/fmeobjects/geometry/_curves/fmeobjects.FMECurve.html#fmeobjects.FMECurve.snip

Neither does the FME deprecations page: https://support.safe.com/hc/en-us/articles/25407729702029-FME-Deprecations

Maybe reach out to Safe support for up to date information.


david_r
Celebrity
  • April 20, 2026

Try something like this, using the FMEGeometryTools.snip() method as suggested in the warning:

import fmeobjects, math

class LineDivider(object):
def __init__(self):
self.geomTools = fmeobjects.FMEGeometryTools()

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))
segLen = value if mode == 'ToLength' else length / numLines

sourceGeom = feature.getGeometry()

for (beg, end) in [(i * segLen, (i + 1) * segLen) for i in range(numLines)]:
snipEnd = end if end < length else -1
snipped = self.geomTools.snip(
sourceGeom, fmeobjects.SNIP_DISTANCE, is3D, beg, snipEnd
)
if outputLines:
line = feature.cloneAttributes()
line.setGeometry(snipped)
line.setCoordSys(coordSys)
self.pyoutput(line)
if outputPoints and (0.0 < beg or outputEndNodes):
point = feature.cloneAttributes()
point.setGeometry(snipped.getStartPoint())
point.setCoordSys(coordSys)
self.pyoutput(point)

if outputEndNodes:
point = feature.cloneAttributes()
point.setGeometry(sourceGeom.getEndPoint())
point.setCoordSys(coordSys)
self.pyoutput(point)

def close(self):
pass

Caveat emptor: I haven’t tested it myself :-)


ebygomm
Influencer
Forum|alt.badge.img+48
  • Influencer
  • April 20, 2026

Note, the python you’ve posted here is not the same as the python in the current iteration of the transformer (same error though).

 

Does the warning actually cause the job to fail if run on flow?