看着FME对象文档,我们看到fmesh.getVertices()返回表单(x,YZ)。不幸的是,fmefeature.setattribute()不知道如何处理嵌套列表(以及其他列表)。所以你必须对你需要的东西更具体一点。
让我们为“vp”包含以下三个元组列表的情况提供一些示例:
[(1,2,3),(4,5,6)(7,8,9)]
如果只需要“vertexpool”包含“vp”的字符串表示,你可以做到:
feature.setattribute('vertexpool',STR(VP)
这将在Vertexool上设置以下字符串值:
Vertexool='[(1,2,3)(4)5,6)(7)8,9)
如果希望Vertexool是所有顶点的列表,你可以做到:
feature.setattribute('vertexpool',[str(顶点)表示vp中的顶点])
现在您将拥有以下列表,您可以进一步分析,例如李斯特爆炸家:
Vertexool 0='(1,2,3)“Vertexool 1=”(4,5,6)“Vertexool 2=”(7,8,9)
最后,您可能希望将其进一步拆分为X、Y、Z组件的列表元素:
对于N,枚举(vp)中的顶点:feature.setattribute('vertexpool%s.x'%n,Vertex[0])feature.setattribute('Vertexool%s.y'%n,Vertex[1])feature.setattribute('vertexpool%s.z'%n,顶点〔2〕
这将为您提供以下结果:
Vertexool 0.x=1Vertexool 0.y=2Vertexool 0.z=3Vertexool.1.x=4Vertexool.1.y=5Vertexool.1.z=6Vertexool.2.x=7Vertexool.2.y=8Vertexool.2.z=9
如果您需要上文未涵盖的特定内容,请告知我们。
您正在尝试将元组列表赋给单个属性。
我建议一种结构
顶点池{}
顶点池{} y
顶点池{}
可以在for循环中创建
对我来说,枚举(vp)中的v:feature.setattribute(“vertexpool%d.x”)%i,v[0])feature.setattribute(“Vertexool%d.y”%i,v[1])feature.setattribute(“Vertexool%d.z”%i,V〔2〕