framework/sequence_generation/usecases/open_freecad_document_use_case.py
2024-03-24 15:26:20 +03:00

18 lines
582 B
Python

from helpers.either import Either, Left, Right
from repository.freecad_repository import (
FreeCadRepository,
)
class OpenFreeCadDocumentUseCase:
"""A class that checks open documents, closes them and opens the one with which the program will work"""
def call(path: str) -> Either:
try:
FreeCadRepository().closeIfOpenDocument()
FreeCadRepository().openDocument(path)
return Left(None)
except Exception as e:
print(e)
print("OpenFreeCadDocumentUseCase error")
return Right(None)