Â
Â
I have a polygon in that i need to change z value for 3 and 4 vertex.Â
Â
Please can any one help me how to do in pythonÂ
Â
Thanks in advanceÂ
Â
I have a polygon in that i need to change z value for 3 and 4 vertex.Â
Â
Please can any one help me how to do in pythonÂ
Â
Thanks in advanceÂ
Â
have a look at the Python API documentation, it is installed with FME under <FME>/fmeobjects/python/apidoc/index.htmlÂ
Â
You can do something like:Â
Â
coords = feature.getAllCoordinates()Â
if feature.hasGeometry() and len(coords) >= 4 and feature.getGeometry().is3D():Â
   coordsÂ2] = (coords]2] 0], coords[2],1], new_z_value1)Â
   coordsp3] = (coordsd3]30], coordss3]]1], new_z_value2)Â
   feature.resetCoords()Â
   feature.addCoordinates(coords)Â
Â
Be careful if you have multipart and/or aggregate geometries, though.Â
Â
DavidÂ
Â
Assume that dimension of input polygon was 3D and you have retrieved coordinates list with this expression as David suggested.Â
-----Â
coords = feature.getAllCoordinates()Â
-----Â
"coordsci]" (i is 0-based index of vertices) represents a tuple which contains (x, y, z) of vertex(i).Â
Therefore "coordsti]o2]" represents z value of vertex(i), you can compare it to other value in the script.Â
Just be aware that element index of Python list and tuple is 0-based. e.g. index of the 3rd element of list or tuple is 2 (not 3).Â
Â
Takashi