Pantograph 0.5 is out.

Hmmm…, sorry I don’t use Windows myself anymore, since I discovered Ubuntu (which I strongly recommend). So I can’t help you with that. However I could transform the script to python, than you could add yourself the Windows support. What OS do you use yourself?

Have you had any experience in creating .deb files? This might be easier, and would lock in with the apt system better.
I have experience with packaging pure python code as deb files. But this doesn’t make sense as long Polygon is not packaged. I see that the license of Polygon is LGPL so we could try to get both Pantograph and Polygon first in a launchpad PPA and afterwards into the Ubuntu & Debian repositories. I can assist you with that, on the condition that you maintain the packages. (Polygon seems to be dead, so it shouldn’t be much work ;)) I maintain for example Phatch and SPE for Debian and Ubuntu. This only makes sense if you consider Pantograph stable, fix any reported bug (if any) and don’t plan a complete rewrite soon. Creating the initial deb file is the most work, maintaining it is a breeze.

It should handle text - basically, it just converts everything to meshes before rendering, so anything that comes out of the typical “alt-C” is what you get.
OK, I’ll try again once

Cairo is fantastic - I would love to find a really good GPL 2D clipping library to pair with it! This version does away with the Polygon library (not GPL, quite a memory hog for larger meshes), but I must say I miss it.

There is no problem with LGPL. It is completely compatible with GPL (see http://www.gnu.org/philosophy/license-list.html). Did you try with the pyx graphics library, which is GPL. It offers clipping and is already in the Ubuntu repositories:
http://pyx.sourceforge.net/examples/drawing2/clipping.html

Stani,

Text seems to work fine on my end, besides the usual mis-clips (still working on those :-/)

What sort of problems are you having? Can you post an image?

RS

Stani,

I used Gentoo until I got tired of spending a lot of time compiling :slight_smile: These days Ubuntu. I do, however, want to try to serve the cross-platform goal wherever possible. Cairo seems to be the main problem - most of the binary packages for pyCairo for Windows also contain a lot of extra stuff (like GIMP).

Polygon is LGPL, but the GPC clipping library, which performs much of the work, is non-commercial only. The current bleeding-edge version doesn’t use Polygon, however, though the SVG files are much larger (this is especially bad for SWF). I need to re-write the algorithm that combines all of the polyline fragments at the end (that’s what takes a long time right now), but that shouldn’t be hard - Python is great for sorting stuff.

I think you’re right - packaging right now is premature, at least until this version settles down. I want to add a hook into the DXF-Exporter - this would be a very useful tool then!

RS

btw PyX looks interesting - I thought I had exhausted all the possibilities, but this one is new. I’ll check it out.

It just takes forever on:


Loading previous settings...
Rendering current frame...
Setting up camera:
        near clip: 0.100000
         far clip: 100.000000
     fov(degrees): 49.134342
            scale: 7.314286
Processing object Font
scene.link(ob) deprecated!
    use scene.objects.link(ob) instead
Triangulating faces...
Processing 5431 vertices...
Processing 10742 edges...
Processing 5351 faces...
Processing materials...
Processing object Cube
Triangulating faces...
Processing 8 vertices...
Processing 18 edges...
Processing 12 faces...
Processing materials...
Writing materials to Pen Settings...
Removing faces outside vignette...
Removing cutaway faces...
Sorting meshes into BSP tree...
. . . . . . . . . . . Sorting took 0.110 minutes
debug: Maximum tree depth is 5
debug: CLASSIFY calls: 397685
debug: SPLIT calls: 14
debug: Faces after splitting: 5377
Mathutils.VecMultMat(): Deprecated: use vec * matrix to perform row vector multiplication
Transforming to window coordinates took 0.001 minutes
debug: Initializing polyline and fill dicts...
Sorting 2d faces into BSP tree...
. . . . . . . . .
Clipping took 0.234 minutes
debug: Maximum tree depth is 35
debug: CLASSIFY calls: 576115
debug: SPLIT calls: 10197
Optimizing polylines and fills for smallest file size...

It is just the sample blend file with the cube and with a text added. If you want I can send you the blend file, as an image would not make much sense. How long can it take? Half an hour or several hours?

Did you consider using psyco? (Also on Ubuntu and available on Windows) I think it might give a huge speed boost. It is pretty clever technology.
http://psyco.sourceforge.net/

Try both psyco.full and psyco.profile to see which works best.
http://psyco.sourceforge.net/psycoguide/node8.html

You should have some example drawing and then benchmark with:

blender -b ar-docs/test.blend -P benchmark.py

Which is the latest version which uses Polygon? Is that one significantly faster?

I need to re-write the algorithm that combines all of the polyline fragments at the end (that’s what takes a long time right now), but that shouldn’t be hard - Python is great for sorting stuff.

I think you’re right - packaging right now is premature, at least until this version settles down. I want to add a hook into the DXF-Exporter - this would be a very useful tool then!

I’ll might do that for you. BTW I am the author of sdxf which Blender uses to export dxf drawings. I am coding a lot of new exciting python stuff for Blender now and on my todo list is a DXFSurface for Cairo. This means that you can just use your same code. As a bonus everything will be 100% python (except maybe matrices which can be provided by numpy or Blenders Mathutils). So it will work on Windows without installing Cairo itself! So I do a proposal: let me work on the cairo/dxf stuff and you can concentrate on the algorythm and testing pyx.

btw PyX looks interesting - I thought I had exhausted all the possibilities, but this one is new. I’ll check it out.
Let me know how it works. Pyx

These installers seem fairly small:
http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.4/
Do they not work standalone?

Replying too myself… There is indeed some additional work. These instructions are quite clear:
http://www.lorenzogil.com/projects/pycha#Installation

It is probably not so much effort to implement that as a Windows script.

I tried to install it by the script in http://pythonide.blogspot.com/2009/03/vector-rendering-with-blender-in-ubuntu.html, but then got this error.
I am using Ubuntu 8.10, blender 2.46

NameError: name 'HOMEDIR' is not defined

Can anyone help me plz? I realy want to try this plugin out.

Edit------------------------------------

I tried to add into pantographConfig.py:

HOMEDIR = "/home/mummim/.blender/scripts/"

And now when I run pantograph I got:

Traceback (most recent call last):
  File "<string>", line 759, in gui
  File "/home/mummim/.blender/scripts/pantographLib.py", line 1905, in __init__
    self.settings = Settings()
  File "/home/mummim/.blender/scripts/pantographLib.py", line 2209, in __init__
    if DEBUG:
NameError: global name 'DEBUG' is not defined
Traceback (most recent call last):
  File "<string>", line 759, in gui
  File "/home/mummim/.blender/scripts/pantographLib.py", line 1905, in __init__
    self.settings = Settings()
  File "/home/mummim/.blender/scripts/pantographLib.py", line 2209, in __init__
    if DEBUG:
NameError: global name 'DEBUG' is not defined
Traceback (most recent call last):
  File "<string>", line 759, in gui
  File "/home/mummim/.blender/scripts/pantographLib.py", line 1905, in __init__
    self.settings = Settings()
  File "/home/mummim/.blender/scripts/pantographLib.py", line 2209, in __init__
    if DEBUG:
NameError: global name 'DEBUG' is not defined

Stani-

Good find! I dimly remember writing batch (.bat) files in Windows - basically the same as a shell script.

pyX doesn’t provide many answers - it doesn’t seem to do any booleans for fills - clipping polylines is easy and done.

That’s fantastic about Cairo and dxf - that will keep the dependencies down. I would love it if Blender just built with Cairo - I guess its out of the animation-centered mission, though.

I know what you’re saying about the text - when it’s converted to a mesh, it creates a lot of triangles. Currently the polyline-combiner is just searching for open ends and combining them. I need to implement a basic scan-line algorithm which doesn’t search through all other polylines each time.

Version 0.5 uses Polygon - though the optimization is still done all in Pantograph. The new clipping is actually considerably faster - its just that its now uncovered an extremely inefficient algorithm on the other end. :slight_smile: I’ll take a stab at it tonight - I may be able to knock it out fairly easily, now that I’m thinking about it.

RS

@Mummin:
Here’s an “improved” version of that script, now that a few bugs have been taken care of - see if this works:

#!/bin/bash

#install most dependencies
sudo apt-get install -y python-ming python-cairo

#go to home blender dir
HOMEDIR=$HOME/.blender/scripts/
cd $HOMEDIR

#remove previous pantograph
rm pantograph*
rm *.pog
rm *.pen

#install pantograph (bleeding edge)
wget [http://home.earthlink.net/~severnclay/pantograph_bleedingEdge.zip](http://home.earthlink.net/%7Esevernclay/pantograph_bleedingEdge.zip)
unzip -o -j  pantograph_bleedingEdge.zip -d ~/.blender/scripts
rm pantograph_bleedingEdge.zip

Hmmm… well Blender might never be built with Cairo, but there is were my surprise peaks around the corner. Just a little patience, I am working on it. It is not just about Cairo and dxf, it is more…

Actually it would be nicer for the distribution, that you would change this hard coded personal path in pantographConfig.py:

HOMEDIR = os.path.expanduser('~/.blender/scripts/')

It would be better for Windows too: one less issue to tackle.

You might also include Polygon inside the zip archive. This would make it easier for cross-platform script.

Have you tried psyco for speed improvement? I am curious.

That’s a pitty. I know Inkscape supports boolean operations for fills. Which library would they use. Maybe it is not that difficult to access that library from python with ctypes.

Still not working. I got “NameError: name ‘HOMEDIR’ is not defined” after exceuting your script:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-ming is already the newest version.
python-cairo is already the newest version.
The following packages were automatically installed and are no longer required:
  libsm-dev libice-dev x11proto-xext-dev libatk1.0-dev x11proto-kb-dev
  x11proto-xinerama-dev libpango1.0-dev x11proto-render-dev libxi-dev
  libxrender-dev libcairo2-dev libxdmcp-dev libpng12-dev libfontconfig1-dev
  x11proto-composite-dev xtrans-dev x11proto-core-dev libxcursor-dev
  x11proto-randr-dev x11proto-damage-dev libdbus-1-dev libxcb-render-util0-dev
  libgtk2.0-dev libxext-dev libxdamage-dev zlib1g-dev libxml2-dev
  x11proto-input-dev libfreetype6-dev x11proto-fixes-dev libpthread-stubs0-dev
  libxau-dev libdbus-glib-1-dev libpthread-stubs0 libxcomposite-dev
  libxrandr-dev libexpat1-dev librsvg2-dev libpixman-1-dev libxft-dev
  libx11-dev libxcb-xlib0-dev libxcb-render0-dev libxfixes-dev libxcb1-dev
  libxinerama-dev
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
rm: cannot remove `pantograph*': No such file or directory
--2009-03-11 21:47:24--  http://home.earthlink.net/~severnclay/pantograph_bleedingEdge.zip
Resolving home.earthlink.net... 207.217.98.16, 207.217.98.17
Connecting to home.earthlink.net|207.217.98.16|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 42320 (41K) [application/zip]
Saving to: `pantograph_bleedingEdge.zip'

100%[======================================>] 42,320       107K/s   in 0.4s    

2009-03-11 21:47:25 (107 KB/s) - `pantograph_bleedingEdge.zip' saved [42320/42320]

Archive:  pantograph_bleedingEdge.zip
  inflating: /home/mummim/.blender/scripts/pantograph.py  
  inflating: /home/mummim/.blender/scripts/pantographConfig.py  
  inflating: /home/mummim/.blender/scripts/pantographLib.py  
  inflating: /home/mummim/.blender/scripts/progressImage.png  
mummim@mummim:~/Desktop$ blender
Compiled with Python version 2.5.2.
Checking for installed Python... got it!
Traceback (most recent call last):
  File "<string>", line 63, in <module>
NameError: name 'HOMEDIR' is not defined

I tried to add

HOMEDIR = "/home/mummim/.blender/scripts/"

to pantographLib.py and got this again.

"Traceback (most recent call last):
  File "<string>", line 759, in gui
  File "/home/mummim/.blender/scripts/pantographLib.py", line 1905, in __init__
    self.settings = Settings()
  File "/home/mummim/.blender/scripts/pantographLib.py", line 2209, in __init__
    if DEBUG:
NameError: global name 'DEBUG' is not defined
"

Edit----------
Almost forgot. ^^
Thx for your help, you guys are the reasons I choose freewares.

Stani,

Ok - I re-wrote the optimization step - actually a lot easier than I thought. Should be faster now.

I also took your advice about HOMEDIR - nice trick.

Anyway, download bleeding_edge again and try it.

Best,
RS

Ok, trying to install this.

Started with my Windoze XP box. :

Polygon 1.17 - setup.py install


error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries. 
Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try 
compiling with MingW32, by passing "-c mingw32" to setup.py.

I don’t want to install mingw32 right now, so tried on my Linux shell account.

running python (2.44) python setup.py install --install-home=$HOME
yields :


error: option --install-home not recognized

So I’m stuck right away, is this a problem with how the Polygon 1.17 setup.py file has been setup ? / with the version of python / … with the phase of the moon ? :evilgrin:

Mike

Hi, I’m interested in the Pantograph render, but I can’t get it to work.
I installed it with Stani’s script and when executing the script it gives an error.
It seems to have problems finding the Polygon Library:

Polygon Library not found - your files will be larger as a result
debug: reloading pantographLib
Polygon Library not found - your files will be larger as a result
Rendering current frame...
Setting up camera:
        near clip: 0.100000
         far clip: 100.000000
     fov(degrees): 49.134342
            scale: 7.314286
Processing object Cube
scene.link(ob) deprecated!
    use scene.objects.link(ob) instead
Triangulating faces...
Processing 8 vertices...
Processing 18 edges...
Processing 12 faces...
Processing materials...
Writing materials to Pen Settings...
Removing faces outside vignette...
Removing cutaway faces...
Sorting meshes into BSP tree...
. . . . . . Sorting took 0.000 minutes
debug: Maximum tree depth is 5
debug: CLASSIFY calls: 534
debug: SPLIT calls: 0
debug: Faces after splitting: 12
Mathutils.VecMultMat(): Deprecated: use vec * matrix to perform row vector multiplication
Transforming to window coordinates took 0.000 minutes
debug: Initializing polyline and fill dicts...
Sorting 2d faces into BSP tree...
. . . . . . . . Clipping took 0.000 minutes
debug: Maximum tree depth is 4
debug: CLASSIFY calls: 469
debug: SPLIT calls: 21
debug: JOIN calls: 0
Traceback (most recent call last):
  File "<string>", line 761, in gui
  File "<string>", line 293, in progressMenu
  File "/home/elstudio/.blender/scripts/pantographLib.py", line 1899, in optimize2d
    if POLYGON and drawing.settings.OPTIMIZE_FILLS:
NameError: global name 'POLYGON' is not defined
debug: reloading pantographLib
Polygon Library not found - your files will be larger as a result

Anybody who had the same, and knows a solution?

Same Problem on Ubuntu 9.10…
Maybe should we compile Polygon…?

EDIT: I have installed the .deb of Polygon (1.17), but the polygon folder is only install in 2.4 Python Folder…or i used only Python 2.6.

maybe moved polygon script in python’s 2.6 directory…?

Hi,
i followed the instructions on the first post (but with Gimp 2.6) and i don’ t get “Pantograph” in the render scriptwindow … :no:
Any clue ?.. maybe due to Gimp 2.6 ?..
Try testing on XP AMD Athlon LE-1620 2,4 32 bits SP3 and Blender 2.48.1 official release.
THX !

YDT

Hi,

I made symlinks (ln -s) between the Python 2.4 files and the Python 2.5 files - this seems to work.

The Bleeding Edge version on the website can operate with Polygon - you should give that one a try, too.

RS