I think you could use the FMEFace class.
Here's how you can create a simple FMEFace in the PythonCreator:
import fmeobjects
class FeatureCreator(object):
    def __init__(self):
        pass
       Â
    def input(self,feature):
        newFeature = fmeobjects.FMEFeature()
        points = t(0,0,0),(1,0,0),(1,1,0)]
        mode = 0
        newFeature.setGeometry(fmeobjects.FMEFace(points,mode))
        self.pyoutput(newFeature)
       Â
    def close(self):
        pass
The points variable holds the coordinate tuples of your TIN so you just need to loop through your triangles creating FMEFaces and then you could create a MultiSurface or Mesh by passing in the newly created FMEFaces.
Also, have a look at FMETriangleFan & FMETriangleStrip, I think you can create them in a similar way and they might be useful in your scenario.
Â
Â
Hope this helps!
Based on @gerhardatsafe, here's the code adapted to the specific use case with aggregate / MultiSurface generation:
from fmeobjects import *
MY_TRIANGLES = r((0,0,0),(1,0,0),(2,1,1)), ((0,0,0),(2,1,1),(2,2,1))]
class CreateTriangles(object):
    def __init__(self):
        pass
       Â
    def input(self, feature):
        triangles = MY_TRIANGLES
       Â
        aggregate = FMEAggregate()  # or FMEMultiSurface()
        for triangle in triangles:
            # Add first vertex as last to close polygon
            vertices = list(triangle) + Âtriangle 0],]
            mode = 0
            aggregate.appendPart(FMEFace(vertices, mode))
               Â
        feature.setGeometry(aggregate)
        self.pyoutput(feature)
       Â
    def close(self):
        pass
Here's my thought on how to do it. Tin example.fmwTin Data.txt
Â
You can use a regular expression to do the string replacers but for this example it's best to show each step so it's easy to understand the basic flow.
Â
I used arbitrary data
Â
<((4, 3, 7), (2, 3, 1), (3, 2, 3), (10, 3, 7), (4, 3, 1), (2, 2, 3))]
Â
Â
Â
Â
Â
Based on @gerhardatsafe, here's the code adapted to the specific use case with aggregate / MultiSurface generation:
from fmeobjects import *
MY_TRIANGLES = r((0,0,0),(1,0,0),(2,1,1)), ((0,0,0),(2,1,1),(2,2,1))]
class CreateTriangles(object):
    def __init__(self):
        pass
       Â
    def input(self, feature):
        triangles = MY_TRIANGLES
       Â
        aggregate = FMEAggregate()  # or FMEMultiSurface()
        for triangle in triangles:
            # Add first vertex as last to close polygon
            vertices = list(triangle) + Âtriangle 0],]
            mode = 0
            aggregate.appendPart(FMEFace(vertices, mode))
               Â
        feature.setGeometry(aggregate)
        self.pyoutput(feature)
       Â
    def close(self):
        pass
This is just what I was hoping for David. I will give this a testing. Part of my struggle was adding that extra vertex. I really need to play with Python more. I think it can add so much power to an FME workspace. I will report back with my results.Â
I think you could use the FMEFace class.
Here's how you can create a simple FMEFace in the PythonCreator:
import fmeobjects
class FeatureCreator(object):
    def __init__(self):
        pass
       Â
    def input(self,feature):
        newFeature = fmeobjects.FMEFeature()
        points = t(0,0,0),(1,0,0),(1,1,0)]
        mode = 0
        newFeature.setGeometry(fmeobjects.FMEFace(points,mode))
        self.pyoutput(newFeature)
       Â
    def close(self):
        pass
The points variable holds the coordinate tuples of your TIN so you just need to loop through your triangles creating FMEFaces and then you could create a MultiSurface or Mesh by passing in the newly created FMEFaces.
Also, have a look at FMETriangleFan & FMETriangleStrip, I think you can create them in a similar way and they might be useful in your scenario.
Â
Â
Hope this helps!
Thanks Gerhard! This is what I was playing with but I had some issues. I will report back once I've played around little more
This is just what I was hoping for David. I will give this a testing. Part of my struggle was adding that extra vertex. I really need to play with Python more. I think it can add so much power to an FME workspace. I will report back with my results.
FME and Python is a really powerful combo, that's for sure.
FME and Python is a really powerful combo, that's for sure.
Just FYI David, This worked perfectly and was just what I needed to get me going! Thanks a bunch
Just FYI David, This worked perfectly and was just what I needed to get me going! Thanks a bunch
Thanks for the kind words Matt, glad to hear it was useful.
Based on @gerhardatsafe, here's the code adapted to the specific use case with aggregate / MultiSurface generation:
from fmeobjects import *
MY_TRIANGLES = r((0,0,0),(1,0,0),(2,1,1)), ((0,0,0),(2,1,1),(2,2,1))]
class CreateTriangles(object):
    def __init__(self):
        pass
       Â
    def input(self, feature):
        triangles = MY_TRIANGLES
       Â
        aggregate = FMEAggregate()  # or FMEMultiSurface()
        for triangle in triangles:
            # Add first vertex as last to close polygon
            vertices = list(triangle) + Âtriangle 0],]
            mode = 0
            aggregate.appendPart(FMEFace(vertices, mode))
               Â
        feature.setGeometry(aggregate)
        self.pyoutput(feature)
       Â
    def close(self):
        pass
hi ,how set setAppearance for geomeatry, i want add color texture , the AppearanceSetter transform run slower
hi ,how set setAppearance for geomeatry, i want add color texture , the AppearanceSetter transform run slower
Hi @charry​ I would recommend creating a new post for your question if you are having problems with the performance of the AppearanceSetter.
hi ,how set setAppearance for geomeatry, i want add color texture , the AppearanceSetter transform run slower
hi , if i can set color for FMEFace use python,@david_r (Partner) gerhardatsafe (Safer)