def __Union__(self): #PASSING #CPofF ##too much in function #PASSING from sv import Geom, Solid, GUI, Geom, Repository import os Solid.SetKernel('PolyData') Geom.All_union(self.data_manager['Solids'], 0, 'Model', 0.00001) #len(self.data_manager['Solids']) print(self.data_manager['Solids']) s = Solid.pySolidModel() s.GetModel('Model') s.GetPolyData('Model_Polydata') s.GetBoundaryFaces(45) faceids = s.GetFaceIds() face_types = [] self.wall_list = [] for face in faceids: s.GetFacePolyData(face, int(face), 0.1) face_types.append(self.__face_type__(face)) if face_types[-1] == 'wall': self.wall_list.append(int(face)) else: pass s.GetModel('Model') os.chdir('/home/zacharysexton/Downloads') s.WriteNative(os.getcwd() + '/Model_Solid.vtp') return
def __solid_subprocess__(self,path_object): #PASSING from sv import Solid,Repository,VMTKUtils Solid.SetKernel('PolyData') solid = Solid.pySolidModel() solid.NewObject(path_object+'_solid') VMTKUtils.Cap_with_ids(path_object+'_loft',path_object+'_capped',0,0) solid.SetVtkPolyData(path_object+'_capped') # solid.CapSurfToSolid(path_object+'_capped',path_object+'_correct') self.data_manager['Solids'].append(path_object+'_capped')
def __face_type__(self, face, threshold=5): #PASSING from sv import Solid, Repository s = Solid.pySolidModel() s.NewObject('temp') s.SetVtkPolyData(face) s.GetBoundaryFaces(threshold) div = s.GetFaceIds() if len(div) > 1: face_type = 'wall' else: face_type = 'cap' Repository.Delete('temp') return face_type
def garbage_union(self): # may be removed later from sv import Geom,Solid,GUI,Geom,Repository import os Solid.SetKernel('PolyData') s = Solid.pySolidModel() for solid_idx in range(len(self.data_manager['Solids'])-1): if solid_idx == 0: Geom.All_union([self.data_manager['Solids'][solid_idx],self.data_manager['Solids'][solid_idx+1]],1,'temp',0.000001) if len(self.data_manager['Solids']) == 2: break elif (solid_idx != len(self.data_manager['Solids'])-1) and Repository.Exists('temp_replace')==False: Geom.All_union(['temp',self.data_manager['Solids'][solid_idx+1]],1,'temp_replace',0.000001) Repository.Delete('temp') elif (solid_idx != len(self.data_manager['Solids'])-1) and Repository.Exists('temp')==False: Geom.All_union(['temp_replace',self.data_manager['Solids'][solid_idx+1]],1,'temp',0.000001) Repository.Delete('temp_replace') else: if Repository.Exists('temp'): Geom.All_union(['temp',self.data_manager['Solids'][solid_idx+1]],1,'Model',0.000001) else: Geom.All_union(['temp_replace',self.data_manager['Solids'][solid_idx+1]],1,'Model',0.000001) return
def __subtraction__(self): #PASSING #unused from sv import Solid temp = Solid.pySolidModel() temp.Subtract('temp', self.data_manager['Solids'][0], self.data_manager['Solids'][1]) return