Agisoft Metashape > Python and Java API
Creating and Managing Multiple Chunks
LFSantosgeo:
Hello!
I'm finding difficulty to add a large number of chunks in loop.
--- Code: --- from_range = 1000
to_range = 351000
interval = 1000
list_labels = list(range(from_range, to_range, interval))
lenght = len(list_labels)
print("Will be created {} chunks for this process".format(lenght))
chunk = PS.app.document.chunks
for chunk in range(lenght):
doc.addChunk()
--- End code ---
UPDATED: managed to create multiple chunks...
LFSantosgeo:
Now I'm getting trouble with assigning each chunk a new label based on a list:
--- Code: --- for chunk in doc.chunks:
for values in range(len(list_labels)):
for label in chunk.label:
labels = "Chunk: " + str(int(values / 1000)) + " / 0"
chunk.label = labels
--- End code ---
Any help would be appreciated!
Alexey Pasumansky:
Hello lfsantosgeo,
What is in the list_labels?
Alexey Pasumansky:
Maybe you need to try that:
doc = PhotoScan.app.document
--- Code: ---for i in range(len(doc.chunks)):
doc.chunks[i].label = "Chunk: " + str(int(list_labels[i]/1000)) + " / 0"
--- End code ---
LFSantosgeo:
--- Quote from: Alexey Pasumansky on December 11, 2017, 06:43:30 PM ---doc = PhotoScan.app.document
for i in range(len(doc.chunks)):
doc.chunks.label = "Chunk: " + str(int(list_labels/1000)) + " / 0"
--- End quote ---
The code gives this error: "Error: 'list' object has no attribute 'label'"
Navigation
[0] Message Index
[#] Next page
Go to full version