From 33dd320858b5f0488ba152de99ed3cbfda18db71 Mon Sep 17 00:00:00 2001 From: IDONTSUDO Date: Wed, 5 Jul 2023 13:33:45 +0000 Subject: [PATCH] Additional comments to assembly sequence planner algorithms --- cad_stability_check/main.py | 16 +++++++++------- cad_stability_input/gui/my_numpy_function.py | 4 ---- geometric_feasibility_predicate/main.py | 9 ++++++--- 3 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 cad_stability_input/gui/my_numpy_function.py diff --git a/cad_stability_check/main.py b/cad_stability_check/main.py index 4ecc089..fa61c29 100644 --- a/cad_stability_check/main.py +++ b/cad_stability_check/main.py @@ -16,19 +16,21 @@ def getFullPathObj(assemblyFolder: str, name: str): def computedStability(refElement, childElement): - b = childElement.Shape.BoundBox + rootElement = childElement.Shape.BoundBox + # Создание обьекта на котором делается операция пересечения App.activeDocument().addObject("Part::MultiCommon", "Common") App.activeDocument().Common.Shapes = [refElement, childElement, ] - App.ActiveDocument.getObject('Common').ViewObject.ShapeColor = getattr(App.getDocument('cubes').getObject( - refElement.Name).getLinkedObject(True).ViewObject, 'ShapeColor', App.getDocument('cubes').getObject('Common').ViewObject.ShapeColor) - App.ActiveDocument.getObject('Common').ViewObject.DisplayMode = getattr(App.getDocument('cubes').getObject( - childElement.Name).getLinkedObject(True).ViewObject, 'DisplayMode', App.getDocument('cubes').getObject('Common').ViewObject.DisplayMode) + App.ActiveDocument.getObject('Common').ViewObject.ShapeColor = getattr(App.ActiveDocument.getObject( + refElement.Name).getLinkedObject(True).ViewObject, 'ShapeColor', App.ActiveDocument.getObject('Common').ViewObject.ShapeColor) + App.ActiveDocument.getObject('Common').ViewObject.DisplayMode = getattr(App.ActiveDocument.getObject( + childElement.Name).getLinkedObject(True).ViewObject, 'DisplayMode', App.ActiveDocument.getObject('Common').ViewObject.DisplayMode) App.ActiveDocument.recompute() obj = App.ActiveDocument.getObjectsByLabel('Common')[0] - + shp = obj.Shape bbox = shp.BoundBox - if bbox.XLength == b.XLength and bbox.YLength == b.YLength and b.ZLength == bbox.ZLength: + # Если после операции пересечения зона обьекта совпадает с зоной тестируемого обьекта то тест прошел успешно + if bbox.XLength == rootElement.XLength and bbox.YLength == rootElement.YLength and rootElement.ZLength == bbox.ZLength: return True return False diff --git a/cad_stability_input/gui/my_numpy_function.py b/cad_stability_input/gui/my_numpy_function.py deleted file mode 100644 index d74c650..0000000 --- a/cad_stability_input/gui/my_numpy_function.py +++ /dev/null @@ -1,4 +0,0 @@ -import numpy as np - -def my_foo(value): - return np.sqrt(value) diff --git a/geometric_feasibility_predicate/main.py b/geometric_feasibility_predicate/main.py index 32e592f..d3db3ea 100644 --- a/geometric_feasibility_predicate/main.py +++ b/geometric_feasibility_predicate/main.py @@ -131,7 +131,7 @@ collision_squares_labels = [] class MeshGeometryCoordinateModel(object): - + # Получение геометрии мешей def __init__(self, x, y, z, label,): self.x = x self.y = y @@ -181,6 +181,7 @@ class FS: class GetAllPartsLabelsUseCase: + # Получение всех названий деталей def call(self): parts = [] for part in FreeCadRepository().getAllSolids(): @@ -197,7 +198,7 @@ def isUnique(array, element): class GetCollisionAtPrimitiveUseCase(object): - + # Получение колизий примитивов def call(self, freeCadMetaModels, detailSquares) -> Dict[str, List[str]]: matrix: Dict[str, List[str]] = {} for model in freeCadMetaModels: @@ -221,12 +222,13 @@ class GetCollisionAtPrimitiveUseCase(object): class GetFirstDetailUseCase: + # Получение первой детали def call(self): return FreeCadRepository().getAllSolids()[0].Label class GetPartPrimitiveCoordinatesUseCase(object): - + # Получение координат примитивов def call(self, freeCadMetaModels): meshCoordinates: list[MeshGeometryCoordinateModel] = [] for model in freeCadMetaModels: @@ -301,6 +303,7 @@ class RenderPrimitivesScenario(object): class ClearWorkSpaceDocumentUseCase(object): + # Очистака рабочего пространства def call(self, detailSquares): for key in detailSquares: for renderPrimitive in detailSquares[key]: