Importing / inserting multiple DXf files with names

Hi Group

i often need to import / insert multiple DXf files into a single file to work on things like rough nests but it can be a real time consuming thing…

i can drag a batch of parts and insert them individually where i want them with a mouse click but i would like to also leave the name of the part with the dxf file for reference, ideally as a text box under the imported file.
or even just have each one set to a new layer with the layer name as the file name.
is this possible?

A

Maybe this script will help…

Imports all files of a given filetype from a selected folder
Each file gets a principal parent layer with the filename as layer name
Layer structure in the original files is preserved as sublayers
Same set of file names re-imported gets new layer set with _Copy_XX suffix.

BatchImportWithSublayers.py (5.1 KB)

2 Likes

Hi Adrian -

I might be misunderstanding parts of the request but using Insert file > Linked > Reference > Block instance should do just that:

-wim

thanks I will try this.

Hi Wim
yes it does but i was unsure about a linked import… i don’t want changes in rhino to effect the original file. does this happen with linked imports?

Also ideally i would like the file name on the screen with the file or under the file if it were possible?

A

Hi Adrian -

When you insert DXF files with this process, they get into Rhino as blocks.
When you try to edit this “DXF block”, Rhino will tell you that it is not possible:
image

If you had inserted a Rhino file with this process, a new instance of Rhino will be started and the original file will be opened - where you could edit it.

I’m not sure what you mean with “on the screen” and “the file” here.
The layer name gets the file name and that is displayed on screen in the layer panel.
If you needed that as an annotation in the model, you would have to create that annotation yourself, either manually typing or copy-pasting the file name or using Text > fx > LayerName.
-wim

Hello,
I manage this using Grasshopper
this maybe could help you: Import DXF and Manipulate in Grasshopper
I use to insert the dxf’s by a drag and drop operation from the file explorer.
This is the only method I have found for inserting a series of dxf files (to use the data from each file, I prefer to insert them as groups, rather than in blocks). Rhino catches the name of each file and assigns it to the group so created.
I’d rather not have to validate each file, it’s annoying when there are more than a dozen, if someone could come up with a combination via grasshopper or rhino that would be great!