Question

Struggling to grasp Python FME APIs geometries

  • 9 November 2021
  • 2 replies
  • 2 views

I was trying to build a custom Areabuilder sort of Transformer using a PythonCaller and started digging into the documentation.

I was trying to instantiate an FMEArea/Solid/MultiArea but I keep encountering the issue where the classes are abstarct and cant be instantiated manually.

How should we go about creating let's say FMEAreas? I have my coordinates but dont seem to find any Factory/anything that could generate these objects.

I managed to create Lines from 3D coordinates but dont understand how that could result in Areas/any other geometiries.

image


2 replies

Userlevel 2
Badge +17

Hi @edidimand​,

You can create Area geometry by creating a new FMEPolygon from a boundary FMELine:

poly = fmeobjects.FMEPolygon(line)

The boundary line should be closed on itself.

I managed to create the Polygons but they do not seem to be connected since passing them to AreaBuilder creates hollow areas. From the documentation I don't see anything that checks whether it's closed. Also how come the constructor of the FMEPolygon works like this? In it's documentation says it needs an FMECurve passed and FMECurve's documentation says it's an abstract class which doesnt help much.

imageHow do these classes work? The lack of explanation in the constructors is confusing for me.

Reply