Additional comments to assembly sequence planner algorithms
This commit is contained in:
parent
12482ff40f
commit
33dd320858
3 changed files with 15 additions and 14 deletions
|
@ -16,19 +16,21 @@ def getFullPathObj(assemblyFolder: str, name: str):
|
||||||
|
|
||||||
|
|
||||||
def computedStability(refElement, childElement):
|
def computedStability(refElement, childElement):
|
||||||
b = childElement.Shape.BoundBox
|
rootElement = childElement.Shape.BoundBox
|
||||||
|
# Создание обьекта на котором делается операция пересечения
|
||||||
App.activeDocument().addObject("Part::MultiCommon", "Common")
|
App.activeDocument().addObject("Part::MultiCommon", "Common")
|
||||||
App.activeDocument().Common.Shapes = [refElement, childElement, ]
|
App.activeDocument().Common.Shapes = [refElement, childElement, ]
|
||||||
App.ActiveDocument.getObject('Common').ViewObject.ShapeColor = getattr(App.getDocument('cubes').getObject(
|
App.ActiveDocument.getObject('Common').ViewObject.ShapeColor = getattr(App.ActiveDocument.getObject(
|
||||||
refElement.Name).getLinkedObject(True).ViewObject, 'ShapeColor', App.getDocument('cubes').getObject('Common').ViewObject.ShapeColor)
|
refElement.Name).getLinkedObject(True).ViewObject, 'ShapeColor', App.ActiveDocument.getObject('Common').ViewObject.ShapeColor)
|
||||||
App.ActiveDocument.getObject('Common').ViewObject.DisplayMode = getattr(App.getDocument('cubes').getObject(
|
App.ActiveDocument.getObject('Common').ViewObject.DisplayMode = getattr(App.ActiveDocument.getObject(
|
||||||
childElement.Name).getLinkedObject(True).ViewObject, 'DisplayMode', App.getDocument('cubes').getObject('Common').ViewObject.DisplayMode)
|
childElement.Name).getLinkedObject(True).ViewObject, 'DisplayMode', App.ActiveDocument.getObject('Common').ViewObject.DisplayMode)
|
||||||
App.ActiveDocument.recompute()
|
App.ActiveDocument.recompute()
|
||||||
obj = App.ActiveDocument.getObjectsByLabel('Common')[0]
|
obj = App.ActiveDocument.getObjectsByLabel('Common')[0]
|
||||||
|
|
||||||
shp = obj.Shape
|
shp = obj.Shape
|
||||||
bbox = shp.BoundBox
|
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 True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
def my_foo(value):
|
|
||||||
return np.sqrt(value)
|
|
|
@ -131,7 +131,7 @@ collision_squares_labels = []
|
||||||
|
|
||||||
|
|
||||||
class MeshGeometryCoordinateModel(object):
|
class MeshGeometryCoordinateModel(object):
|
||||||
|
# Получение геометрии мешей
|
||||||
def __init__(self, x, y, z, label,):
|
def __init__(self, x, y, z, label,):
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
|
@ -181,6 +181,7 @@ class FS:
|
||||||
|
|
||||||
|
|
||||||
class GetAllPartsLabelsUseCase:
|
class GetAllPartsLabelsUseCase:
|
||||||
|
# Получение всех названий деталей
|
||||||
def call(self):
|
def call(self):
|
||||||
parts = []
|
parts = []
|
||||||
for part in FreeCadRepository().getAllSolids():
|
for part in FreeCadRepository().getAllSolids():
|
||||||
|
@ -197,7 +198,7 @@ def isUnique(array, element):
|
||||||
|
|
||||||
|
|
||||||
class GetCollisionAtPrimitiveUseCase(object):
|
class GetCollisionAtPrimitiveUseCase(object):
|
||||||
|
# Получение колизий примитивов
|
||||||
def call(self, freeCadMetaModels, detailSquares) -> Dict[str, List[str]]:
|
def call(self, freeCadMetaModels, detailSquares) -> Dict[str, List[str]]:
|
||||||
matrix: Dict[str, List[str]] = {}
|
matrix: Dict[str, List[str]] = {}
|
||||||
for model in freeCadMetaModels:
|
for model in freeCadMetaModels:
|
||||||
|
@ -221,12 +222,13 @@ class GetCollisionAtPrimitiveUseCase(object):
|
||||||
|
|
||||||
|
|
||||||
class GetFirstDetailUseCase:
|
class GetFirstDetailUseCase:
|
||||||
|
# Получение первой детали
|
||||||
def call(self):
|
def call(self):
|
||||||
return FreeCadRepository().getAllSolids()[0].Label
|
return FreeCadRepository().getAllSolids()[0].Label
|
||||||
|
|
||||||
|
|
||||||
class GetPartPrimitiveCoordinatesUseCase(object):
|
class GetPartPrimitiveCoordinatesUseCase(object):
|
||||||
|
# Получение координат примитивов
|
||||||
def call(self, freeCadMetaModels):
|
def call(self, freeCadMetaModels):
|
||||||
meshCoordinates: list[MeshGeometryCoordinateModel] = []
|
meshCoordinates: list[MeshGeometryCoordinateModel] = []
|
||||||
for model in freeCadMetaModels:
|
for model in freeCadMetaModels:
|
||||||
|
@ -301,6 +303,7 @@ class RenderPrimitivesScenario(object):
|
||||||
|
|
||||||
|
|
||||||
class ClearWorkSpaceDocumentUseCase(object):
|
class ClearWorkSpaceDocumentUseCase(object):
|
||||||
|
# Очистака рабочего пространства
|
||||||
def call(self, detailSquares):
|
def call(self, detailSquares):
|
||||||
for key in detailSquares:
|
for key in detailSquares:
|
||||||
for renderPrimitive in detailSquares[key]:
|
for renderPrimitive in detailSquares[key]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue