Blender
importing 
Bézier's curves paths 
in "SVG" format
Version Française
    Main   Index
Previous importing GIMP paths format
Saving 3d mesh UV Coordinates Next
Actions
Changelog
External Links
Download
Download the script svg2obj_059o.py (updated : April, 20th, 2009)


Actions : recognized commands
 

  ...
Actions=   {   "C" : courbe_vers_c,
                 "A" : courbe_vers_a, 
                 "S" : courbe_vers_s,
                 "M" : mouvement_vers,
                 "V" : ligne_tracee_v,
                 "L" : ligne_tracee_l,
                 "H" : ligne_tracee_h, 
                 "Z" : boucle_z,
                 "Q" : courbe_vers_q,
                 "T" : courbe_vers_t,
                 "c" : courbe_vers_c,
                 "a" : courbe_vers_a, 
                 "s" : courbe_vers_s,
                 "m" : mouvement_vers,
                 "v" : ligne_tracee_v,
                 "l" : ligne_tracee_l,
                 "h" : ligne_tracee_h, 
                 "z" : boucle_z,
                 "q" : courbe_vers_q,
                 "T" : courbe_vers_t
}

TAGcourbe=Actions.keys()

Changelog
 

0.3.6 : -  code added code to solve problem between  Lineto and Curveto

0.3.7 : - code correction  for bezier knot in Curveto command

0.3.8

 - code was aded to manage quadratic bezier,  Q,q command and T,t commands, as a normal  blender bezier point 
- The last modications does not work with gimp 2.0 svg export . 
0.3.9
-   Path's A,a  command for ellipse's arc  .
0.4.0
-  To speed up the function filtre_DATA was removed and text variables are changed into numeric variables. 
0.4.1
svg, groups and shapes hierarchy  added
- now transform properties are computed  using a stack  with all parented groups
- removed or replaced useless functions :
- skewY, skewX transforms
- radians in rotate transform .
0.4.2
- Added functon to translate others shapes in path 
              rect, line, polyline, polygon, circle, ellipse
0.4.3
- - various corrections 
            text font (id property exported by Adobe Illustrator are between coma)
            function  to code  s tag has been  rewritten.
0.4.4 :

           - - various corrections 
                to oblige the script to understand a line feed just after 
                a tag . Rarely encountered problem, but it exits in a svg file
                format exported by a outliner script for mesh .

0.4.5 : - update for CVS, at least blender 2.38 and upper
                no BezTriple module in older version
                added a createCURVES function to avoid to use
                the OBJ format export/import .

                Perhaps problems with cyclic curves . If a closed curve 
                does not appear closed in blender, enter edit mode select 
                all  knot with Akey,  do a Hkey to handle type , and finally use the Ckey.
                Should work ... not guaranted .

0.4.6 : improvement of the cyclic curve state .

0.4.7 : - Management of the SVGZ files . The complete python or the gzip.py 
                script is needed . 
              - Little improvement of the curve drawing using the createCURVES 
                function end the beztriple objects .

0.4.8 :  - short modif for a fantasy font case in the OOo svg format 
               ('viewbox' is written 'viewBox', for instance) .
               Note that (at this time, 2006/05/01, 1OOo exports in svg 
               but does not read its own export 

0.4.9 : - skipped version : private test 

0.5.0 : - the script worked perfectly with Blender 2.41 but in Blender 
              2.42, use the original svg name file + 'OOO.obj' to
              write a videoscape file made blender crash under window XP when 
              the script loaded it . Curiously, use a more simple 
              name with a sole 'O' solved this problem .

              - script returned errors on open path : corrected 

              - in b2.42, several successive imports seem to be added to 
                the same original curve . So now the script automaticaly 
                renames the  last group of imported curve with the original 
                name file . 

0.5.1 : - without join option in the internal curve creation function

0.5.2 : - the createCURVES() function has been cleanded . Now it works
                fine but all bezier curves are joined in the same curve object .

0.5.3 : - removed two things :
                  1/ the ajustement function to increase speed . 35 % faster :
                      5690 curves and 30254 points in 11 seconds . User should do 
                      a ctrl-a on the object .
                  2/ the import method menu . No reason to choose between the
                     old and the intern curve creation this last one is largely
                     faster .
0.5.4 : - translation of the functions' name + improvment in the dict lookup .
              Quite 15% faster . 9.75 seconds instead of 11 to load the file test . 
              A test was also added  to find the fill style so now the script closes
              these curves even if they are not defined as closed  in the strict path
              commands . 
               The old non used functions have been completely removed .

0.5.5 : - improvement to get a better filling up when the script imports a 
                  drawing made with a bundle of flat lines .

0.5.6 : -    Exec was removed from the collect_ATTRIBUTS function .
               Other uses was evaluated.
               a  lot of print was removed to.
0.5.7 :   Wash down of some handle problems (not really easy to find).

0.5.8
             Wash down of the last exec and correction of a
             problem with the curve's first beztriple handle 
             which was not recorded at first time . 
            - Added some units managements
            - Correction of the  rotate matrix 
            - Correction of the  skew  matrix 
            - change in the wash_DATA function suggested by cambo 
            - added __slot__ in class Bez, ITEM and CURVE suggested by cambo
            - remove unused properties in class ITEM and CURVE

0.5.9 :
         - many improvements for faster and clearer code 
          suggested by cambo and martin.
        - replacement of "%s" statement by str function.
        - correction of an error in the scale transform management 
        - correction in the management of the stack transformation 
          that rises an error under python 2.5 but curiously not with 
          python 2.4

       0.5.9a : - 2007/3/29
         -  Again a lot of minor corrections 
         -  Backward to 0.5.8 of the function that manages float numbers exported
             by the  Adobe Illustrator's SVG.  After a lot of tests it seems that this oldest
             version is also faster too. 
      0.5.9b : - 2007/3/31
         -  one or two minor corrections 
         -  now the new object curve is added in the current layer.
         - short modif in the scale menu...
       0.5.9c : - 2007/4/4 
         -  when a svg file containts several curves they might be imported in separate object.

  •        0.5.9d : - 2007/4/5 
         -  management of paths' name when paths are imported as separate curves.
         -  now it is possible to select between separate and grouped curves 
            so  a was added menu 
        -  management of colors 
       0.5.9e : - 2007/4/7 
         - corrected a scale problem that only appears when one uses beveldepth
         - in separate curve option, ,ame is also given to the curve data 
         - added the list of svg's color names and modified the color's method 
          to work with.
       0.5.9f : - 2007/15/7 
         - many bugs on colors and naming curve corrected 

       0.5.9h : - 2007/5/2 
              - script was updated with the modifs by cambo
              - removed all debug statements
              - correction of a zero division error in the calc_arc function.

      0.5.9i : - ??/??/?? 
              - Patch externe réalisé sur blender.org project.

      0.5.9j : - 2008/11/8 
         - anothers bugs on colors naming corrected 

      0.5.9k : - 14/01/2009 
              - correction of the  Bug is caused by scientific notation numbers

0.5.9 l&m : - 01/02/2009 
              - correction of the  Bug is caused by scientific notation numbers (again) and 
              management of some details in the strings that describe paths.
            - Correction of the  bug that blended curves after severals imports and a bug on 
              the management of the Current point.

0.5.9 n : - 01/02/2009 
- Correction of the management of the redundat data for a single command (arc and  lineto).
- Newe correction of the management of the Current Point (updated before that a new path is created).

Before

After

These two corrections make possible the reading of the svg  files exported from Inkscape.

0.5.9 o : - 20/04/2009 
The  SVG files from  Adobe Illustrator are often very  bulky because they come with Pattern made of a lot of paths. For example,  a  simple star can be described by this sole line :
 
<polygon points="55.901,118.693 41.109,78.969 0,68.635 33.209,42.291 30.335,0 65.651,23.443 104.983,7.642 93.601,48.473 
 120.784,80.998 78.434,82.79 "/>

...when the file weights  96830 bytes. The rest is is made up by teh description of the pattern which we do not import (a bit repetitive).

However if we want to keep the pattern, there is an option for that  :

Fichier d'exemple fourni par un aimable utilisateur du script 

External Links

Previous importing GIMP paths format
 Saving 3d mesh UV Coordinates Next
To the  Top of the page

Les questions concernant cette page  peuvent être posées sur  :
 news://news.zoo-logique.org/3D.Blender


 

 

Livre en français
Blender : apprenez, pratiquez, Créez, livre, Ed. Campus Press, coll. Starter Kit
Blender Starter Kit

Forum
FAQ
Lexique
Didacticiels
Compilations
Blender2KT
Débuter
Modelage
Blender python
Materiaux
Lumière
Animation
API python (eng)
Archives nzn
Statistiques
Doc flash Sculptris
Galerie Sculptris

Les Fralibos sur youtube, soutien au personnel de Fralib de Gémenos