framework/sequence_generation/Main.py

110 lines
3.9 KiB
Python
Raw Normal View History

import os
from extensions.list import CoreList
from extensions.dict import CoreDict
from helpers.freecadtest import FreeCadASPGenerationTestController
from models.adjacency_matrix_model import (
AdjacencyMatrixModel,
)
from usecases.check_object_has_touches_use_case import (
CheckObjectHasTouchesUseCase,
)
from usecases.clusterisation_sequences_use_case import (
ClusterisationSequenceUseCase,
)
from usecases.check_sequence_use_case import (
CheckSequenceUsecase,
)
from usecases.env_reader_use_case import (
EnvReaderUseCase,
)
from usecases.exit_freecad_use_case import (
ExitFreeCadUseCase,
)
from usecases.intersection_geometry_use_case import (
IntersectionGeometryUseCase,
)
from usecases.open_freecad_document_use_case import (
OpenFreeCadDocumentUseCase,
)
import FreeCad as App
import FreeCadGUI as Gui
from mocks.mock_structure import bottle_jack_mock_structure, simple_cube_mock_structure
#Функционал для реализации в main
#Отсюда тянем необходимые для работы верстака функции
""" 'Check Model': (my_function1, "Path/to/icon1.svg"),
'Constraints Autogeneration': (my_function2, "Path/to/icon2.svg"),
'Constraints Editing': (my_function1, "Path/to/icon1.svg"),
'Generate AdjMatrix': (my_function1, "Path/to/icon1.svg"),
'Generate Relationship Matrix': (my_function1, "Path/to/icon1.svg"),
'Clusterisation': (my_function1, "Path/to/icon1.svg"),
'StepByStepClusterisation': (my_function1, "Path/to/icon1.svg"),
'Generate Assembly Sequences': (my_function1, "Path/to/icon1.svg"),
'Decomposition Step': (my_function1, "Path/to/icon1.svg")"""
class PreprocessorUsecase:
def initActiveDocument():
activeDoc = App.ActiveDocument
return activeDoc
def checkModel(activeDoc):
IntersectionGeometryUseCase.call(activeDoc, out_path)
def constrAutoGen():
ConstraintsAutoGeneration.call(activeDoc)
def
def main():
try:
EnvReaderUseCase.call().either(
leftF=lambda environment: (
OpenFreeCadDocumentUseCase.call(environment.cadFilePath).either(
leftF=lambda _: (
(
CheckObjectHasTouchesUseCase()
.call(environment.solidBodyPadding)
.either(
leftF=lambda adjaxedMatrix: (
adjaxedMatrix.sequencesToFileSystem(
environment.outPath,
environment.sequencesFixed,
),
IntersectionGeometryUseCase.call(
adjaxedMatrix.matrixGetUniqueContact(),
environment.outPath,
),
adjaxedMatrix.matrixToFileSystem(
environment.outPath,
),
ClusterisationSequenceUseCase(environment.outPath),
ExitFreeCadUseCase.call(),
),
rightF=lambda error: error.toFileSystem(
environment.outPath
),
),
)
),
rightF=lambda error: print(error),
),
),
rightF=lambda error: print(error),
)
except Exception as error:
print(error)
ExitFreeCadUseCase.call()