I made this commands to make paper models, and I ask if it is possible to have a 3D view of them converting in tikz-3D, or backward. But it's easier to draw the flat model and generate the volume after. Calculations could be made with lualatex. If you have an idea to follow ?

enter image description here

enter image description here


        line join=round,
        rounded corners=.05pt,
        draw, thin},
    patron side/.style={patron},
    patron languette/.style={patron},


    O{3}    % nb de cotés
    m       % segment A/B
    O{A}    % nom générique
    \foreach \a/\b in {#2} {%
    \path[patron side] let
    \p1 = ($(\a)!.5!(\b)$) ,
    \n1 = {veclen(\x1,\y1)} ,
    \p2 = ($(\p1)!1/tan(180/#1)!90:(\b)$)
    \foreach \i [%
        evaluate=\i as \j using (\i-1)*360/#1] in {3,...,#1} {%
        -- ($(\p2)!1!\j:(\a)$) coordinate (#3\theNodePat)
         -- cycle ;

    O{.15}  % largeur
    D<>{45} % angle sur le premier node
    m       % les deux nodes
    D<>{45} % angle sur le second node
    \foreach \b/\a in {#3} {%
    \path[patron languette] let
    \p1 = ($(#5\b)!#1/sin(#2)!-#2:(#5\a)$),
    \p2 = ($(#5\a)!#1/sin(#4)!#4:(#5\b)$)
    (#5\a) -- (#5\b)
         -- (\p1)
         -- (\p2)
         -- cycle ; }

    \expandafter\ifx\csname pgf@sh@pi@A\the\X\endcsname\pgfpictureid
        \node[font={\footnotesize},red] at (A\the\X) {A\the\X} ;
        \advance \X by 1
    \unless\ifnum \X=0



\coordinate (A1) at (0,0) ;
\coordinate (A2) at (1,0) ;






\coordinate (A1) at (0,0) ;
\coordinate (A2) at (1,0) ;




  • 7
    Sounds complicated...I would start by representing the underlying structure as a more abstract Lua object so that it is immediate to tell whether a specific component is a "languette" or a face and how the faces are connected. Then from that representation you can produce both views, the flat and the 3D
    – Bordaigorl
    Nov 23, 2014 at 11:52
  • @Bordaigorl This way its seems complicated. I thaught about rotating nodes around vertices as one does when one make the paper model : rotating node A5...A8 around A2-A3 by 120°, then A6...A8 around A2--A5 by ... One has just angles to calculate. Initially all nodes have 0 as z coordinate, then a lualatex macro makes the rotations. Is such a thing possible ? (at the end all languettes are gone).
    – Tarass
    Nov 23, 2014 at 14:03
  • @Bordaigorl The fact is that each rotation is defined by the axe and a node and its image, no need for angle calculation.
    – Tarass
    Nov 23, 2014 at 14:15
  • Did you see the folding library of TikZ by the way?
    – percusse
    Nov 23, 2014 at 15:41
  • @percusse In the manual it is written that there is only one commande to make a dodecahedron. I missed something ?
    – Tarass
    Nov 23, 2014 at 16:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.