10-23-2019 02:11
10-23-2019 02:11
Here's a Paintshop Pro script that creates dots and dashes for the tick marks around an analogue clockface. Start with a blank 300x300 image and run it. Please customise it or your clockfaces will look like mine!
from PSPApp import *
import math
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'17.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
for hour in range(12):
DrawHour(Environment, hour, 5)
for minute in range(60):
DrawMinute(Environment, minute, 8, 2.5)
def DrawHour(Environment, hour, radius):
App.Do( Environment, 'CreateEllipseObject', {
'Antialias': True,
'MiterLimit': 15,
'Join': App.Constants.JointStyle.Miter,
'CreateAsVector': True,
'Fill': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',7.21,7.21),
'LastCap': (u'Butt',1,1),
'FirstSegCap': None,
'LastSegCap': None,
'UseSegmentCaps': False,
'Segments': None
},
'LineWidth': 0,
'Stroke': {
'Color': None,
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'ObjectName': u'New Ellipse',
'RadiusX': radius,
'RadiusY': radius,
'CenterX': 150 + 133 * math.sin(math.radians(hour*30)),
'CenterY': 150 - 133 * math.cos(math.radians(hour*30)),
'Matrix': None,
'Visibility': True,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
def DrawMinute(Environment, minute, height, width):
if minute % 5 == 0:
return
App.Do( Environment, 'CreateRectangleObject', {
'Antialias': True,
'MiterLimit': 15,
'Join': App.Constants.JointStyle.Miter,
'CreateAsVector': True,
'Fill': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',7.21,7.21),
'LastCap': (u'Butt',1,1),
'FirstSegCap': None,
'LastSegCap': None,
'UseSegmentCaps': False,
'Segments': None
},
'LineWidth': 0,
'Stroke': {
'Color': None,
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'ObjectName': u'New Rectangle',
'Left': 150 + 133 * math.sin(math.radians(minute*6)) - width / 2,
'Top': 150 - 133 * math.cos(math.radians(minute*6)) - height / 2,
'Width': width,
'Height': height,
'RadiusX': 0,
'RadiusY': 0,
'Matrix': None,
'Visibility': True,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
App.Do( Environment, 'VectorRotate', {
'Angle': minute*6,
'Pivot': (0,0),
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
10-23-2019 11:40
10-23-2019 11:40
Thanks for sharing!
10-23-2019 12:59
10-23-2019 12:59
Here's what it looks like when you run it in Paintshop Pro. If you look closely, you can see it rotating each minute tick mark.
When done, you just copy the vector layer it creates and paste it into the image with the rest of your clockface artwork.
To try again, delete the vector layer (ie, you don't have to create a whole new image).