Author Topic: Create a project with API  (Read 94 times)

Hello!

I try to create a new project in JavaScript using the scripting API, but it doesn't work.

Code: [Select]
alg.project.create(pathToAbcFile, [], pathToTemplate, objectWithProjectSettings)
With this line, I had this error:
ProjectError: the file /path/to/my/template.spt isn't a valid template
but this file was generated with the UI (File / Save As Template).

I tried to replace this by "null" for the moment, but I also had an error with my mesh:
ProjectError: meshFile /path/to/my/mesh.abc isn't a valid url on an existing file
In the doc, I read "File url of the mesh to edit. Supported file formats: fbx, obj, dae, ply." but I can open alembic files with the UI.

Is there something I do wrong or I can't open abc files and use template like this?

Thanks!

It's not always clear in our documentation but you likely have to convert the path with alg.fileIO.localFileToUrl().
Don't forget your log file. It can be exported from the Help menu of the software.
-----------
Froyok aka Fabrice Piquet, Technical Artist and Product Designer at Allegorithmic.

It works, thank you!