Пример #1
0
 def clear(self):  #PASSING #will need improvement
     from sv import Repository
     if len(Repository.List()) == 0:
         print('Repository Empty')
     else:
         for i in Repository.List():
             Repository.Delete(i)
         print('Repository Cleared')
         for key in self.data_manager.keys():
             self.data_manager[key] = []
         print('Data Manager Cleared')
Пример #2
0
 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
Пример #3
0
	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 
Пример #4
0
    def mesh(self):  #PASSING
        from sv import MeshObject, GUI, Repository
        import os
        MeshObject.SetKernel('TetGen')

        msh = MeshObject.pyMeshObject()
        msh.NewObject('Model_mesh')

        msh.LoadModel(os.getcwd() + '/Model_Solid.vtp')
        msh.NewMesh()

        msh.SetMeshOptions('SurfaceMeshFlag', [1])
        msh.SetMeshOptions('VolumeMeshFlag', [1])
        msh.SetMeshOptions('GlobalEdgeSize', [0.3])
        msh.SetMeshOptions('MeshWallFirst', [1])
        msh.SetWalls(self.wall_list)
        msh.GenerateMesh()

        fileName = os.getcwd() + '/Solid_Model.vtk'
        msh.WriteMesh(fileName)
        msh.GetUnstructuredGrid('ug')
        Repository.WriteVtkUnstructuredGrid('ug', 'ascii', fileName)

        GUI.ImportUnstructedGridFromRepos('ug')
Пример #5
0
from sv import Repository

objs = Repository.List()
for name in objs:
    Repository.Delete(name)