Add PDDL, 3D-assets & SDF-URDF generator from Blender Scene Config
This commit is contained in:
parent
b77687ea14
commit
e305d486f2
41 changed files with 2793 additions and 664 deletions
28
cad_generation/helper/file_system_repository.py
Normal file
28
cad_generation/helper/file_system_repository.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import os
|
||||
import json
|
||||
import shutil
|
||||
|
||||
|
||||
class FileSystemRepository:
|
||||
def readJSON(path: str):
|
||||
return json.loads((open(path)).read())
|
||||
|
||||
def recursiveDeleteFolder(path: str):
|
||||
shutil.rmtree(path)
|
||||
pass
|
||||
|
||||
def deletingOldAndCreatingNewFolder(path: str):
|
||||
if FileSystemRepository.isExistsPath(path):
|
||||
FileSystemRepository.recursiveDeleteFolder(path)
|
||||
os.makedirs(path)
|
||||
pass
|
||||
|
||||
def isExistsPath(path: str):
|
||||
return os.path.exists(path)
|
||||
|
||||
def writeFile(data, filePath, fileName):
|
||||
file_to_open = filePath + fileName
|
||||
|
||||
f = open(file_to_open, "w", encoding="utf-8", errors="ignore")
|
||||
f.write(data)
|
||||
f.close()
|
Loading…
Add table
Add a link
Reference in a new issue