Active_model.definitions.import error on Mac and not Windows in Sketchup 2023

I’m using “Sketchup.active_model.definitions.import” to impot a collada file(.dae). This worked without any problem for both Mac and Windows in Sketchup 2021. Now that I have upgraded to Sketchup 2023 I get this error on Mac:

Error: #<IOError: Failed converting file to SKP>

Does anyone know what has changed from 2021 to 2023 that might have caused this for Mac?

The(IOError) is raised if the file is missing.
Without seeing the full code I guess something wrong with the path (String) parameter when you are calling the DefinitionList #import method…
Perhaps you don’t have rights to read that file/directory… maybe the Sketchup does not installed properly
(or you are started Sketchup from the .dmg << I’m not a “Mac man”, just read somewhere that may causing this kind of things… :blush: )

I use Sketchup.temp_dir to copy the file from a server to the local temp folder, so it should probably have raised a error in that step if it didn’t exist but I will look into it, thanks

Can you share the dae file so we can check whether others also have issues with it?

@Henke

No one has stated it, but some files do work.

I tried it with a simple file from the 3D warehouse. It did work, both on Windows and Mac.

Can you see if the file appears to be a valid xml file? Have you tried validating it (macOS only)? The below terminal command should validate it. I think it’s normally installed on macOS, not sure…

xmllint --noout --schema http://www.khronos.org/files/collada_schema_1_4_1.xsd <file path>

EDIT: You did say you tried it with SU2021 on both platforms. Hence, not sure about the cause…

I can’t share it, but I tried to import it by manually dragging it into the scene and it worked. And the same file works on Windows.

Supposedly, the API definition import method just calls the C++ native importer that the manual command uses.

Try downloading it to a different folder. Make sure you have folder permissions and use a test loop to test that the file is accessible. Ie, use File.exist? and File.readable? before calling the import method.

I tried it and the file both exist and is readable. Maybe I need to look into if the native importer has changed since 2021

Nothing that we I know of or that has been announced. :thinking:

You can try:

  • “Play” with an option hash, or omit it at all
  • Try with different .dae
  • Ignore Mac :blush:

“Ignore Mac :blush:” I would if I could :cry: I will create a script that will test all possible ways to do it.

Testing all/none option hash didn’t work. But using the Sketchup 2022.0.353 works. Can’t see anything in the release notes for 2023 that might be the problem https://help.sketchup.com/en/release-notes/sketchup-desktop-20230