Welcome to mirror list, hosted at ThFree Co, Russian Federation.

translate_from_prusa.py - github.com/slic3r/slic3r-profiles.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 476af2ed7ff85e548b7048e20397bf3e1b9ed095 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import re

filename_in = "gCreate.ini"
filename_out = "gCreate.ini"

in_stream = open(filename_in, mode="r", encoding="utf-8");
lines = in_stream.read().splitlines();
in_stream.close();
file_out_stream = open(filename_out, mode="w", encoding="utf-8");
brim_type = "both";
for line in lines:
# xy compensaiton
	line = re.sub(
		r"\[first_layer_temperature]",
		"{first_layer_temperature+extruder_temperature_offset}", 
		line
	);
	line = re.sub(
		r"{first_layer_temperature}",
		"{first_layer_temperature+extruder_temperature_offset}", 
		line
	);
	line = re.sub(
		r"^elefant_foot_compensation = ([0-9]\.[0-9]*)",
		"first_layer_size_compensation = -\g<1>", 
		line
	);
# bridges
	line = re.sub(
		r"^bridge_flow_ratio = ([0-1])\.([0-9][0-9])$",
		"bridge_flow_ratio = \g<1>\g<2>%",
		line
	);
	line = re.sub(
		r"^bridge_flow_ratio = ([0-1])\.([0-9])$",
		"bridge_flow_ratio = \g<1>\g<2>0%",
		line
	);
	line = re.sub(
		r"^bridge_flow_ratio = 1$",
		"bridge_flow_ratio = 100%",
		line
	);
	line = re.sub(
		r"^thick_bridges = 0$",
		"bridge_type = flow\nbridge_overlap_min = 60%\nbridge_overlap = 75%",
		line
	);
	line = re.sub(
		r"^thick_bridges = 1$",
		"bridge_type = nozzle\nbridge_overlap_min = 80%\nbridge_overlap = 95%",
		line
	);
# brim
	if line.startswith("brim_type ="):
		brim_type = re.sub(r"^brim_type = (.*)$", "\g<1>", line);
		continue;
	if line.startswith("brim_width ="):
		if brim_type == "inner_only":
			line = re.sub(r"^brim_width = (.*)$", "brim_width_interior = \g<1>", line);
		elif brim_type == "no_brim":
			line = "brim_width = 0\nbrim_width_interior = 0";
		elif brim_type == "outer_and_inner":
			line = re.sub(r"^brim_width = (.*)$", "brim_width = \g<1>;brim_width_interior = \g<1>", line);
#others
	line = re.sub(
		r"^first_layer_speed = ([0-9.]+)",
		"first_layer_speed = \g<1>\nfirst_layer_min_speed = 0\nfirst_layer_infill_speed = 100%",
		line
	);
	line = re.sub(
		r"^resolution = 0$",
		"resolution = 0.0125",
		line
	);
	line = re.sub(
		r"support_material_contact_distance = 0$",
		"support_material_contact_distance_type = none",
		line
	);
	line = re.sub(
		r"^(extrusion_width = .*)$",
		"\g<1>\nextrusion_spacing =\nperimeter_extrusion_spacing =\nexternal_perimeter_extrusion_spacing =\nfirst_layer_extrusion_spacing =\ninfill_extrusion_spacing =\nsolid_infill_extrusion_spacing =\ntop_infill_extrusion_spacing =",
		line
	);
	line = re.sub(
		r"^overhangs = 0$",
		"overhangs_width_speed = 0",
		line
	);
	line = re.sub(
		r"^seam_position = nearest$",
		"seam_position = cost\nseam_angle_cost=50%\nseam_travel_cost=50%",
		line
	);
	line = re.sub(
		r"^(thumbnails = 1)$",
		"\g<1>\nthumbnails_with_bed = 1",
		line
	);
	# first_layer_height in % of layer height vs % of nozzle diameter
	line = re.sub(
		r"^first_layer_height = ([0-9]+%)$",
		"# From prusa: first_layer_height should be \g<1> of the first_layer_height\nfirst_layer_height = 50%",
		line
	);
	# note: if min_fan_speed is already set, you may have to delete manually one.
	line = re.sub(
		r"^cooling = 0$",
		"# From prusa: cooling = 0, so set the min fan speed to 0. Delete if already set\nmin_fan_speed = 0",
		line
	);
	
	
	
	if(line != "overhangs = 1"):
		file_out_stream.write(line);
		file_out_stream.write("\n");
file_out_stream.close();