Aug
24

Importing 2d CAD files as modeling reference

By

In a nutshell: use Autocad12 ASCII DXF format to get 2d data from dwg files into Blender 2.58 using free software Draftsight or Autodesk online dwg tool if you do not have Autocad.

The long story:

Blender importers have kept changing over time. At the time of writing this article I have tested Blender 2.58 and the imported formats I could find useful in this matter are .3ds .dxf and .svg

The most used format in the architectural world remains DWG files from Autocad, and as Blender does not import dwg you’ll have to have an intermediate software to view edit and export your files.

Of course you may ask the client for a dxf export of the file but this doesn’t look professional, you can’t clean the file yourself and if revision files follow, it will be unpleasant for the client to keep converting them for you.

If you have Autocad it will be really easy. I have a cheaper commercial alternative, Bricscad, good but lacks 3ds export (at least my older version does) so I tried dxf export. I managed to bring a nice mesh from my 2d drawings using the Autocad12/13 ASCII DXF format.
Well, the good news is you can do the work using free software. It was a bit tricky but after two days of googling and testing I have found a nice free 2d cad drafting software called Draftsight that can be used to open dwg files, edit them and export to autocad 12 ASCII DXF. It is not open source and you have to submit an email address but was easy to download and install. All 2d editing commands are the same as in Autocad.

Draftsight

..
An open source similar cad software I found, Librecad, might work also but did not open dwg files, just dxf and seemed slow.

You can also try using this Autodesk online dwg tool, it does open dwg and save dxf only the editing options are a bit simple and slow to use so you might not be happy to use it on a complex file. You also have to create an Autodesk account for this.
If all you need is to view the dwg files, print them or take sceenshots you can use Autodesk dwg viewer.
I am rather surprised I didn’t find more free options, do you know some other free cad- dxf editors/exporters?

Importing 2d data to Blender as actual meshes can help a lot but requires a bit of preparation work. I have sometimes received really untidy cad files, so here are some things you should check before exporting:

  • delete unnecessary stuff from files like cars and tree blocks. zoom to bounds (extents) to check for out of sight versions of the plans, lost points or dimension lines.
  • delete text, hatches and explode blocks or freeze layers containing them. Then select all and explode. Sounds harsh but I received files that had blocks in unexpected places, on wrong layers. Some elements can change color as they might move to layer 0 but it doesn’t really matter.
  • the imported object will not retain the different line colors usually used in cad drafting so better delete unnecessary elements which will make reading the plan confusing
  • scale drawing to desired units (meters work well with Blender units)
  • check if drawings have not drifted somewhere far away from origin and move them close to 0,0,0 or else you might have trouble finding it in Blender
  • to make sure nothing has escaped, select the cleaned drawing and use the wblock command. This will save a new file containing just the selected entities
  • if cad files are too messy or big and fail to import them correctly, consider drawing over a simplified outline with the main features you need for construction, and exporting just that.

After submitting the file to all of the above and saving the r.12ascii dxf file I went to Blender:

Dxf import

And got the following editable object, just vertices and edges, all one piece, all blender black:

Dxf imported

By enabling edge length to display in edit mode I could check the drawing was imported to scale.

….

Last tested in official 2.61 Blender release, worked as described above. Import as dxf addon must be checked first in the addons section in User preferences. One glitch: didn’t work importing in the file I was already working on, not only did not import occur but some objects in file disappeared. Imported OK in a new file, then used append.

Categories : Imports, Modeling, Workflow
  • Carolyn Roberts

    Thank you oh wise one. This is *extremely* helpful. 🙂

  • hi, an interesting article. i would like to share my experience on this matter.

    Some time ago i have tried to import dwg to blender myself, but when i managed to do that i discovered that the imported mesh is nearly useless because of its chaotic topology(at first i was expecting to simply extrude imported plan lines and have building shell in few minutes.

    I discovered that it is simplier just to take a screenshot of a plan in cad wiewport and use it as a reference image than to import cad geometry.

    anyway, these seven tips pointed above in the erticle are extremely usefull for any import-export tasks. It should be more highligted. I would have saved me tons of time if i would have found them earlier(sorry for crazy grammar)

  • Oana

    Hi Mantas! Thanks for your input, seems we reached the same conclusion, I also use the image reference method like you say, as I pointed out in a related post

    However, in some instances when I had to model a special detail consisting of…many rectangles, I succeded to import closed polylines in Blender and just extrude them; in this particular case this worked a lot faster than redrawing over a image.

  • YU

    Exactly what i’m looking for! big thanks !

  • rudolf

    Thanks! will definitley try it.

    I always messed around with opening the dwg/dxf in rhino, extruded everything and exported as obj. Then scaled z down to 0 and deleted duplicate vertices in blender.

    Well it worked, but the 3d view of rhino and exporting to obj was veeeeery slow. (and I also rebooted for rhino) XD

  • rudolf

    so i tried it:

    1) I need to set the encoding to iso-8859-1 when importing
    2) usualliy i don’t care about the origin point you can bring back your model with ctrl+alt+shift+c “geometry to origin”. HOWEVER: my model was several kilometers away and there seems to be numerical problem with decimals, so you really want to make shure that the plan is not far away from the origin point. Otherwise it will look like crap.
    3)autocad has an advantage over draftsight, you can set the number of decimals in the extras options when exporting.

    And a tip for archicad users: for ifc/bim walls whatever objects you can flatten them with strg+alt+z (convert to lines or so) the shortcut key maght be incorrect because i have the german/austrian version.

  • Oana

    Thank you Rudolf for posting your findings here!

  • rudolf

    A very big thank You! too 🙂 Importing dxf files saved a LOT of time 🙂

    Work in progress, bachelor thesis, tu vienna.

    http://image-upload.de/image/URag9f/8fea8b1fd1.png
    http://image-upload.de/image/sdN30l/dadfdee1b9.png
    http://image-upload.de/image/c6XiDA/01e9f48790.png
    http://image-upload.de/image/qIXNoX/5f69100f87.png

  • Will

    Thank you for these tips.
    I’m an archiCAD user and I would like to import an archiCAD 2D file in Blender. I converted it in 12 ASCII DXF with Draftsight, but when I import it in Blender this error-message appears (even when I explode and clean the file in Draftsight):

    http://www.casimages.com/img.php?i=130112040315631278.jpg

    I tried to import a dxf file all made with Draftsight and there was no problems.
    Do you know where the problem come from?
    Thanks

  • Oana

    Sorry, I don’t use archiCad, I guess some BIM data won’t give up? Did you also try selecting the visible data and exporting as a wblock?

  • Will

    Thank you for your response. No, I didn’t know that way to proceed. Do I have to export as wblock in Draftsight and import the created file in Blender?

  • Oana

    Sorry just saw your question, busy days…
    From File menu -> export -> export drawing -> opens export window. Or keyboard shortcut “W”.
    Check “selected entities” and “do not convert to block” then “browse” to select the file type, like in regular file save.

  • For your information:
    my DXF-importer script for Blender 2.6+ is finished!
    I am really happy I’ve got it managed, after months of fight with bugs and python API.

    all story here: http://cad4arch.com/dxf_importer/

  • Oana

    That’s really good news, I’ll try it out soon!
    Thanks for letting me know, Migius

  • melriv28

    I’m having issues with my addons. The script porivided in wiki blender (http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/DXF_Importer) is not working for me. Please someone help me. I’m a beginner in blender but a user of AutoCAD. I’m looking to merge to blender but only if I can provide accuracy with blender. Providing the right scale is the most important part of my work.

    Thank you.

  • melriv28

    I’m having issues with my addons. The script porivided in wiki blender (http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/DXF_Importer) is not working for me. Please someone help me. I’m a beginner in blender but a user of AutoCAD. I’m looking to merge to blender but only if I can provide accuracy with blender. Providing the right scale is the most important part of my work.

    Thank you.
    melriv28

  • Oana

    Hi Mervil, does the script give bad results or doesen’t it work at all? The script is by Migius who wrote earlier in this thread, you could try writing to him on his website, I’m sure he will welcome feedback (link in his post above)

  • Ha Awesome post. I’ve used blender for a cuploe of years, but never really got into it because of lack of time. However, recent versions are amazing for a free 3D program (fluid dynamics, realistic psychically accurate render engine and GPU rendering as well as a node system for compositing). Sounds like i’m advocating it, but having used both Maya and Blender, I really am impressed by the quality of Blender.

  • Greate post. Keeep writing such kind of informationn on your blog.

    Im really impressed by it.
    Hi there, You’ve done a great job. I will definitely digg it and in my view suggest to my friends.
    I am sure they’ll be benefited from this web site.

    Heree is my web blog; gambling tips – Brook

  • Milind

    Hi first of all many thanx for your information.
    I export .dxf using draftsight.
    But when I import it in blender,it come with some unwanted blocks.
    There should be lines instead of those blocks.
    pls help me asap……