Слияние веток 91 и path2pddl
This commit is contained in:
parent
44ee21414b
commit
e86914dba1
24 changed files with 732 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
from repository.file_system_repository import FileSystemRepository
|
||||
from usecases.intersection_computed_use_case import (
|
||||
IntersectionComputedUseCase,
|
||||
)
|
||||
|
||||
import json
|
||||
|
||||
|
||||
class IntersectionGeometryUseCase:
|
||||
"""A class that checks bodies in an assembly for interference and returns the result of the check to a file"""
|
||||
|
||||
def call(contacts, path):
|
||||
import FreeCAD as App
|
||||
|
||||
intersection_geometry = {"status": True, "recalculations": None}
|
||||
for el in contacts:
|
||||
child = App.ActiveDocument.getObjectsByLabel(el.get("child"))[0]
|
||||
parent = App.ActiveDocument.getObjectsByLabel(el.get("parent"))[0]
|
||||
area = IntersectionComputedUseCase.call([child, parent])
|
||||
if area != 0.0:
|
||||
if intersection_geometry.get("recalculations") == None:
|
||||
intersection_geometry["status"] = False
|
||||
intersection_geometry["recalculations"] = []
|
||||
intersection_geometry["recalculations"].append(
|
||||
{"area": area, "connect": el.get("child") + " " + el.get("parent")}
|
||||
)
|
||||
FileSystemRepository.writeFile(
|
||||
json.dumps(intersection_geometry, ensure_ascii=False, indent=4),
|
||||
path,
|
||||
"intersection_geometry.json",
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue