@@ -74,17 +74,17 @@ def gwrite(document: vp.Document, filename: str, profile: str):
7474
7575 # Read the config for the profile from the main vpype
7676 config = gwrite_config [profile ]
77- header = config .get ("header" , None )
78- firstsegment = config .get ("firstsegment" , None )
77+ document_start = config .get ("document_start" , None )
78+ document_end = config .get ("document_end" , None )
79+ layer_start = config .get ("layer_start" , None )
80+ layer_end = config .get ("layer_end" , None )
81+ layer_join = config .get ("layer_join" , None )
82+ linecollection_start = config .get ("linecollection_start" , None )
83+ linecollection_end = config .get ("linecollection_end" , None )
84+ linecollection_join = config .get ("linecollection_join" , None )
85+ segment_first = config .get ("segment_first" , None )
7986 segment = config .get ("segment" , None )
80- lastsegment = config .get ("lastsegment" , None )
81- prelayer = config .get ("prelayer" , None )
82- postlayer = config .get ("postlayer" , None )
83- layerjoin = config .get ("layerjoin" , None )
84- preline = config .get ("preline" , None )
85- postline = config .get ("postline" , None )
86- linejoin = config .get ("linejoin" , None )
87- footer = config .get ("footer" , None )
87+ segment_last = config .get ("segment_last" , None )
8888 unit = config .get ("unit" , "mm" )
8989
9090 invert_x = config .get ("invert_x" , False )
@@ -96,22 +96,22 @@ def gwrite(document: vp.Document, filename: str, profile: str):
9696 document = invert_axis (document , invert_x , invert_y )
9797
9898 with open (filename , "w" ) as f :
99- if header is not None :
100- f .write (header .format (filename = filename ))
99+ if document_start is not None :
100+ f .write (document_start .format (filename = filename ))
101101 last_x = 0
102102 last_y = 0
103103 xx = 0
104104 yy = 0
105105 lastlayer_index = len (document .layers .values ()) - 1
106106 for layer_index , layer in enumerate (document .layers .values ()):
107- if prelayer is not None :
108- f .write (prelayer .format (index = layer_index ))
107+ if layer_start is not None :
108+ f .write (layer_start .format (index = layer_index ))
109109 lastlines_index = len (layer ) - 1
110110 for lines_index , lines in enumerate (layer ):
111111 lines_scaled = lines * scale
112- if preline is not None :
113- f .write (preline .format (index = lines_index ))
114- lastsegment_index = len (lines_scaled ) - 1
112+ if linecollection_start is not None :
113+ f .write (linecollection_start .format (index = lines_index ))
114+ segment_last_index = len (lines_scaled ) - 1
115115 for segment_index , seg in enumerate (lines_scaled ):
116116 x = seg .real
117117 y = seg .imag
@@ -121,10 +121,10 @@ def gwrite(document: vp.Document, filename: str, profile: str):
121121 idy = int (round (y - yy ))
122122 xx += idx
123123 yy += idy
124- if firstsegment is not None and segment_index == 0 :
125- seg_write = firstsegment
126- elif lastsegment is not None and segment_index == lastsegment_index :
127- seg_write = lastsegment
124+ if segment_first is not None and segment_index == 0 :
125+ seg_write = segment_first
126+ elif segment_last is not None and segment_index == segment_last_index :
127+ seg_write = segment_last
128128 else :
129129 seg_write = segment
130130 f .write (
@@ -146,16 +146,16 @@ def gwrite(document: vp.Document, filename: str, profile: str):
146146 )
147147 last_x = x
148148 last_y = y
149- if postline is not None :
150- f .write (postline .format (index = lines_index ))
151- if linejoin is not None and lines_index != lastlines_index :
152- f .write (linejoin )
153- if postlayer is not None :
154- f .write (postlayer .format (index = layer_index ))
155- if layerjoin is not None and layer_index != lastlayer_index :
156- f .write (layerjoin )
157- if footer is not None :
158- f .write (footer .format (filename = filename ))
149+ if linecollection_end is not None :
150+ f .write (linecollection_end .format (index = lines_index ))
151+ if linecollection_join is not None and lines_index != lastlines_index :
152+ f .write (linecollection_join )
153+ if layer_end is not None :
154+ f .write (layer_end .format (index = layer_index ))
155+ if layer_join is not None and layer_index != lastlayer_index :
156+ f .write (layer_join )
157+ if document_end is not None :
158+ f .write (document_end .format (filename = filename ))
159159
160160 return document
161161
0 commit comments