AutoCAD to Blender

How interesting, it looks like dxf can have thumbnail image as well??? Funny nobody uses. Now when you look at the 3dsolid section, you feel your stomach atrophying… there is nothing at all… And 3d objects in autocad are solids, and I far as I know solids are defined a very different way than meshes… But surely there are other importer scripts that deal with solids.

With autocad prior to 2007, when you had the right to export to 3ds, all that exported correctly to the 3ds format were 3dsolids, 3dfaces and regions. I think importing that in Blender would already save many people.

You’re right, the 3dsolid part is undocumented. From what I’ve been able to learn Autodesk is using a 3rd party lib to do there 3dsolids. In the dxf file they just include a big chunk of data exported from that lib. The library is ACIS and the format is SAT. The SAT format spec is here http://local.wasp.uwa.edu.au/~pbourke/dataformats/sat/

Right now I am more worried about getting simple lines and text in to Blender. Then 3dfaces, and finally solids last.

BTW I wrote a parser this afternoon that generates a usable object hierarchy from a dxf file. Right now I’m thinking I will have the paser and some useful functions in one module, and all the Blender stuff in another. In the beginning I’m going to ignore all the settings in the dxf header, and other sections too for that matter, and concentrate on the entities section. I am moderatly certain I could import lines (as one mesh per layer) right now.

Currently everything is in one big file (not really that big tho). I want to set it up as a Leo project and get a few things straitend out before I release anything. I think I’ll have something done some time next week? I think I sense another crisis brewing at work, but I’ll see what I can do :slight_smile:

Kitsu,

I am very interested in helping any way that I can with your project. I only know a little programming in autolisp and am trying to study some python and C++ so I can’t help much in that respect. I do however have Autocad 05-07 and would be willing to do any testing you might have arise as my time permits. I am very busy at work right now but have some time in the evenings and weekends to devote if it would be of help. I am happy to see someone working toward a solution for bringing entities from autocad to blender. I would be happy with just the ability to bring lines and arcs in some form into autocad at this time and build upon that as you’ve stated in your post.

By the way their has been a file format change in Autocad 2007.

The 3d engine as I understand it, and as Autodesk has stated, has been overhauled. Don’t know how much henderance or help the change may present.

You may PM me if I can be of help in any way.

A couple of thots from a programming-ignorant ol’ CAD jockey: Could you use the existing DXF import script as a starting point? It should give you a head-start on legacy DXF (up to R12). It seems to mostly fail on 2D curved entities (arcs & circles.)

Also could you find any resources from this effort (“cross-polinated” from this thread) maybe?

This could likely mean one of two things: either they’ve finally updated the ACIS version that’s used (most likely) or they’ve borrowed some tech from Inventor (tho probably Inventor itself utilizes Spatial’s ACIS engine too… not sure.)

Anyway, I’m happy to “bugzap” any scripts for you, too. I’m on ‘05 and still have 2K installed (my ol’ fav.:slight_smile: )

AutoCAD 2k - ick! Acad 2004/2005 has much more interesting bugs^b^b^b^b features!

Anyway, I’ve gotten my first line into Blender! My current test file consisted of a single line drawn from 0,0,0 to 1,1,0, so you could say that I imported the entire drawing :wink:

Now I need to write some helper functions (like go find all the lines for me) and some more wrapper objects. For now I’m going to be testing with only Autocad generated dxfs. I’m really not looking forward to testing this thing with dxf files from other software. If Autodesk’s parser is as error tolerant as I expect it to be then people will have been getting away with all kinds of mangled versions of dxf :frowning:

mzungu: AFAIK there is no existing dxf import script. The existing importer is coded in c, and is part of Blender itself.

I’m imagining all sorts of end user options for this. For the first release though it will probably have no ui. What do you guys think about some defaults:
curved things import as beiziers
imports as one object per entity
one object group per layer

Eventually it would be nice to have options for object per layer, import all as curves/meshes. But to begin with I guess everyone can convert the curves themselves?

Now that we’re talking about it, I happen to remember someone talking about a python dxf importer script, long time ago here in this forum or in the blender.org one… i’ll see if I can find it back…

It seems to mostly fail on 2D curved entities (arcs & circles.)

The dxf import function got enhanced in 2.42… now it transforms arcs in segmented lines quite correctly.

:lol: this is kinda fun! The line import is already moderatly usable
http://kitsu.petesdomain.com/images/ref/wire-render.jpg
I wanted a test with a lot of geometery, so I exported part of one of our bridge rail drawings. I guess we used a lot of plain old lines in this drawing! This was mainly a drawing.entities.get_type(‘line’) test. Also each line is a seperate object, but they are all grouped by layer.

Your initial defaults get my vote.

Personally I think these defaults are an excellent place to start. I will be happy just to be able to import basic geometry into blender to build upon. If I can get basic autocad entities into blender easily it will open up a whole new level of workflow for using blender on the back end of autocad drawings for 3d modeling and rendering and even animation.

Perhaps after some testing I would have some other requests for other options but the last thing I want to do is try to steer your development criteria to suit just my needs. Please carry on as you see fit.

Again, I will help in any way that I can.

Man, I am having way too much fun with this! I’ve gotten basically no work done today :frowning:

latest image <-- Larger than forum layout
I’ve gotten the first draft of lwpolylines and text (dtext) working. Plines support lines and… there really isn’t much to lwpolylines. Text supports height, width factor, oblique, horiz. centering, rotation. Major things missing from text are mirrtext and upside down (which noone uses). I guess that means I either have to start on circles/arcs, or try polylines/splines. That ought to put a damper on my fun. Oh wait, I still have to do mtext :smiley:

Kitsu, you are a genius!
How fast you did that man… I hope you won’t loose you job :wink:
If you need someone to test things or something, just post here…

salut littel tut for acad 2005 to blender
http://www.kino3d.com/mediawiki/index.php/(ingoenius)_Da_Autocad_a_Blender_-WIP-

end
http://www.kino3d.com/forum/viewtopic.php?t=4975

acad to txt (reference block files) blender script python to append same bloks on same dimensions
sorry for my english

Looks interesting to bad I can’t read French.

Last night I fought a little with conversions between object coordinates and world coordinates. I got it mostly working, but hopefully someone with more experiance with matrix transforms will be able to fix it after I release.
I had my first battle with curves this morning. It seems that Blenders curves are even less useful than normal from Python. I did get some circle drawing code working, only the circles look like diamonds… Until you enter edit mode and preform any operation. It looks like bezier triples are not getting updated when handletype is set? So for now I moved the curve drawing code off to the side and implimented circles as meshes
http://kitsu.petesdomain.com/images/ref/circles.jpg

Edit: Arcs too! same problem as with circles :frowning:
http://kitsu.petesdomain.com/images/ref/arcs.jpg

See ‘AutoCad export to .3ds format’ if you’re having trouble with that export utility.