2
« on: October 18, 2024, 11:39:52 PM »
Hello there,
I have this script
import Metashape
import os
# Access the current project document
doc = Metashape.app.document
# Get the project folder and construct the export path
project_folder = doc.path
export_folder = os.path.join(project_folder, "..", "export")
# Loop through all chunks in the project
for chunk in doc.chunks:
# Construct the model path using the chunk label
model_path = os.path.join(export_folder, f"{chunk.label}.abc")
model_format = Metashape.ModelFormatABC
# Import the model into the current chunk
chunk.importModel(model_path, format=model_format)
it runs but gives me an error, saying:
2024-10-18 16:33:45 ImportModel: path = N:/Projects/projectFiles/model.psx\..\export\model.abc, format = ModelFormatABC
2024-10-18 16:33:45 Finished processing in 0.001 sec (exit code 0)
2024-10-18 16:33:45 Traceback (most recent call last):
2024-10-18 16:33:45 File "X:/metashape/impmod.py", line 18, in <module>
2024-10-18 16:33:45 chunk.importModel(model_path, format=model_format)
2024-10-18 16:33:45 Exception: IArchive::IArchive( iFileName )
2024-10-18 16:33:45 ERROR: EXCEPTION:
2024-10-18 16:33:45 Could not open as Ogawa file: N:/Projects/projectFiles/model.psx\..\export\model.abc
2024-10-18 16:33:45 Error: IArchive::IArchive( iFileName )
2024-10-18 16:33:45 ERROR: EXCEPTION:
2024-10-18 16:33:45 Could not open as Ogawa file: N:/Projects/projectFiles/model.psx\..\export\model.abc
can you tell me what I'm doing wrong?
cheers