@@ -429,8 +429,6 @@ def scale(self, factor):
429429 self .blade_coordinates_down [i ][1 ] = new_coord_matrix_down [1 ]
430430 self .blade_coordinates_down [i ][2 ] = new_coord_matrix_down [2 ]
431431
432-
433-
434432 def plot (self , elev = None , azim = None , ax = None , outfile = None ):
435433 """
436434 Plot the generated blade sections.
@@ -1088,7 +1086,59 @@ def generate_stl_blade(self, filename):
10881086
10891087 write_stl_file (self .sewed_full , filename )
10901088
1091- def generate_iges_blade (self , filename ):
1089+ def _generate_leading_edge_curves (self ):
1090+ """
1091+ Private method to generate curves that follow the leading edge of the blade
1092+ (top and bottom surfaces).
1093+ """
1094+ self ._import_occ_libs ()
1095+
1096+ # Extract points at leftmost 5% for upper and lower surfaces
1097+ upper_points = []
1098+ lower_points = []
1099+
1100+ for i in range (self .n_sections ):
1101+ min_x = np .min (self .sections [i ].xdown_coordinates )
1102+ max_x = np .max (self .sections [i ].xdown_coordinates )
1103+ delta_x = max_x - min_x
1104+
1105+ target_x = min_x + 0.95 * delta_x
1106+
1107+ idx = np .abs (self .sections [i ].xdown_coordinates - target_x ).argmin ()
1108+
1109+ # Create points for upper and lower curves
1110+ upper_points .append (gp_Pnt (
1111+ 1000 * self .blade_coordinates_up [i ][0 ][idx ],
1112+ 1000 * self .blade_coordinates_up [i ][1 ][idx ],
1113+ 1000 * self .blade_coordinates_up [i ][2 ][idx ]
1114+ ))
1115+
1116+ lower_points .append (gp_Pnt (
1117+ 1000 * self .blade_coordinates_down [i ][0 ][idx ],
1118+ 1000 * self .blade_coordinates_down [i ][1 ][idx ],
1119+ 1000 * self .blade_coordinates_down [i ][2 ][idx ]
1120+ ))
1121+
1122+ # Create arrays of points for interpolation
1123+ upper_array = TColgp_HArray1OfPnt (1 , len (upper_points ))
1124+ lower_array = TColgp_HArray1OfPnt (1 , len (lower_points ))
1125+
1126+ for i , (up , low ) in enumerate (zip (upper_points , lower_points )):
1127+ upper_array .SetValue (i + 1 , up )
1128+ lower_array .SetValue (i + 1 , low )
1129+
1130+ # Create interpolated curves
1131+ upper_curve = GeomAPI_Interpolate (upper_array , False , 1e-9 )
1132+ lower_curve = GeomAPI_Interpolate (lower_array , False , 1e-9 )
1133+
1134+ upper_curve .Perform ()
1135+ lower_curve .Perform ()
1136+
1137+ # Convert to edges
1138+ self .upper_le_edge = BRepBuilderAPI_MakeEdge (upper_curve .Curve ()).Edge ()
1139+ self .lower_le_edge = BRepBuilderAPI_MakeEdge (lower_curve .Curve ()).Edge ()
1140+
1141+ def generate_iges_blade (self , filename , include_le_curves = False ):
10921142 """
10931143 Generate and export the .IGES file for the entire blade.
10941144 This method requires PythonOCC (7.4.0) to be installed.
@@ -1099,11 +1149,20 @@ def generate_iges_blade(self, filename):
10991149 self ._generate_lower_face (max_deg = 1 )
11001150 self ._generate_root (max_deg = 1 )
11011151 self ._generate_tip (max_deg = 1 )
1152+
1153+ if include_le_curves :
1154+ self ._generate_leading_edge_curves ()
1155+
11021156 iges_writer = IGESControl_Writer ()
11031157 iges_writer .AddShape (self .generated_upper_face )
11041158 iges_writer .AddShape (self .generated_lower_face )
11051159 iges_writer .AddShape (self .generated_root )
11061160 iges_writer .AddShape (self .generated_tip )
1161+
1162+ if include_le_curves :
1163+ iges_writer .AddShape (self .upper_le_edge )
1164+ iges_writer .AddShape (self .lower_le_edge )
1165+
11071166 iges_writer .Write (filename )
11081167
11091168 @staticmethod
@@ -1244,6 +1303,7 @@ def export_ppg(self,
12441303 if i == len (hub_offsets ) - 1 :
12451304 output_string += str ("%.8e" % offset [0 ]) + ' ' + str (
12461305 "%.8e" % hub_offsets [i ][1 ])
1306+
12471307 continue
12481308 output_string += str ("%.8e" % offset [0 ]) + ' ' + str (
12491309 "%.8e" % offset [1 ]) + '\n '
0 commit comments