for each in iter(lambda: <your object>.next(), None):
I did notice that in arcpy the Array object is not iterable. I had to use the .next() function. Should I expect it to be iterable? while row: feat = row.getValue(shapefield) qInterior = False for partNum in range(feat.partCount) : part = feat.getPart(partNum) qInterior = False for ptNum in range(part.count): pt = part.next() if pt != None: arrayOuter.add(pt) else : qInterior = True break # ignore donut vertices arrayObj.add(arrayOuter) arrayOuter.RemoveAll()
while row: feat = row.getValue(shapefield) qInterior = False for partNum in range(feat.partCount) : part = feat.getPart(partNum) qInterior = False for ptNum in range(part.count): pt = part.next() if pt != None: arrayOuter.add(pt) else : qInterior = True break # ignore donut vertices arrayObj.add(arrayOuter) arrayOuter.RemoveAll()
while row: feat = row.getValue(shapefield) qInterior = False for partNum in range(feat.partCount) : part = feat.getPart(partNum) qInterior = False # to iterate you can use the iterable wrapper in # conjunction with a lambda. for pt in iter(lambda: part.next(), None): qInterior = True arrayOuter.add(pt) # old method for ptNum in range(part.count): pt = part.next() if pt != None: arrayOuter.add(pt) else : qInterior = True break # ignore donut vertices arrayObj.add(arrayOuter) arrayOuter.RemoveAll()
I haven't really seen any bugs regarding comtypes and ArcObjects, except one: it doesn't wrap the esriSystem.Array object since there's a name clash with ctypes Array. I'd be curious as to what version of comtypes you've been using and what problems you've been seeing.
Adding the STAThread attribute dramatically changes C# and F# performance, and adding in the missing ReleaseComObject lines significantly improves VB .NET performance, bringing all three in line with each other as I had originally expected. Also, setting the "CLR Thread Attribute" and "CLR Unmanaged Code Check" linker settings in the C++/CLI benchmark [the actual benchmark code is unmanaged] brings its performance to about the same as C++/ATL, which is what it should be. :cool:So here once again *sigh* are my benchmarks for 9.3.1:Seconds: Java: 81IronPython: 54Python: 40VB/C#/F#: 27VBA: 14C++: 13Python/arcgisscripting: 43and now for the 10.0 RC:Seconds: Java: 78IronPython: 44Python: 33VB/C#/F#: 19VBA: 8C++ : 8Python/arcpy: 98At the DevSummit, the ESRI geoprocessing team said for the 10.1 release they hope to improve the performance of arcpy and add Python support to the add-in framefork. :rolleyes:I've also updated both the sample code and the presentation at my web site. 😛
The presentation I gave at the DevSummit, and all the sample code (including the benchmark snippets) are here:http://www.pierssen.com/arcgis/misc.htmI haven't really seen any bugs regarding comtypes and ArcObjects, except one: it doesn't wrap the esriSystem.Array object since there's a name clash with ctypes Array. I'd be curious as to what version of comtypes you've been using and what problems you've been seeing.Once I download the RC I'll run the benchmarks again but I don't expect to see any change. I'm more concerned about checking on the pure Python COM objects bug.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.