55
66
77class Meshes (pv .MultiBlock ):
8- def __init__ (self ) -> None :
8+ def __init__ (self ) -> None :
9+ """
10+ This class is a subclass of pyvista.MultiBlock.
11+ It is used to store multiple meshes with labels from the scaffold.
12+ """
913 super ().__init__ ()
1014
11- def add_mesh (self , label : str , mesh : pv .PolyData ):
15+ def add_mesh (self , label : str , mesh : pv .PolyData ):
16+ """
17+ This function adds a mesh to the MultiBlock object.
18+ Args:
19+ label (str): Label of the mesh.
20+ mesh (pv.PolyData): Mesh to be added.
21+ """
1222 self .append (label , mesh )
1323
14- def export (self , output_filepath : str = "output.stl" , base_path = '.' ):
24+ def export (self , output_filepath : str = "output.stl" , base_path = '.' ):
25+ """
26+ This function exports the meshes in the MultiBlock object to a single STL file.
27+ Args:
28+ output_filepath (str): Output file path.
29+ base_path (str): Base path.
30+ """
1531 save_multiblock_stl (self , output_filepath , base_path )
1632
1733 def items (self ):
1834 '''
19- This function should return the label and meshes (pv.PolyData) in the MultiBlock object.
35+ This function should return the label and meshes (pv.PolyData) in the MultiBlock object.
36+ Returns:
37+ list: List of tuples containing label and mesh.
2038 '''
2139 blocks = []
2240 for name in self .keys ():
@@ -26,7 +44,13 @@ def items(self):
2644
2745
2846def save_multiblock_stl (multiblock , filename , base_path = '.' ):
29-
47+ """
48+ This function saves the meshes in the MultiBlock object to a single STL file.
49+ Args:
50+ multiblock (MultiBlock): MultiBlock object containing meshes.
51+ filename (str): Output file path.
52+ base_path (str): Base path.
53+ """
3054 names = multiblock .keys ()
3155 oname , ext = os .path .splitext (filename )
3256 assert ext == '.stl'
@@ -56,8 +80,13 @@ def save_multiblock_stl(multiblock, filename, base_path='.'):
5680
5781 return
5882
59- def change_first_line_of_file (filename , new_first_line ):
60-
83+ def change_first_line_of_file (filename , new_first_line ):
84+ """
85+ This function changes the first line of a file.
86+ Args:
87+ filename (str): File name.
88+ new_first_line (str): New first line.
89+ """
6190 fr = open (filename , 'r' )
6291 first_line = fr .readline ()
6392 fr .close ()
0 commit comments