Import .ai, .pdf

I played around with the code some and got it to work with build 35367.

Here is it is, attached, if anyone wants to try. See instructions earlier in this thread.

Only just found time to give the script a go. Iā€™ve tried it on both Mac OSX version 33949, 34904 and neither load after manually installing the add-On files in the Preferences panel. Please donā€™t give up this will be a very useful feature.

What makes this so great is that you can quickly animate a 2D drawing by adding a few bones and have all the advantages of 3D. Another more advanced feature would be if blender could reference the ā€œ.aiā€ file and its layers so that any changes would get update in the 3d blender scene. That would get a lot of broadcast designers drooling

j-mation: Did you use the script I just posted (io_vector.zip.blend) or the earlier one? Do you mean that it showed up in the preferences panel and you were able to tick the flag to say to load it, but then you were not able to convert an AI or PDF file, or did the first step fail? If the first step (checking the box) succeeded, were you able to see an ā€œAdobe Illustrator or PDFā€ file entry under the File > Import menu? Did you restart Blender after ticking the box?

howardt, I tried the script and it worked great on r35333! This is awesome to have, I felt almost giddy being able import an AI file without having to do anything else with it!

A few suggestions. I tried importing a couple logos which would come in pretty good. The mesh faces are somewhat of a nightmare though if you choose too many sub-divisions.

My suggestion would be to maybe offer option to import as mesh or curves (instead of just mesh). I did a comparison below of using your script, then using the import SVG script. With the SVG import it comes in a as curves, which I then use that amazing ā€œConvert Curves to even meshā€ script that I linked to earlier in this thread. https://github.com/decden/Blender-Curve-to-Uniform-Mesh

The curves to mesh script does a pretty damn good job of keeping most triangles out of the mesh. Iā€™m sure you donā€™t want to write the functionality of that script into yours, but itā€™d be nice to have the option of curves.



Did I say thank you again? Thank you thank you thank you!!!

Yep that is the script Iā€™m using. I have also just downloaded and tried version 35382 with no luck. It doesnā€™t show up in the preference panel at all in any of the versions I have tried. I donā€™t think it is installing correctly. When I choose to install an add-on from the preference panel with all other add-ons Iā€™v downloaded I can only install it once as it will say the add-on is already installed. However with this plugin I can just keep adding it and no message ever appears to say that I have installed it already.

@j-mation, try copying the file manually to the scripts/Addons directory, donā€™t using the ā€œinstallā€ button. When you copy the files into the right directory it should show up in your preferences.

On a mac it should be this:
/Applications/blender253/blender.app/Contents/MacOS/2.56/scripts/addons

You need to copy the entire folder (io_vector).

[QUOTE=crazycourier;1801466]@j-mation, try copying the file manually to the scripts/Addons directory, donā€™t using the ā€œinstallā€ button. When you copy the files into the right directory it should show up in your preferences.

On a mac it should be this:
/Applications/blender253/blender.app/Contents/MacOS/2.56/scripts/addons

I tried this and it works however I would really want it to work through the preference panel as I like to keep all the add-ons in a different location so that when I change versions which is often I donā€™t have to search for all the add-ons.

I have done a quick test and found that the script is slow but gives good results compared to the svg import. Check the problem area with the svg import below.


Iā€™m not sure Iā€™m following you, copying the scripts to that directory is basically the same thing as clicking ā€œInstall Add-Onā€? It still only works if you enable the add-on via preferences. They both do the same thing, only Iā€™ve found the install button doesnā€™t always work on every script.

If you want to keep your scripts separate, goto user preferences > File > Scripts. You can then specify whatever folder you want to use for your scripts.

I didnā€™t realize it copied the script to the add-on folder I though it referenced it location. Hmmā€¦ that is something that needs to change in the future. Not your problem of course. A much better system is to keep this reference link in a config file so it doesnā€™t matter what version you are running it simply looks at the config file and loads all the compatible add-ons.

Anyway back to howardt very useful add-on. Any chance of getting a few features added.

Thanks so much crazycourier and j-mation for trying it and for the feedback.

j-mation: I think the ā€œinstall addonā€ button on preferences only works if the addon is a single python file. Mine is a directory with several files. Thanks crazycourier for diagnosing what was wrong and helping j-mation to be able to see the plugin.
And yes, I am willing to hear feature requests and perhaps act on them. One feature that I am working on is the option to extrude and bevel.

crazycourier: Honestly, it would be just as easy or even easier for me to add a ā€œdivide evenlyā€ option to my importer than to figure out how to import into curves, so Iā€™d prefer doing that. I will try to do a ā€œdivide evenlyā€ for my next update.

But right now I have another update (version 0.3), attached. This one has more options:

  • adaptive: if checked, the dividing of the curves is controlled by curviness, so stops when the curves get straight enough. If this is checked, the ā€˜Number of subdividesā€™ value controls ā€œhow flatā€ - it is approximately like the number of subdivides a circle would undergo
  • filled paths only: checked by default, but if unchecked it will import stroked but not filled paths too and makes faces out of them also (you might get duplicate faces if the file makes separate paths for stroking and filling, as some files do)
  • ignore white filled: checked by default, meaning that shapes filled with white are not imported (these are often just the page itself), but you can uncheck it if you want white shapes
  • combine paths: if checked, donā€™t just look for holes as specified in the AI file by ā€œcompound pathsā€, but in general look for containment of one path inside another as an indication that a hole is desired. This option may slow down the import.

latest version works fine here.

I know this might be to much to request but these feature would make it far more useable than the svg import. The features I would love to see would be:
-Basic colour
-An option to select which layers to import
-An option to create groups from Illustrator layers
-An option to separate the created groups in z distance apart
-The ability replace a group in blender with a layer inside an ā€œ.aiā€ file.

The color and z-distance spread ones are easy, and I can do soon.
The layers-related ones might be harder - it requires an understanding of the structure of an .ai file that up til now I havenā€™t needed because at base they are just Postscript or PDF. So I can probably figure out how layers are done with the latest Illustrator (I have CS5) but not sure how many other versions it will work for, and it presents the need-to-keep-up-with-Illustrator problem. I also have to learn how to make groups in Blender, but I expect that thatā€™s easy.

Thanks for trying the latest version.

Here is another version, 0.4.
This one has three options for dividing the curves, now in a dropdown box:
Uniform - just divides each curve in half a set number of times (the ā€˜smoothnessā€™ #)
Adaptive - divides each curve in half until ā€œflat enoughā€ - which depends on the ā€˜smoothnessā€™ #
Even - divides curves and lines to make approximately equal length segments (shorter segments as ā€˜smoothnessā€™ # gets bigger)
(For Uniform and Adaptive, you donā€™t want to make the smoothness # too big - not more than 3 or 4, say - else it will take a long time to import. For Even, the effect of increasing smoothness is more gradual and you might want to use a number like 10.)

It also has rudimentary support for colors - if you check the ā€˜colorsā€™ option, it tries to use the fill colors from the input file to color the polygons. It doesnā€™t always work yet, but it does sometimes (there are lots of ways of specifying colors and I donā€™t handle them all yet).

I havenā€™t yet looked at how to recognize layers in AI files.

I also made a web page to describe this (and eventually, other plugins), and I plan to keep the latest version download there.

This is excellent stuff, howardt ā€“ thank you!

Iā€™ve been fiddling with the curve-to-mesh script, and in general I can get better results with that one, although my feeling is that this addon can do just as well. The main difference is that curve-to-mesh gives you immediate feedback, while this script requires that the settings be adjusted before execution.

Iā€™m no coder, so forgive the ignorance: how difficult is it to get some kind of visual feedback as we adjust the settings? The settings would be in the 3D window, not the open-file windowā€¦

Thanks for trying it benu. I too would like what you are asking for, and will look into how to do that. Iā€™ve seen one example of how to do it, but it didnā€™t involve a file chooser, so it may or may not be easy to copy.

Here is another version, 0.5. This one attempts to do what benu asks, but it is imperfect - you have to select a file from the properties, and after you choose one, you have to change a parameter to see something happen.

Also in this version is a first attempt at extrude and bevel options. The bevel is ā€˜smartā€™ in that it isnā€™t confused by, e.g., serifs on letters. E.g.:

Attachments


Oh, yea! Just started fiddling with it. This is GREAT! I also get feedback on results if I change the Subdivision methods; so the differences are immediately apparent. LOVING IT.

The bevel feature is awesome as well. This addon is a huge step forward for bringing complex illustrator files to life in Blender.

One possible feature that might be useful (and hopefully not too difficult to implement!) would be an option to cap both ends when extruding. Thanks, howardt!

Thanks again for the feedback, benu. Indeed, it will not be hard to add an option to cap the back too when extruding.

Been using this addon extensively for the past several hours (perfect timing for a project Iā€™m in the middle of). Here are some additional thoughts:

  • It would be great to have feedback on the vertex/face count. Blender will give me feedback on the entire scene, but it doesnā€™t seem to do it for the individual object while using the addon. (Something like ā€œVe:280 Fa:184ā€ like Blender already uses.) It turns out the ā€œEvenā€ division usually produces the fewest vertices with the best results (IMO).

  • The addon keeps renaming stuff! If I import ā€œcar_red_top_view.aiā€ it renames the object to ā€œCar Red Top View.ā€ I am renaming every file I import, because I need to keep the underscores and lowercase lettersā€¦

  • When importing an AI file, I first have to change one of the parameters before the mesh appears. Itā€™d be nice if the preview happened automatically after selecting a file (or maybe a ā€œlive previewā€ checkbox or something ā€“ I can see why someone might not want to have a preview but simply execute).

Occasionally, the addon stops working after a while (I can run through the movements, but no mesh is created). If I create a new .blend file, it will work again. Iā€™ve been trying to nail down exactly what causes this, but havenā€™t been able to isolate it yet. Iā€™ll keep you updated. My gut feeling is that it has something to do with the final execution of the script (which I have been doing by tabbing in and out of Edit mode): I suspect that Iā€™m forgetting to commit the addon, then do something else. Working on itā€¦

Iā€™d like to compare this with the curve-to-mesh addon, but for now this addon is working great for my needs. Iā€™ll definitely let you know when I am able to compare the two addons. Thanks again!

Thanks again benu for your great testing and suggestions.

This seems like it should be very easy to add as a label in the properties panel.

  • The addon keeps renaming stuff! If I import ā€œcar_red_top_view.aiā€ it renames the object to ā€œCar Red Top View.ā€ I am renaming every file I import, because I need to keep the underscores and lowercase lettersā€¦

I canā€™t even imagine where it is getting the name from. Iā€™ll investigate.

  • When importing an AI file, I first have to change one of the parameters before the mesh appears. Itā€™d be nice if the preview happened automatically after selecting a file (or maybe a ā€œlive previewā€ checkbox or something ā€“ I can see why someone might not want to have a preview but simply execute).

This is a bug. What I want to happen is that when you select the menu item, it goes straight to the file selector, and after you hit the import button on that, it does the first import but leaves the settings up for further tweaking. Second best would be the current behavior, where you have to select the file-selecting icon in the panel after doing the menu select - but then the very act of selecting a file should be enough to cause the first import, and it isnā€™t. This seems to be a bug in Blender [thanks Domino, who helped with this on another thread], but I will continue to try to find a workaround.

Occasionally, the addon stops working after a while (I can run through the movements, but no mesh is created). If I create a new .blend file, it will work again. Iā€™ve been trying to nail down exactly what causes this, but havenā€™t been able to isolate it yet. Iā€™ll keep you updated. My gut feeling is that it has something to do with the final execution of the script (which I have been doing by tabbing in and out of Edit mode): I suspect that Iā€™m forgetting to commit the addon, then do something else. Working on itā€¦

If you can narrow this down some, let me know. I havenā€™t run into this problem myself yet.

Iā€™d like to compare this with the curve-to-mesh addon, but for now this addon is working great for my needs. Iā€™ll definitely let you know when I am able to compare the two addons. Thanks again!

Youā€™re welcome. It is great to hear that this is of use to someone.