/StringArtMaker

Make Stringart designs by modifying this code

Primary LanguagePython

StringArtMaker

Make Stringart designs by modifying this code

Make sure to run with python3: python3 filename.py

Not the cleanest code but enough to get the job done!

Just mess around with what multiple layers, sizes, nailcount, colors and the shift values to get differ different shapes. There are some examples underneath for inspiration. Syntax for creating an object, i.e. curve:

c1 = Curve(width,nails,thick,Nshift=0,trimStart=0,trimEnd=0,parts=[1,1,1,1])
c1.plot(color='b',makePic=0,tutName="Square",makeGif=0)

All optional except first three params. makePic saves a png of the frame after drawing that shape under name tutName. makeGif outputs every single frame when set to 1 so that a gif can be compiled (see below). Selectable colors are at bottom of every file, but script could easily be adjusted to select other colors, if you want that.

Make GIFs

Turn string of pictures into gif from command line:

convert -delay 20 -loop 0 `ls -v|grep png` gifName.gif

Remove pngs afterwards:

rm `ls -v|grep png` 

Some examples

Crosses

# Cross1
c1 = Curve(500,13,38,-4,4,0) # plot in red
c2 = Curve(500,13,38,-4,0,5) # plot in blue
c3 = Curve(500,13,38,5,0,0) # plot in yellow

Cross1

#Cross2
s1 = Straight(500,13,38,0,12,0)
s2 = Straight(500,13,38,0,5,4)
c1 = Curve(500,13,38,-8,0,0) 		
c2 = Curve(500,13,38,5,0,0) 

Cross2

#Cross3
s1 = Straight(500,13,38,0,8,0)
s2 = Straight(500,13,38,0,0,7)
c1 = Curve(500,13,38,0,3,3) 

Cross3

Triangles

#Triangle1
c1 = Curve(445,22,30,0,0,0,[1,0,0])
c2 = Curve(445,22,30,0,0,0,[0,1,0])
c3 = Curve(445,22,30,0,0,0,[0,0,1])

Triangle1

#Triangle1
c1 = Curve(445,22,30,5,0,0)
c2 = Curve(445,22,30,3,0,0)

Triangle2

#Triangle1
s1 = Straight(445,22,30,0,0)
c1 = Curve(445,22,30,6,0,0)

Triangle3

#Triangle4
c1 = Curve(445,22,30,-6,0,0)
c2 = Curve(445,22,30,11,0,0)

Triangle4

#Triangle5
s1 = Straight(445,22,30,0,0,11)
c1 = Curve(445,22,30,0,17,0)
c2 = Curve(445,22,30,0,0,17)

Triangle5

#Triangle6
s1 = Straight(445,22,30,0,0,18)
c1 = Curve(445,22,30,11,0,0)

Triangle6

#Triangle7
c1 = Curve(445,22,30,11,0,0)
c2 = Curve(445,22,30,0,0,0)

Triangle7

#Triangle8
c1 = Curve(445,22,30,16,0,0)
c2 = Curve(445,22,30,6,0,0)

Triangle8

Squares

#Square3
Xp1 = Xpattern(500,23,30,0,0,0,[1,1])
c1 = Curve(500,23,30,0,0,0)
c2 = Curve(500,23,30,0,0,0)

Square1

#Square2
z1 = Zigzag(500,23,30,0,0,0)
c1 = Curve(500,23,30,0,0,0,[1,0,1,0])
c2 = Curve(500,23,30,0,0,0,[0,1,0,1])

Square2

#Square3
c1 = Curve(500,22,30,0,17,0)
c2 = Curve(500,22,30,0,12,5)
c3 = Curve(500,22,30,0,7,10)
c4 = Curve(500,22,30,0,0,15)

Square3

#Square4
Xp1 = Xpattern(500,23,30,13,0,0,[1,0])
Xp2 = Xpattern(500,23,30,-13,0,0,[0,1])
Xp3 = Xpattern(500,23,30,0,0,13,[1,0])
Xp4 = Xpattern(500,23,30,0,13,0,[0,1])
c1 = Curve(500,23,30,0,0,0)

Square4

#Square5
z1 = Zigzag(500,23,30,0,0,0,[1,0])
z2 = Zigzag(500,23,30,0,0,0,[0,1])
c1 = Curve(500,23,30,0,0,0,[0,1,0,1])

Square5

#Square6
Xp1 = Xpattern(500,23,30,0,0,0,[1,0])
c1 = Curve(500,23,30,0,0,0)
c2 = Curve(500,23,30,0,10,10)

Square6

#Square7
c1 = Curve(500,23,30,0,0,0)
c2 = Curve(500,23,30,-5,0,0)
c3 = Curve(500,23,30,-13,0,0)
c4 = Curve(500,23,30,13,0,0)

Square7