Import DXF files in Rhino and reference the geometry?

I remember I used to do this with RhinoScript with the fingers in the nose.
I’m sure someone out there has a Python or VB component lying aroud that will import DXFs.

Please ?

You are looking for a batch importer? You can try this one maybe…

Imports all the files found of one of the types below found in a specified folder:

“Rhino”, “STL”, “DXF”, “DWG”, “PDF”, “IGES”, “STEP”, “SolidWorks”

Each imported file gets a separate parent layer with the file name; the imported file layer structure is replicated under that. FWIW. (5.1 KB)

Ah, grasshopper, sorry. Oh well, I’ll leave it up here anyway.

OK, anyone else ?

OK, what you are all telling me here is : get to scripting Python or VB ; Grasshopper or plugins are never going to have all the components you need.
And you are right.
Thanks, …really.

Great! I was looking for such a script or gh component, I actually make it manually for dxf files. @Helvetosaur, your script works fine, but is it possible to import files as one group per file instead of layers? (group with same name as the file, and layer set preserved)

Attach worksession and reference by later names?
You’ll need to have import options set first though.

I use this for attaching 3dm files, but should work for dxf/DWG

Elefront is great for the rest.

Worksession are great because you can work with an empty or minimal active rhino document attach other files as you need them without clogging up your file with other stuff.

1 Like

Anyone with a Grasshopper solution ?
This is the Grasshopper section after all…

I’d probably prefer a grasshopper solution too for importing the files, but a script like Helvetosaure’s one is OK for me. Once imported in Rhino, all my post processing is automatically made within grasshopper with the help of Elefront components for sorting geometries by layer, type, etc…

You don’t consider worksessions created by grasshopper to be a grasshopper solution?

Hi Dharman.
This thread is about importing DXF files through GH and referencing the imported geometry.

Did you even try my example? That I linked to? It is python code for a grasshopper node

1 Like

Is this the kind of solution you need?

Once imported you can use the pipeline or any of the advanced pipelines to reference the geometry. (15.7 KB)

Hi David,

Thanks for this, although :

-File paths with spaces will make the import fail

-Imports the objects twice


Yes… Indeed. The double import could by bypassed by a button. The file paths problem I have no idea. Also once imported, grasshopper starts to behave unstable. This need optimization. Hope somebody who can code can help with this.

Check out my coding skills. I solved the double import.


Hahha epic.

Kindly provide a GH file with the python components all dressed up.
I tried copying your scripts in Python components and I get a “unexpected indent” message.

hello, has there already been a solution for the spaces in the file path. I’d love to import .dxf too but the spaces in the path are indeed making problems.

Hoping for someone with a solution :slight_smile:

Just in case someone lands on this thread without finding this solution: