@@ -228,6 +228,44 @@ def draw_north_arrow(self, x: float, y: float, height: float = 100.0):
228228 (x , y ),
229229 )
230230
231+ def add_north_arrow_label (self , start : Tuple [float , float ], stop : Tuple [float , float ], label : str = "" , height : float = 100.0 ):
232+ height = height * self .scale
233+ x = start [0 ] * self .scale
234+ y = start [1 ] * self .scale
235+ stop_x = stop [0 ] * self .scale
236+ stop_y = stop [1 ] * self .scale
237+
238+ # add line
239+ self .msp .add_line ((x , y ), (stop_x , stop_y ), dxfattribs = {'color' : 5 })
240+
241+ if label :
242+ angle = math .degrees (math .atan2 (stop_y - y , stop_x - x ))
243+
244+ # add text at midpoint
245+ self .msp .add_text (
246+ label ,
247+ dxfattribs = {
248+ 'height' : height ,
249+ 'color' : 5 ,
250+ 'style' : 'SURVEY_TEXT' ,
251+ 'rotation' : angle
252+ }
253+ ).set_placement (
254+ (x , y ),
255+ align = TextEntityAlignment .TOP_LEFT ,
256+ )
257+
258+ def draw_north_arrow_cross (self , x : float , y : float , length : float = 100.0 ):
259+ x = x * self .scale
260+ y = y * self .scale
261+ length = length * self .scale
262+
263+ half = length / 2
264+
265+ # add cross lines
266+ self .msp .add_line ((x - half , y ), (x + half , y ), dxfattribs = {'color' : 5 })
267+ self .msp .add_line ((x , y - half ), (x , y + half ), dxfattribs = {'color' : 5 })
268+
231269 def draw_graphical_scale (self , x : float , y : float , length : float = 1000.0 ):
232270 X = x * self .scale
233271 Y = y * self .scale
@@ -614,7 +652,7 @@ def save(self, paper_size: str = "A4", orientation: str = "portrait"):
614652 url = upload_file (zip_path , folder = "survey_plans" , file_name = filename )
615653 if url is None :
616654 raise Exception ("Upload failed" )
617- return url
655+ return " url"
618656
619657
620658
0 commit comments