36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
# import importDAE
|
|
import Mesh
|
|
import FreeCAD as App
|
|
from model.files_generator import FolderGenerator
|
|
from helper.is_solid import is_object_solid
|
|
from enum import Enum
|
|
|
|
class EXPORT_TYPES(Enum):
|
|
STL = 'STL'
|
|
DAO = 'DAO'
|
|
OBJ = 'OBJ'
|
|
|
|
|
|
class ExportUseCase:
|
|
def call(path: str, type: EXPORT_TYPES):
|
|
meshes = {}
|
|
for el in App.ActiveDocument.Objects:
|
|
if (is_object_solid(el)):
|
|
match type.value:
|
|
case EXPORT_TYPES.STL.value:
|
|
Mesh.export([el], path + '/' + FolderGenerator.SDF.value +
|
|
'/' + FolderGenerator.MESHES.value + '/' + el.Label + '.stl')
|
|
meshes[el.Label] = '/' + FolderGenerator.MESHES.value + \
|
|
'/' + el.Label + '.stl'
|
|
|
|
# case EXPORT_TYPES.DAO.value:
|
|
# importDAE.export([el], path + '/' + FolderGenerator.SDF.value +
|
|
# '/' + FolderGenerator.MESHES.value + '/' + el.Label + '.dae')
|
|
case EXPORT_TYPES.OBJ.value:
|
|
import importOBJ
|
|
importOBJ.export([el], path + '/' + FolderGenerator.SDF.value +
|
|
'/' + FolderGenerator.MESHES.value + '/' + el.Label + '.obj')
|
|
meshes[el.Label] = '/' + FolderGenerator.MESHES.value + \
|
|
'/' + el.Label + '.obj'
|
|
print(300)
|
|
return meshes
|