Is is possible to “import” a file into a target file so that the layers and objects in the imported file are sublayers under a selected layer in the target file? So far all efforts result in the imported objects being in previously existing layers in the target file, not in separate layers. I have tried Import, Insert, and creating a worksession with files to be imported as attached files and then using Copy with the Inplace option.
I have four files, each with the same layer names and structure. Let’s name them BoatA, BoatB, BoatC and BoatD.
I create a new file named AllBoats, and in the file I create layers A, B, C and D.
I want to import the layers and objects in source file BoatA into AllBoats and have them under layer A in AllBoats. Next I want to import the layers and objects in source file BoatB into AllBoats and have them under layerB in AllBoats. And so forth.
The first time I run the script the file to be imported is put in the current layer of the open file.
The second time I run the script the layer in the open file which now has sublayers with the same names as the layers in the file to be imported is put in the now current layer of the open file, and the objects in the file to be imported are put into the existing layers with the same names.
I see, OK - so you have the top level layer in the incoming file and in the parent file as well… so I need to ditch the top level layer in one or the other. Bringing in a file without that top level layer seems OK.
@pascal Incorrect. The “top level layer” is not in the file being imported. The name of the “top level layer” may or may not be the same as as name of the file being imported into that layer. In the example files I provided one source file is Rowboat11 and it needs to be imported under Rowboat.
Selected Canoe as current layer.
RunPythonScript and selected Canoe2.3dm as file to import.
As desired, objects and layers from Canoe2.3dm appear under layer Canoe in All In One.3dm. This is as desired.
Select Rowboat as current layer.
RunPythonScript and selected Rowboat112.3dm as file to import.
Objects from Rowboat112.3dm appear in corresponding layers under layer Canoe in All In One.3dm
Desire was for the imported objects and layer structure from Rowboat112.3dm to appear under current layer of Rowboat in All In One.3dm
Select Kayak as current layer.
RunPythonScript and selected Kayak2.3dm as file to import.
Objects from Kayak2.3dm appear in corresponding layers under layer Canoe in All In One.3dm
Desire was for the imported objects and layer structure from Kayak2.3dm to appear under current layer of Kayak in All In One.3dm
Results from above (corrected):Wrong files uploaded