How to find the file path of an imported model in Sketchup using Ruby?

I have a DXF file stored in my local file system.
I import the DXF file using the File -> Import option in the menu.

Now after the DXF is imported, I need to get the path of the imported DXF file.
Is it possible to get the same using any Sketchup ruby API ? Or using any observer ?

There are no observer events for imports. But you can detect new component definitions and query the path property.

In my case, the path property of all the components in the imported DXF model seem to be empty.

This DXF model is created and exported out of AutoCAD revit and then imported into sketchup.

Usually DXF and DWG imports come in as one big component instance, which will have a definition.

This is why it was suggested to check the definition’s path property.

However I just tested it and yes, I agree, the definition name property is set to the filename, ie “importedfile.dxf”, but the full path property is an empty string.