Page MenuHome

Export Paper Model
Closed, ArchivedPublic

Description

This add-on exports the active Mesh object as an SVG document ready to be printed and crafted into a real-world model.

For basic testing or simple models, it is enough to run the Export Paper Model operator and pick a file name. Multiple files will be created if more pages are necessary, since some vector editors (such as Inkscape) cannot handle multipage SVGs.
Models containing N-gon faces (N > 3) may produce a distorted net and models containing doubled vertices, edges or other such ugly phenomena may cause the script crash.

The layout of the net can be customized using Seams, representing the edges to be cut. A preview of the result can be obtained by running the Make Unfoldable operator and viewing the separated islands in the 3D View (controlled in the Toolbox) or in the UV editor, if that option is enabled during unfolding. The operator will soon be renamed to Unfold.

Further details and part of the algorithms used are described in the manual page on Blender wiki.

Current version (at the time of posting) of the script for Blender 2.69:


Current version of the script
A prerelease version for Blender 2.70, including tabbed interface.

The script uses tabs for indentation because I just like them. However, if that is a problem, I can of course convert to spaces.
I posted this addon as a patch two years ago, but that one is closed now as the script was not working properly back then.

Details

Differential Revisions
D283: Export Paper Model
Type
Patch

Event Timeline

Adam Dominec (emu) updated the task description. (Show Details)
Adam Dominec (emu) raised the priority of this task from to Needs Triage by Developer.
Adam Dominec (emu) added a project: Addons.
Adam Dominec (emu) set Type to Patch.

I forgot to mention the corresponding BA.org thread. I use it for announcements and people mostly use it for reporting bugs.

Brecht Van Lommel (brecht) triaged this task as Normal priority.Feb 3 2014, 12:29 PM

I currently commit updates to the prerelease branch on github. I mostly cleaned up the code, and I should yet fix the Limit Island Size functionality.
Then, I will post the file as an attachment again.

I'm not in much of a hurry anymore since I was told the script can't get to the 2.70 release anyway.

Thanks for the 2d cross product :)

I also wont have much time to review or give feedback, its a good target to have this ready, after 2.70. typically its good to submit features well before release date.

I cleaned up the code and did a few other fixes. There are still many improvements to make, but I believe the code is ready for review.
The current version is here:

. Eventual updates will be on github (the attachment corresponds to e48f68ef)

@Adam Dominec (emu), had a quick look

Suggestions:

  • use os.sep rather than / as path separator.
  • use __slots__ for all classes, avoids accidental attribute creation on typos and is more memory efficient.

Looks like we should support mathutils.geometry.normal() for any number of vectors (not just 3-4), but that will have to wait until after release.

I was not aware of __slots__, thanks. I added it to all the classes for mesh data, not to the singletons and operators. It even made a performance boost of about 10% on my system :)

Regarding os.sep it's a bit trickier because (I believe) the SVG file needs paths separated by forward slashes. Now I wrote that explicitly as a string replacement. I suppose the script was actually broken on Windows, but nobody told me :-/

The updated file is in git and also here:

.

Adam Dominec (emu) added a comment.EditedNov 13 2014, 12:14 PM

Hello,
could somebody please check this script (the updated differential revision)? I made a lot of fixes and improvements, and I'd love to get it into a release.
EDIT: the github link seems to be broken. Try this one instead.

hi, closing this task, addon is now in contrib
for future patches/updates please create a new task.
for bug reports: https://developer.blender.org/maniphest/project/3/type/Bug/

I love this add-on! I use it extensively, however I often get a Traceback error that I just can't get around. I'm teaching kids modelling and we plan on making paper craft sculptures, the add-on however is not reliable enough for using in a school setting. I hope you can help me figure out what is wrong. Thank you!!

Report Error
Traceback (most recent call last):
File" Applications/Blender/blender.app/Contents/Resources/2.7/scripts/addons_contrib/io_export_paper_model.py", line 1837, in invoke self.unfolder.prepare(cage_size, create_uvmap=self.do_create_uvmap, scale=sce.unit_settings.scale_length/self.scale)
File"
Applications/Blender/blender.app/Contents/Resources/2.7/scripts/addons_contrib/io_export_paper_model.py", line 160 in prepare self.mesh.generate_cuts(cage_size/scale if cage_size else None, priority_effect)
File" Applications/Blender/blender.app/Contents/Resources/2.7/scripts/addons_contrib/io_export_paper_model.py", line 284, in generate_cuts if island_a.join(island_b, edge, size_limit=page_size):
File"
Applications/Blender/blender.app/Contents/Resources/2.7/scripts/addons_contrib/io_export_paper_model.py", line 1003, in join segments.sort(key=slope_from(position))
File"// Applications/Blender/blender.app/Contents/Resources/2.7/scripts/addons_contrib/io_export_paper_model.py", line 904, in slope return (vec.y/vec.length + 1) if ((vec.x,vec.y) > (0,0)) else (-1 -vec.y / vet.length)
ZeroDivisionError: float division by zero

location <unknown location>:-1

Updated the addon to upstream revision 13d8334. That should solve this bug (and others).

@Sybren A. Stüvel (sybren) Thank you! I remember I had some issues with pushing to the addons-contrib repo, but I'll try again and add some more updates soon.

Hey guys,

I'm using quite a lot that add-on for few months. There are 2 bugs that are pretty annoying and time consuming:

  • Abreviation. I can't figure out if I do something wrong or if the script has a problem on that side. It only take the first number in count when automatically generating the abbreviation. So If you have 17 or 34 or whatever have 2 numbers ou 3 It only shows 3 or 1... Wo you have to manually rename all the islands abbreviation... what about to fix that incredibly wrong problem (for an add-on that helps you to generate blueprints it's pretty big)
  • Unfold again. If you already unfold a model and ask a new unfold, the island names become a pretty huge mess. You have multiple time the same name etc. It should just rip of all the names and do it again from scratch.

Anyone have these problems too?

Adam Dominec (emu) added a comment.EditedAug 6 2017, 10:28 AM
  • Abbreviation: fixed in rBAc960569 (upstream 1daeb8).
  • Unfold again: this behavior is on purpose, so that Unfold does not discard all your work on island naming. It never assigns a name twice (unless you already have this conflict in the original list).

Hey Adam,

Thank you for fixing it. I'm a bit new to the developper side. Where can I get the updated script? At the top of the page?

About the Unfold again, I understand the point but in my case it always mess my work up. As soon as I had new Seams on the mesh (i.e. if islands are to big for the paper size I chose) and click Unfold another time, it gives me like 10 islands with the same number etc.
It never did the right job of renaming all the island without duplicates.
The only option, to not have duplicates, is to remove all seams and let it create it by itself, but it's not what I want as I know what I'm doing :)

Maybe I do something wrong.. I really don't know

Maxence,
this task (38441) is closed and the links at the top of this page don't work anymore. You can download the file from blender addons repository or from github, currently these are both the same.

Can you please check that the naming is wrong, even with this version?
And if it is, what is exactly your workflow?
Do you use Auto Label, or do you set the island names by hand?

(I assume that discussion causes no harm here and I assign this outdated task to myself.)

I found a bug. my modell will not unfold in Blender. I have to triangulate it to work. In the untrigualated version I got " Error please report"

In pepakura it works all untrigulated find.

Christin, this task is closed. If you want to make a helpful bug report, please send it either to my e-mail or to BlenderArtists, and attach the model.

However, it doesn't even seem there is a bug. Some models cannot be exported without triangulation. The script could triangulate for you, of course, but that could damage your data -- that's why you have to call the Triangulate operator yourself.