-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextrusionMultiplier.py
More file actions
39 lines (25 loc) · 957 Bytes
/
extrusionMultiplier.py
File metadata and controls
39 lines (25 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from util import getAllFileLines, writeFileLines, FileLines
NEW_FILE_PREFIX = "extrusion"
START_RANGE = .8
END_RANGE = 1.2
NUM_STEPS = 40
BASE_EXTRUSION = 4.75058
fileLines: FileLines = getAllFileLines()
stepSize = len(fileLines.drawLines)//NUM_STEPS
outputLines = fileLines.startLines
totalRange = END_RANGE - START_RANGE
lastIndex = 0
# We stop a step before the actual end to give the last value time to appear
lastValue = len(fileLines.drawLines) - stepSize
for i in range(0, lastValue, stepSize):
changeLines = fileLines.drawLines[lastIndex:i]
lastIndex = i
ratio = i/lastValue
currentValue = (totalRange * ratio) + START_RANGE
print(currentValue)
actualValue = BASE_EXTRUSION * currentValue
print(actualValue)
outputLines += [line.replace(str(BASE_EXTRUSION), str(actualValue)) for line in changeLines]
outputLines += fileLines.drawLines[lastIndex:]
outputLines += fileLines.endLines
writeFileLines(outputLines, NEW_FILE_PREFIX)