Difference between revisions of "Creating Markers for positioning and cutting"

From Scribus Wiki
Jump to: navigation, search
m (Changed all the CreateLine(s) to createLine(s))
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<pre>#!/usr/bin/env python2.3
+
{{Scripting Index}}
 +
 
 +
 
 +
<pre>
 +
#!/usr/bin/env python2.3
 
# -*- coding: utf-8 -*-
 
# -*- coding: utf-8 -*-
 
# Schneid-Passer-Marken.py von Albert Dietz, 27.05.05
 
# Schneid-Passer-Marken.py von Albert Dietz, 27.05.05
Line 40: Line 44:
 
setFillColor("transparent", k13)
 
setFillColor("transparent", k13)
 
setLineColor(Farbe, k13)
 
setLineColor(Farbe, k13)
k11 = CreateLine( x-Breite/2, y, x+Breite/2, y)           
+
k11 = createLine( x-Breite/2, y, x+Breite/2, y)           
 
setLineWidth(0.5, k11)
 
setLineWidth(0.5, k11)
 
setLineColor(Farbe, k11)
 
setLineColor(Farbe, k11)
k12 = CreateLine( x, y-Breite/2, x, y+Breite/2 )           
+
k12 = createLine( x, y-Breite/2, x, y+Breite/2 )           
 
setLineWidth(0.5, k12)
 
setLineWidth(0.5, k12)
 
setLineColor(Farbe, k12)
 
setLineColor(Farbe, k12)
Line 56: Line 60:
 
def Schnitte( Abstand, Farbe ):
 
def Schnitte( Abstand, Farbe ):
 
Laenge = 0.8*Abstand
 
Laenge = 0.8*Abstand
l1 = CreateLine( 0, Abstand, Laenge, Abstand)           
+
l1 = createLine( 0, Abstand, Laenge, Abstand)           
 
setLineWidth(0.5, l1)
 
setLineWidth(0.5, l1)
 
setLineColor(Farbe, l1)
 
setLineColor(Farbe, l1)
l2 = CreateLine( Abstand, 0, Abstand, Laenge)
+
l2 = createLine( Abstand, 0, Abstand, Laenge)
 
setLineWidth(0.5, l2)
 
setLineWidth(0.5, l2)
 
setLineColor(Farbe, l2)
 
setLineColor(Farbe, l2)
 
 
l3 = CreateLine( pageWidth-Abstand, 0, pageWidth-Abstand, Laenge)
+
l3 = createLine( pageWidth-Abstand, 0, pageWidth-Abstand, Laenge)
 
setLineWidth(0.5, l3)
 
setLineWidth(0.5, l3)
 
setLineColor(Farbe, l3)
 
setLineColor(Farbe, l3)
l4 = CreateLine( pageWidth-Laenge, Abstand, pageWidth, Abstand)
+
l4 = createLine( pageWidth-Laenge, Abstand, pageWidth, Abstand)
 
setLineWidth(0.5, l4)
 
setLineWidth(0.5, l4)
 
setLineColor(Farbe, l4)
 
setLineColor(Farbe, l4)
 
 
l5 = CreateLine( 0, pageHeight-Abstand, Laenge, pageHeight-Abstand)
+
l5 = createLine( 0, pageHeight-Abstand, Laenge, pageHeight-Abstand)
 
setLineWidth(0.5, l5)
 
setLineWidth(0.5, l5)
 
setLineColor(Farbe, l5)
 
setLineColor(Farbe, l5)
l6 = CreateLine( Abstand, pageHeight, Abstand, pageHeight-Laenge)
+
l6 = createLine( Abstand, pageHeight, Abstand, pageHeight-Laenge)
 
setLineWidth(0.5, l6)
 
setLineWidth(0.5, l6)
 
setLineColor(Farbe, l6)
 
setLineColor(Farbe, l6)
  
l7 = CreateLine( pageWidth-0, pageHeight-Abstand, pageWidth-Laenge, pageHeight-Abstand)
+
l7 = createLine( pageWidth-0, pageHeight-Abstand, pageWidth-Laenge, pageHeight-Abstand)
 
setLineWidth(0.5, l7)
 
setLineWidth(0.5, l7)
 
setLineColor(Farbe, l7)
 
setLineColor(Farbe, l7)
l8 = CreateLine( pageWidth-Abstand, pageHeight, pageWidth-Abstand, pageHeight-Laenge)
+
l8 = createLine( pageWidth-Abstand, pageHeight, pageWidth-Abstand, pageHeight-Laenge)
 
setLineWidth(0.5, l8)
 
setLineWidth(0.5, l8)
 
setLineColor(Farbe, l8)
 
setLineColor(Farbe, l8)
Line 93: Line 97:
 
# Graukeil
 
# Graukeil
 
x = pageWidth/2 - 12*4
 
x = pageWidth/2 - 12*4
r01 = CreateRect( x, 2, 4, 4 )
+
r01 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz90", r01 )
 
setFillColor ("schwarz90", r01 )
 
x = x+4
 
x = x+4
r02 = CreateRect( x, 2, 4, 4 )
+
r02 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz80", r02 )
 
setFillColor ("schwarz80", r02 )
 
x = x+4
 
x = x+4
r03 = CreateRect( x, 2, 4, 4 )
+
r03 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz70", r03 )
 
setFillColor ("schwarz70", r03 )
 
x = x+4
 
x = x+4
r04 = CreateRect( x, 2, 4, 4 )
+
r04 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz60", r04 )
 
setFillColor ("schwarz60", r04 )
 
x = x+4
 
x = x+4
r05 = CreateRect( x, 2, 4, 4 )
+
r05 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz50", r05 )
 
setFillColor ("schwarz50", r05 )
 
x = x+4
 
x = x+4
r06 = CreateRect( x, 2, 4, 4 )
+
r06 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz40", r06 )
 
setFillColor ("schwarz40", r06 )
 
x = x+4
 
x = x+4
r07 = CreateRect( x, 2, 4, 4 )
+
r07 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz30", r07 )
 
setFillColor ("schwarz30", r07 )
 
x = x+4
 
x = x+4
r08 = CreateRect( x, 2, 4, 4 )
+
r08 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz20", r08 )
 
setFillColor ("schwarz20", r08 )
 
x = x+4
 
x = x+4
r09 = CreateRect( x, 2, 4, 4 )
+
r09 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz10", r09 )
 
setFillColor ("schwarz10", r09 )
 
x = x+4
 
x = x+4
r10 = CreateRect( x, 2, 4, 4 )
+
r10 = createRect( x, 2, 4, 4 )
 
setFillColor ("transparent", r10 )
 
setFillColor ("transparent", r10 )
 
# Farben
 
# Farben
 
x = pageWidth/2 + 2*4
 
x = pageWidth/2 + 2*4
r11 = CreateRect( x, 2, 4, 4 )
+
r11 = createRect( x, 2, 4, 4 )
 
setFillColor ("gelb", r11 )
 
setFillColor ("gelb", r11 )
 
x = x+4
 
x = x+4
r12 = CreateRect( x, 2, 4, 4 )
+
r12 = createRect( x, 2, 4, 4 )
 
setFillColor ("magenta", r12 )
 
setFillColor ("magenta", r12 )
 
x = x+4
 
x = x+4
r13 = CreateRect( x, 2, 4, 4 )
+
r13 = createRect( x, 2, 4, 4 )
 
setFillColor ("cyan", r13 )
 
setFillColor ("cyan", r13 )
 
x = x+4
 
x = x+4
r14 = CreateRect( x, 2, 4, 4 )
+
r14 = createRect( x, 2, 4, 4 )
 
setFillColor ("blau", r14 )
 
setFillColor ("blau", r14 )
 
x = x+4
 
x = x+4
r15 = CreateRect( x, 2, 4, 4 )
+
r15 = createRect( x, 2, 4, 4 )
 
setFillColor ("gruen", r15 )
 
setFillColor ("gruen", r15 )
 
x = x+4
 
x = x+4
r16 = CreateRect( x, 2, 4, 4 )
+
r16 = createRect( x, 2, 4, 4 )
 
setFillColor ("rot", r16 )
 
setFillColor ("rot", r16 )
 
x = x+4
 
x = x+4
r17 = CreateRect( x, 2, 4, 4 )
+
r17 = createRect( x, 2, 4, 4 )
 
setFillColor ("schwarz", r17 )
 
setFillColor ("schwarz", r17 )
 
x = x+4
 
x = x+4
r18 = CreateRect( x, 2, 4, 4 )
+
r18 = createRect( x, 2, 4, 4 )
 
setFillColor ("gelb50", r18 )
 
setFillColor ("gelb50", r18 )
 
x = x+4
 
x = x+4
r19 = CreateRect( x, 2, 4, 4 )
+
r19 = createRect( x, 2, 4, 4 )
 
setFillColor ("magenta50", r19 )
 
setFillColor ("magenta50", r19 )
 
x = x+4
 
x = x+4
r20 = CreateRect( x, 2, 4, 4 )
+
r20 = createRect( x, 2, 4, 4 )
 
setFillColor ("cyan50", r20 )
 
setFillColor ("cyan50", r20 )
 +
 +
 +
 
</pre>
 
</pre>

Latest revision as of 09:17, 16 June 2007

This article is part of the Scripts series.


#!/usr/bin/env python2.3
# -*- coding: utf-8 -*-
# Schneid-Passer-Marken.py von Albert Dietz, 27.05.05
# this script (my first Pyhton and Scribus-Script) generates markers for 
# positioning cmyk masks and cutting
# the markers will be set onto the existing document at 1cm spacing to the papersize
# that means that your A4-Layout should be 230x317mm
# Attention: disable "under color reduction"! otherwise you will not see the 
# cyan, magenta and yellow markers
# feel free to modify this script and please send comments to albert@jadietz.de
# thank you for reading this.
#
from scribus import *
defineColor("transparent", 0, 0, 0, 0 )
defineColor("cyan", 255, 0, 0, 0 )
defineColor("magenta", 0, 255, 0, 0 )
defineColor("gelb", 0, 0, 255, 0 )
defineColor("cyan50", 128, 0, 0, 0 )
defineColor("magenta50", 0, 128, 0, 0 )
defineColor("gelb50", 0, 0, 128, 0 )
defineColor("rot", 0, 255, 255, 0 )
defineColor("gruen", 255, 0, 255, 0 )
defineColor("blau", 255, 255, 0, 0 )
defineColor("schwarz", 0, 0, 0, 255 )
defineColor("schwarz90", 0, 0, 0, 230 )
defineColor("schwarz80", 0, 0, 0, 205 )
defineColor("schwarz70", 0, 0, 0, 179 )
defineColor("schwarz60", 0, 0, 0, 154 )
defineColor("schwarz50", 0, 0, 0, 128 )
defineColor("schwarz40", 0, 0, 0, 102 )
defineColor("schwarz30", 0, 0, 0,  77 )
defineColor("schwarz20", 0, 0, 0,  51 )
defineColor("schwarz10", 0, 0, 0,  26 )
defineColor("alle", 255, 255, 255, 255 )

def einPasser( x, y, Breite, Farbe ):
	Kreisradius = 0.5*Breite*0.8
	k13 = createEllipse( x-Kreisradius, y-Kreisradius, 2*Kreisradius, 2*Kreisradius)
	setLineWidth(0.5, k13)
	setFillColor("transparent", k13)
	setLineColor(Farbe, k13)
	k11 = createLine( x-Breite/2, y, x+Breite/2, y)           
	setLineWidth(0.5, k11)
	setLineColor(Farbe, k11)
	k12 = createLine( x, y-Breite/2, x, y+Breite/2 )           
	setLineWidth(0.5, k12)
	setLineColor(Farbe, k12)

def allePasser( Breite, Farbe):
	einPasser( 0.5*Breite, pageHeight/2, 0.8*Breite, Farbe )
	einPasser( pageWidth/2, 0.5*Breite, 0.8*Breite, Farbe )
	einPasser( pageWidth-0.5*Breite, pageHeight/2, 0.8*Breite, Farbe )
	einPasser( pageWidth/2, pageHeight-0.5*Breite, 0.8*Breite, Farbe )


def Schnitte( Abstand, Farbe ):
	Laenge = 0.8*Abstand
	l1 = createLine( 0, Abstand, Laenge, Abstand)           
	setLineWidth(0.5, l1)
	setLineColor(Farbe, l1)
	l2 = createLine( Abstand, 0, Abstand, Laenge)
	setLineWidth(0.5, l2)
	setLineColor(Farbe, l2)
	
	l3 = createLine( pageWidth-Abstand, 0, pageWidth-Abstand, Laenge)
	setLineWidth(0.5, l3)
	setLineColor(Farbe, l3)
	l4 = createLine( pageWidth-Laenge, Abstand, pageWidth, Abstand)
	setLineWidth(0.5, l4)
	setLineColor(Farbe, l4)
	
	l5 = createLine( 0, pageHeight-Abstand, Laenge, pageHeight-Abstand)
	setLineWidth(0.5, l5)
	setLineColor(Farbe, l5)
	l6 = createLine( Abstand, pageHeight, Abstand, pageHeight-Laenge)
	setLineWidth(0.5, l6)
	setLineColor(Farbe, l6)

	l7 = createLine( pageWidth-0, pageHeight-Abstand, pageWidth-Laenge, pageHeight-Abstand)
	setLineWidth(0.5, l7)
	setLineColor(Farbe, l7)
	l8 = createLine( pageWidth-Abstand, pageHeight, pageWidth-Abstand, pageHeight-Laenge)
	setLineWidth(0.5, l8)
	setLineColor(Farbe, l8)



if haveDoc():
	setUnit(UNIT_MILLIMETERS) 
	pageWidth, pageHeight = getPageSize()
	Schnitte( 10, "alle" )
	allePasser( 10, "alle" )
	# Graukeil
	x = pageWidth/2 - 12*4
	r01 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz90", r01 )
	x = x+4
	r02 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz80", r02 )
	x = x+4
	r03 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz70", r03 )
	x = x+4
	r04 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz60", r04 )
	x = x+4
	r05 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz50", r05 )
	x = x+4
	r06 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz40", r06 )
	x = x+4
	r07 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz30", r07 )
	x = x+4
	r08 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz20", r08 )
	x = x+4
	r09 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz10", r09 )
	x = x+4
	r10 = createRect( x, 2, 4, 4 )
	setFillColor ("transparent", r10 )
	# Farben	
	x = pageWidth/2 + 2*4
	r11 = createRect( x, 2, 4, 4 )
	setFillColor ("gelb", r11 )
	x = x+4
	r12 = createRect( x, 2, 4, 4 )
	setFillColor ("magenta", r12 )
	x = x+4
	r13 = createRect( x, 2, 4, 4 )
	setFillColor ("cyan", r13 )
	x = x+4
	r14 = createRect( x, 2, 4, 4 )
	setFillColor ("blau", r14 )
	x = x+4
	r15 = createRect( x, 2, 4, 4 )
	setFillColor ("gruen", r15 )
	x = x+4
	r16 = createRect( x, 2, 4, 4 )
	setFillColor ("rot", r16 )
	x = x+4
	r17 = createRect( x, 2, 4, 4 )
	setFillColor ("schwarz", r17 )
	x = x+4
	r18 = createRect( x, 2, 4, 4 )
	setFillColor ("gelb50", r18 )
	x = x+4
	r19 = createRect( x, 2, 4, 4 )
	setFillColor ("magenta50", r19 )
	x = x+4
	r20 = createRect( x, 2, 4, 4 )
	setFillColor ("cyan50", r20 )