Export Paper Model

add-ons

(DavidOne_1) #21

I found something strange in the Tab Size: settings after pressing the Export Net… button. I changed the measuring system to Imperial before clicking on Export Net… and when I go there to try to adjust the size of the tab and move the slider it starts to change from mil to "(inches) erratically. When you choose Metric it changes in centimeters alright and in Blender units (None) you don’t have problems either but if I choose Imperial it becomes a mess when I move the slider. A script bug? A Blender 2.5 bug?


(emu) #22

The script can create textured output. When you uncheck Pure Net, the model is simply baked as it is. So you have to assign a material to it and set Face Textures and probably also Shadeless.
Since this might be the most often usage, I will try to simplify the process somehow. I could add an option that, if checked, bakes the current UV texture as shadeless. And maybe the main checkbox shouldn’t be called Pure Net, but something you are looking for - perhaps Textured Output.
By the way - isn’t it uncomfortable that the script adds seams? I might make a warning about it or let the script mark edges as sharp instead.
And it doesn’t have to mark them at all when run in not-interactive mode (File > Export > Paper Model).
Tell me what behaviour you would expect from the script. These changes are no hard to code, but I need some help with the so-called UI design :slight_smile:

I thought they do accept a fill colour, actually they should be semi-transparent white by default. Inkscape (or any other editor) should fill the shape even if it’s not closed path. It works to me in Inkscape, but if there are any troubles, I’ll change it to closed rectangles. Just to make me sure, tell me again please.

That’s not intentional, it’s a bug I haven’t fixed yet. The script handles all edges separately, so it creates the outer line in random order. But of course it is possible to solve.

Well, I’d like to keep support for quads (or, in future, N-Gons). If they are all flat I see no reason the script should fail, and I hate scripts that fail without a reason. The best solution as it seems to me is throwing a warning about possible distortion - or, better, an option box continue/cancel.

Interesting. By the way, I think it occurs with metric unit system too. It’s either that I’m using an API function badly or that there really is a bug in blender. If so, I would add it to the tracker.


(Écrivain) #23

If anyone can’t get it to work on latest builds it’s because of rna api changes (revision 29905); simply change line 91 from

self.mesh=Mesh(ob.data, ob.matrix)

to

self.mesh=Mesh(ob.data, ob.matrix_world)

Edit: 2 more things weren’t always working.

  1. Occasionally I got a ZeroDivisionError on line 824 in Sticker -> init, it’s the division by sin_a and right below by sin_b
  2. On line 715 in class UVVertex and definition eq it would say “AttributeError: ‘NoneType’ object has no attribute ‘data’”

Both were easy to workaround and both were found by making a torus unfoldable and exporting.


(emu) #24

Thanks. Fixed in the git repository.
Edit: 2 more things weren’t always working.

These are easy to workaround, but hell, there’s something terribly wrong with the code. Such errors should just not happen.
So I don’t fix these bugs directly (as long as the project is in WIP state :stuck_out_tongue: ), but I will look through the code and eliminate them sooner or later that way.

EDIT: Does the ZeroDevisionError really occur in the current version from Git repo? There should already be an if-else fork to handle it.


(Oldenburger67) #25

Hello EMU,

i have seen this thread with your new Blender Script.
Great stuff, thanks a lot.
Though i am using still Blender 2.49.
I copied your script into the Blender Script Folder. But when i started i couldn’t find it.
Does it run under Blender 2.49.
And when, how do i start it.??

Thank you ver much

The Oldenburger


(emu) #26

Oldenburger:: No, this script works with blender 2.5 only. Download the recently released beta.

No python plugins are directly compatible because blender 2.5x uses a newer version of Python and has a completely redesigned (and still changing) API.


(DavidOne_1) #27

Oh, about the closed filled gluing tab shapes I see your point, you realized that you only needed the three lines cause in Inkscape you can give it a fill even if it is missing an edge.

That is really not bad thinking there but there is still a problem which is that not all people will be using Inkscape and in some other illustration programs you can’t fill a shape unless it is completely closed.

For example in Illustrator you can fill the shape just as it is now too just like in Inkscape but in CorelDraw you can’t fill the shape unless it is closed.

Overall in illustration you work a lot with closed shapes. This is not always the case but I have many, many years of experience with illustration programs and I feel that it is usually better to closes shapes that are intended as fill color shapes and one of the reasons of that precisely is to maintain compatibility with different vector illustration software to prevent incompatibility in translations from one program to the other or one vector format to the other cause if for example I draw something in Illustrator and the I want to translate it later to CorelDraw and I don’t close the fill color shapes when I open it in CorelDraw it comes out as all white so to prevent that I usually close color fill shapes and if I need a color shape with an open line what I do is to draw another line without any fill over the other and it is easy to do that by making a copy of the filled shape pattern and turning it into a line with no fill and then deleting a part of it but I only need to do that here and there and this also depends on what type of artwork I’m doing.

Don’t get me wrong, if this is too difficult to do it is OK cause after all it is already much better than the way it was and I can’t expect the script to be perfect from the night to the morning cause you say that it is a work in progress but if you want my honest opinion I feel very strongly from my experience with illustration software that it would be ideal that the shape was closed but like I just said that would be ideal and not an absolute thing.

Thanks anyway for improving it as you have done.


(emu) #28

DavidOne:: Thank you for your exhaustive explanation :slight_smile: The compatibility issues are a strong point.
It was not difficult to change, actually just a single mark in the SVG code was needed. Updated in git repo.


(Vilem Duha) #29

Hello emu, this is a great script indeed, thanks for it! today I tested it.
It was throwing a bug, where I had to make a check in the function eq on line 721 inside of the UVVertex class definition.
the check was :
if self.vertex!=None and other.vertex!=None:
here the original function
else: return 0

after this the script worked. I don’t know why, but sometimes the script just passed an uv without the vertex, and because I didn’t know how to better fix it, I just put in this hack.


(emu) #30

That happened really often (btw, Écrivain mentioned it a few days before). I solved it a bit deeper in the code, although your solution should not cause any trouble.
You can download the new version from git repository.


(pcgirl) #31

Ow, My head! I tried to follow this thread, but I got a headache. :smiley: Thanks for doing the script - I hope it works for me. :slight_smile:


(DavidOne_1) #32

You did fix the closed tabs issue, terrific! Now it works they way it should, excellent!

Now that the tabs appear as closed shapes in the pattern what does the Last Connecting button does? Wasn’t this the button that determined if the tab line were going to be a continuous line or separate shapes?

I didn’t get any effect by changing its value now no matter what. Is there a problem with it or you are going to eliminate that slider now? :confused:

Anyway very well done on the closed glue tab fix, I know that many designers are going to love that.


(emu) #33

These sliders are just debug settings. If you are curious about them, you can read how the algorithm works on the wiki. But for normal usage, they are not needed and I’ll remove them in a stable version.


(DavidOne_1) #34

Understood. Great job on the glue tabs. The way the script is going it seems that is going to be very complete by the time the new Blender is fully done. :slight_smile:


(Re2deemer) #35

Hi, I found this script and decided to give it a try. However, for some reason, the script seems to dislike A specific model of mine. I’ve tried it with other models too and it doesn’t unfold them either, only very basic models get unfolded. it doesn’t display any eror messages or anything, it just doesn’t export the .svg. I’m using Windows XP and tried this with both Blender beta 3 and the newest version from Graphicall (31001).
If you’d tell me what is wrong in the model, I’d appreciate it.


(emu) #36

The error is caused by topology. I’ve forgotten that there can be more than two faces connected to a single edge.
In your model you have seven faces inside of the body: the simpliest solution is to delete them (or, to split them into separate submeshes), then the export works.
I don’t know yet how to solve this in the code, but undoubtedly it’s a critical bug.

And btw. the exported net will still not be usable. There are two main issues (that I should solve) in the way:

  • In the model, you have quad faces that are not completely flat. You should turn them into triangles (Ctrl+T)… and the script should notify you about it.
  • The seams are chosen nicely, but there are more needed: the generated net would have many overlapping faces. The script should manage it automatically, but until it does, you can find the problems in the net and guess which edges to mark.

Thank you for the testing :slight_smile:


(AntonNazarov) #37

Addam aka Emu hi,

I’m very interested in unwrapping non trivial meshes for the paper modelling.
I upgraded a version of Blender to 5.3.4 (from blender.org) and when I’m trying to enable your script (the flesh one of version 0.6) I have the following diagnostics in the Blender- console (see below).

Could you please have a look, it seem that API was changed slightly by authors of Blender?

thanks!

found bundled python: C:\ANTON_~1\BLENDE~1.54-\2.54\python
Traceback (most recent call last):
File “C:\ANTON_~1\BLENDE~1.54-\2.54\scripts\ui\space_userpref.py”, line 1086,
in execute
mod = import(module_name)
File “C:\ANTON_~1\BLENDE~1.54-\2.54\scripts\addons\export_paper_model.py”, lin
e 1143, in <module>
class VIEW3D_paper_model(bpy.types.Panel):
File “C:\ANTON_~1\BLENDE~1.54-\2.54\scripts\addons\export_paper_model.py”, lin
e 1148, in VIEW3D_paper_model
bpy.types.Scene.FloatProperty(attr=“unfolder_output_size_x”, name=“Page Size
X”, description=“Page width”, default=0.210, soft_min=0.105, soft_max=0.841, su
btype=“UNSIGNED”, unit=“LENGTH”)
AttributeError: type object ‘Scene’ has no attribute ‘FloatProperty’


(emu) #38

Anton, thanks. The API changes all the time and I am getting too lazy, unable to keep in sync.
But I’ve looked at the script two days ago and did some fixes, so that it works with 2.54.

You have to get a current version from my git repository, though.
(I’m going to update the main link when I finish my current plans, that is notifying about tilted quads and other big changes in the UI)


(AntonNazarov) #39

Addam,

Thank you! It is working!

regards,

Anton


(mikesgames) #40

This rocks. A bit confusing on the first attempt to use, but now i know how to use it, i love it :slight_smile: