Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

July 18, 2012

Blender 2.6x igs importer

At the moment it only deals with line type 126 (which is BSpline). It can be downloaded here: blender_version_igs_import.py. Warning: only deals with entity type 126.


(model credit: siggraphSpacecraft48.igs -- i have no idea who made it.


At the moment the igs importer probably doesn't do much good beyond importing BSplines. But it happens to do a remarkable job at importing .igs files from
http://www.dgp.toronto.edu/~shbae/ilovesketch.htm, which is why i wrote it.

Behind the scenes

After staring at the .igs files for a while some patterns emerged. It became clear that a relatively uncomplicated extraction pattern would probably suffice to get things started. Without reading through the official file specs i tend to write code for whatever gets flinged my way, until a meta pattern emerges and then things become more sophisticated. Right now the code is procedural, and easily lets me implement new entities as they occur.

After several hours manual labour

I manage to squeeze this one out. Blender has NURBS surfaces but the interface for NURBS specifically is very weak and probably hasn't changed much in the past 4 years. Anyway. here it is (model 83 from the iLOVESKETCH page:
some more hours.

6 comments:

  1. Sound very interesting, how can i enable this?
    as addon?
    Please explain-
    jimmy

    ReplyDelete
    Replies
    1. This is a script without an interface, because I only wrote support for BSpline entities (which was the only thing present in the files involved). Lack of user interface code means it won't appear in the import menu, but you may still use it by opening the .py file inside the Blender Text Editor, and making sure the path to the .igs file is valid. Simply hit run (or alt+p) inside the Text Editor to start the import process.

      Because this isn't a generic IGS importer, it's not likely to be of much use beyond files that contain purely BSplines (ie, the files linked to above). Blender bpy curently (7 Nov 2012) doesn't have much custom NURBS creating facilities outside of the UI, so I didn't pursue further.

      Hopefully this explanation has been helpful in some way.

      Delete
  2. Thanks for the answer, i tried do figure it out but dont get it to run-
    Ive no understanding of code at all, never even knew that blender had an text editor ;)
    B splines isnt a problem for me, as my intention was to model Bezier Curves in a Nurbsmodeller (alias) an use this curves in blender as a reference and snap vertecies to them. Like possible in maya(native having nurbs) and Modo(seems to have an optional Plugin for nurbs)
    Would have been a great Workflow for me-
    Hopefully someone is implementing an importer for igs or step soon-
    Again Thanks for your help-
    james

    ReplyDelete
    Replies
    1. Blender does have native NURBS (add surface -> NURBS) but their UI is not exactly intuitive and certainly in need of attention.

      If you can send me a link to an example .igs on twitter (@zeffii) I might still be able to show you how to import your basic .igs. But if the end result will be polygon based then perhaps you can export as .obj from your NURBS package and set the subdivision to something low.

      Delete
  3. Wow this would be great if it could import nurbs surfaces!
    I have been looking for a good way to import CAD data for visualization into Blender, and the only thing that works as of now is first tessallating and importing the triangle mesh, which is very messy to clean up in Blender. Converting the tris to quads does not follow the original "flow" of the nurbs patches and gives bad renders. Especially bevels and smaller radii are a pain.

    If you ever have time to work on importing nurbs as nurbs into blender (from igs or step format) a lot of product viz people couldn't thank you enough!!!

    ReplyDelete
    Replies
    1. I empathise with frustration from the lack of NURBS support in Import/Export in Blender. As far as I can tell NURBS is very weak on the core developer radar. But as you mentioned quite a few people out there would appreciate the ability to import from a NURBS supporting format. Start a poll on BA, state your case gather support. There is a reason certain areas get better development, ear-tagged donations. Make your voice heard, and put money where your mouth is.

      Delete

Please use Blender.StackExchange.com for python scripting questions unrelated to this post.