Skip to main content
Question

Creating texture appearances with Python?

  • May 18, 2020
  • 1 reply
  • 33 views

virtualcitymatt
Celebrity
Forum|alt.badge.img+35

Hi FME python experts,

 

 

I'm working on a problem where I have 3D objects returned from a python library. Thanks to @david_r and @gerhardatsafe's help I've been able to successfully port the geometries I need in most cases to FME Geoms which I'm super happy about.

 

 

Now I am trying to take it a step further and create the appearances - for non-textured appearances I've got a fairly decent working method, however, for textures the only way I've been able to get it to work is to dump the textures to files (JPEG/PNG) and then read them back in with FME before creating textured appearances and applying them with the SharedItemSetter. As you might imagine this is a little slower than I would like given the data are already in memory.

The images seem to be in the form of "PIL.image" ("C:\\Program Files\\FME\\python\\python37\\PIL\\Image.py")

 

Has anyone attempted this? Any hints on how I might be able to do it? It seems like the fmeobjects.FMETexture class ( https://docs.safe.com/fme/html/fmepython/api/fmeobjects/geometry/_appearances/fmeobjects.FMETexture.html ) has no clear way to set the actual texture data

 

 

 

1 reply

virtualcitymatt
Celebrity
Forum|alt.badge.img+35

Just if anyone is interested,

 

 

I ended up creating a base64 string from the PIL.image (using this) and passed that out as a feature which I was then able to turn into a raster and then texture. Still not ideal but at least I don't have to dump the images and it's much faster.

 

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings