Compare commits
61 commits
master
...
91-materia
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e86914dba1 | ||
![]() |
44ee21414b | ||
![]() |
b0ac3ef1b3 | ||
![]() |
4f75310263 | ||
![]() |
cf036c551f | ||
08aed77c42 | |||
![]() |
136279f3e9 | ||
![]() |
04270f214a | ||
![]() |
618c08e56e | ||
![]() |
b07fceca2a | ||
![]() |
c454e00a65 | ||
![]() |
a1b1e1500b | ||
![]() |
5621cc78e8 | ||
![]() |
a57ab8e9bd | ||
![]() |
b18a9421ab | ||
![]() |
ca54b3f05a | ||
![]() |
9233cd9aa3 | ||
![]() |
8e146f8e3a | ||
![]() |
395daeb237 | ||
![]() |
d090ccfcab | ||
![]() |
a6800b7cde | ||
![]() |
c0ed7fa607 | ||
![]() |
46758e4b62 | ||
![]() |
8971bb13df | ||
![]() |
19b8eeb441 | ||
![]() |
a848d92a14 | ||
![]() |
e6c1a3fece | ||
![]() |
d27f2fb762 | ||
![]() |
da7a3c995c | ||
![]() |
f9f58b3971 | ||
![]() |
3e3a7360b8 | ||
![]() |
aa4ff52a30 | ||
![]() |
fe714b1123 | ||
![]() |
249f28721e | ||
![]() |
07f7c5ab70 | ||
![]() |
f08a38824f | ||
![]() |
ed70c47b7c | ||
![]() |
6983c833f2 | ||
![]() |
f59bb9d801 | ||
![]() |
18f2dbb240 | ||
![]() |
dde3bde235 | ||
![]() |
62949e8292 | ||
![]() |
f844cfccd3 | ||
![]() |
e54b5e853b | ||
![]() |
a8573a2dea | ||
![]() |
af9c849d07 | ||
![]() |
bec4f0b469 | ||
![]() |
55ad261863 | ||
![]() |
4dd0f948ed | ||
![]() |
bd12df9d85 | ||
![]() |
dfb647a3ec | ||
![]() |
988a5c65e0 | ||
![]() |
9d1d5cda45 | ||
![]() |
1086acfa16 | ||
![]() |
5bc70326ed | ||
![]() |
4ffa7f7c08 | ||
![]() |
c1e408774b | ||
![]() |
0c8767e3f5 | ||
![]() |
29cad491f5 | ||
![]() |
b5c5ec0bd6 | ||
![]() |
b9779dd01f |
69 changed files with 2928 additions and 323 deletions
1
cad_stability_input
Submodule
1
cad_stability_input
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 821cd287ef30fd6a0ba7cb420b6b7e6ff1b91577
|
|
@ -1,166 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="64.1875"
|
||||
height="64.1875"
|
||||
id="svg3799"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="my_resources.svg">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1855"
|
||||
inkscape:window-height="1056"
|
||||
id="namedview3241"
|
||||
showgrid="false"
|
||||
inkscape:zoom="3.2883564"
|
||||
inkscape:cx="103.51645"
|
||||
inkscape:cy="-10.131949"
|
||||
inkscape:window-x="65"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg3799" />
|
||||
<defs
|
||||
id="defs3801">
|
||||
<marker
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
id="EmptyTriangleOutL"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
|
||||
transform="matrix(0.8,0,0,0.8,-4.8,0)"
|
||||
id="path4487"
|
||||
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
|
||||
</marker>
|
||||
<marker
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
id="DotS"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
|
||||
transform="matrix(0.2,0,0,0.2,1.48,0.2)"
|
||||
id="path4394"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
|
||||
</marker>
|
||||
<marker
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
id="DotL"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
|
||||
transform="matrix(0.8,0,0,0.8,5.92,0.8)"
|
||||
id="path4388"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
|
||||
</marker>
|
||||
<marker
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
id="Tail"
|
||||
style="overflow:visible">
|
||||
<g
|
||||
transform="scale(-1.2,-1.2)"
|
||||
id="g4363">
|
||||
<path
|
||||
d="M -3.8048674,-3.9585227 0.54352094,0"
|
||||
id="path4365"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
|
||||
<path
|
||||
d="M -1.2866832,-3.9585227 3.0617053,0"
|
||||
id="path4367"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
|
||||
<path
|
||||
d="M 1.3053582,-3.9585227 5.6537466,0"
|
||||
id="path4369"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
|
||||
<path
|
||||
d="M -3.8048674,4.1775838 0.54352094,0.21974226"
|
||||
id="path4371"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
|
||||
<path
|
||||
d="M -1.2866832,4.1775838 3.0617053,0.21974226"
|
||||
id="path4373"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
|
||||
<path
|
||||
d="M 1.3053582,4.1775838 5.6537466,0.21974226"
|
||||
id="path4375"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round" />
|
||||
</g>
|
||||
</marker>
|
||||
<marker
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
id="Arrow1Sstart"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
|
||||
transform="matrix(0.2,0,0,0.2,1.2,0)"
|
||||
id="path4339"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
|
||||
</marker>
|
||||
<marker
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
id="Arrow1Lstart"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
|
||||
transform="matrix(0.8,0,0,0.8,10,0)"
|
||||
id="path4327"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" />
|
||||
</marker>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata3804">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
style="fill:none;stroke:#ff0000;stroke-width:10"
|
||||
id="rect4592"
|
||||
width="43.182667"
|
||||
height="47.440113"
|
||||
x="10.643615"
|
||||
y="8.2324944" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
x="19.766714"
|
||||
y="45.637199"
|
||||
id="text4594"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4596"
|
||||
x="19.766714"
|
||||
y="45.637199">T</tspan></text>
|
||||
</svg>
|
Before Width: | Height: | Size: 5.2 KiB |
|
@ -1,48 +0,0 @@
|
|||
import os
|
||||
import FreeCADGui as Gui
|
||||
import FreeCAD as App
|
||||
from gui.init_gui import StabilityWorkbench
|
||||
import json
|
||||
|
||||
|
||||
def importObjAtPath(path: str):
|
||||
import importOBJ
|
||||
importOBJ.insert(u"" + path, App.ActiveDocument.Label)
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def getFullPathObj(assemblyFolder: str, name: str):
|
||||
return assemblyFolder + 'sdf/meshes/' + name + '.obj'
|
||||
|
||||
|
||||
def main():
|
||||
App.newDocument()
|
||||
env = json.loads((open('./env.json')).read())
|
||||
assemblyFolder = env.get('assemblyFolder')
|
||||
|
||||
assemblyStructure = json.loads(
|
||||
(open(assemblyFolder + 'step-structure.json')).read())
|
||||
assemblyNumber = int(env.get('buildNumber')) - 1
|
||||
activeDetail = assemblyStructure[assemblyNumber]
|
||||
|
||||
subassemblyNotParticipatingInMarkup = assemblyStructure[0:assemblyNumber - 1]
|
||||
detailOfTheMarkingZoneOfWhich = assemblyStructure[assemblyNumber - 1]
|
||||
importObjAtPath(getFullPathObj(assemblyFolder, activeDetail))
|
||||
importObjAtPath(getFullPathObj(
|
||||
assemblyFolder, detailOfTheMarkingZoneOfWhich))
|
||||
meshMark = App.ActiveDocument.Objects[0]
|
||||
meshDetailOfTheMarkZone = App.ActiveDocument.Objects[1]
|
||||
meshMark.ViewObject.ShapeColor = (0.31, 0.77, 0.87)
|
||||
meshDetailOfTheMarkZone.ViewObject.ShapeColor = (0.68, 0.66, 0.95)
|
||||
for el in list(map(lambda el: getFullPathObj(assemblyFolder, el), subassemblyNotParticipatingInMarkup)):
|
||||
importObjAtPath(el)
|
||||
for el in App.ActiveDocument.Objects[2:App.ActiveDocument.Objects.__len__()]:
|
||||
el.ViewObject.ShapeColor = (0.32, 0.05, 0.38)
|
||||
Gui.SendMsgToActiveView("ViewSelection")
|
||||
|
||||
Gui.addWorkbench(StabilityWorkbench(env.get('resultURL')))
|
||||
Gui.activateWorkbench("StabilityWorkbench")
|
||||
|
||||
|
||||
main()
|
|
@ -12,6 +12,8 @@
|
|||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
from BoMList import run_BoM_list
|
||||
import pddl.freecad2pddl as freecad2pddl
|
||||
from ImportExportEntities import export_coordinate_systems
|
||||
import FreeCAD
|
||||
import Tools
|
||||
from usecases.asm4parser_usecase import Asm4StructureParseUseCase
|
||||
|
@ -300,12 +302,6 @@ def spawnFeatureFrameCreator():
|
|||
ffpanel = FeatureFramePanel()
|
||||
FreeCADGui.Control.showDialog(ffpanel)
|
||||
|
||||
def BoMGeneration(part):
|
||||
|
||||
|
||||
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",
|
||||
"FeatureFrame")
|
||||
print(obj)
|
||||
|
||||
|
||||
###################################################################
|
||||
|
@ -327,7 +323,11 @@ Tools.spawnClassCommand("FrameCommand",
|
|||
"MenuText": "Make a free frame",
|
||||
"ToolTip": "Make a freestanding reference frame."})
|
||||
|
||||
|
||||
# Tools.spawnClassCommand("ASM4StructureParsing",
|
||||
# RobossemblerFreeCadExportScenario().call,
|
||||
# {"Pixmap": str(os.path.join(icondir, "assembly4.svg")),
|
||||
# "MenuText": "Make a ASM4 parsing",
|
||||
# "ToolTip": "Make a ASM4 1"})
|
||||
Tools.spawnClassCommand("SelectedPartFrameCommand",
|
||||
makeSelectedPartFrames,
|
||||
{"Pixmap": str(os.path.join(icondir, "partframe.svg")),
|
||||
|
@ -345,6 +345,45 @@ Tools.spawnClassCommand("FeatureFrameCommand",
|
|||
"MenuText": "frame on selected primitive",
|
||||
"ToolTip": "Create a frame on selected primitive."})
|
||||
|
||||
Tools.spawnClassCommand("PDDL_CreateTypes",
|
||||
freecad2pddl.add_types,
|
||||
{"Pixmap": str(os.path.join(icondir, "featureframecreator.svg")),
|
||||
"MenuText": "Types",
|
||||
"ToolTip": "Add Types"})
|
||||
|
||||
Tools.spawnClassCommand("PDDL_CreateParameters",
|
||||
freecad2pddl.add_parameters,
|
||||
{"Pixmap": str(os.path.join(icondir, "featureframecreator.svg")),
|
||||
"MenuText": "Parameters",
|
||||
"ToolTip": "Add Parameters"})
|
||||
Tools.spawnClassCommand("PDDL_CreateAction",
|
||||
freecad2pddl.add_action,
|
||||
{"Pixmap": str(os.path.join(icondir, "featureframecreator.svg")),
|
||||
"MenuText": "Action",
|
||||
"ToolTip": "Add Action"})
|
||||
Tools.spawnClassCommand("PDDL_CreatePredicate",
|
||||
freecad2pddl.add_predicate,
|
||||
{"Pixmap": str(os.path.join(icondir, "featureframecreator.svg")),
|
||||
"MenuText": "Predicate",
|
||||
"ToolTip": "Add Predicate"})
|
||||
Tools.spawnClassCommand("PDDL_CreateDurativeAction",
|
||||
freecad2pddl.add_durative_action,
|
||||
{"Pixmap": str(os.path.join(icondir, "featureframecreator.svg")),
|
||||
"MenuText": "DurativeAction",
|
||||
"ToolTip": "Add Durative Action"})
|
||||
Tools.spawnClassCommand("PDDL_ExportPDDL",
|
||||
freecad2pddl.export_to_file,
|
||||
{"Pixmap": str(os.path.join(icondir, "featureframecreator.svg")),
|
||||
"MenuText": "ExportDomain",
|
||||
"ToolTip": "Create and Export Domain.pddl to File"})
|
||||
|
||||
Tools.spawnClassCommand("Export_Entities",
|
||||
export_coordinate_systems,
|
||||
{"Pixmap": str(os.path.join(icondir, "BoMList.svg")),
|
||||
"MenuText": "ExportLCS",
|
||||
"ToolTip": "Export all the markups"})
|
||||
|
||||
|
||||
|
||||
###################################################################
|
||||
# GUI buttons
|
||||
|
|
297
cg/freecad/Frames/GripPoseGenerator.py
Normal file
297
cg/freecad/Frames/GripPoseGenerator.py
Normal file
|
@ -0,0 +1,297 @@
|
|||
import FreeCAD
|
||||
import Part
|
||||
|
||||
doc = FreeCAD.ActiveDocument
|
||||
|
||||
|
||||
def check_capture_positions():
|
||||
# Получаем активный документ
|
||||
doc = FreeCAD.ActiveDocument
|
||||
|
||||
# Список тел без позиций захвата
|
||||
bodies_without_capture_positions = []
|
||||
|
||||
# Перебираем все объекты в документе
|
||||
for obj in doc.Objects:
|
||||
if obj.isDerivedFrom("Part::Feature"):
|
||||
# Проверяем, есть ли атрибут "Placement" у объекта
|
||||
if not hasattr(obj, "Placement"):
|
||||
# Если нет, добавляем его в список
|
||||
bodies_without_capture_positions.append(obj.Label)
|
||||
|
||||
# Проверяем результат
|
||||
if len(bodies_without_capture_positions) > 0:
|
||||
print("Следующие тела не имеют позиции захвата:")
|
||||
for body in bodies_without_capture_positions:
|
||||
print(body)
|
||||
else:
|
||||
print("Все тела имеют позиции захвата.")
|
||||
|
||||
|
||||
check_capture_positions()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import FreeCAD as App
|
||||
doc = App.ActiveDocument
|
||||
|
||||
def check_capture_positions():
|
||||
bodies_without_grip_pose = []
|
||||
solid_bodies_list = []
|
||||
lcs_list = []
|
||||
bodies_with_grip_pose = []
|
||||
for obj in doc.Objects:
|
||||
if hasattr(obj, 'Shape') and hasattr(obj.Shape, 'Volume') and obj.Shape.Volume:
|
||||
# if obj.Shape and obj.Shape.Volume:
|
||||
solid_bodies_list.append(obj)
|
||||
print(solid_bodies_list)
|
||||
|
||||
for obj in doc.Objects:
|
||||
if obj.TypeId =='PartDesign::CoordinateSystem':
|
||||
lcs_list.append(obj)
|
||||
print(lcs_list)
|
||||
|
||||
for body in solid_bodies_list:
|
||||
checker = 0
|
||||
for lcs in lcs_list:
|
||||
|
||||
print(checker)
|
||||
if lcs.Attachment_ParentObject == body.Label:
|
||||
checker =+1
|
||||
if checker == 0:
|
||||
bodies_without_grip_pose.append(body)
|
||||
print(bodies_without_grip_pose)
|
||||
|
||||
if len(bodies_without_grip_pose) == 0:
|
||||
print('Все тела имеют позиции захвата')
|
||||
else:
|
||||
print('Имеются тела без позиций захвата:')
|
||||
for body in bodies_without_grip_pose:
|
||||
print(body.Label)
|
||||
|
||||
check_capture_positions()
|
||||
|
||||
|
||||
def create_grip_positions(obj, face1, face2):
|
||||
if not (face1 and face2):
|
||||
App.Console.PrintError("Не выбраны обе грани\n")
|
||||
return
|
||||
|
||||
normal1 = face1.normalAt(0, 0)
|
||||
normal2 = face2.normalAt(0, 0)
|
||||
|
||||
if normal1.isParallel(normal2):
|
||||
# Найдите центры граней
|
||||
center1 = face1.CenterOfMass
|
||||
center2 = face2.CenterOfMass
|
||||
|
||||
# Вычислите расстояние между центрами граней
|
||||
distance = center2 - center1
|
||||
distance = distance.Length
|
||||
|
||||
# Создайте вспомогательную систему координат между гранями
|
||||
coordinate_system = App.ActiveDocument.addObject("Part::CoordinateSystem", "CoordinateSystem")
|
||||
coordinate_system.Placement.Base = center1 + 0.5 * distance * normal1
|
||||
coordinate_system.Placement.Rotation = normal1.getRotationTo(App.Vector(0, 0, 1))
|
||||
|
||||
# Выведите информацию о расстоянии
|
||||
App.Console.PrintMessage(f"Расстояние межу гранью 1 и гранью 2: {distance} мм\n")
|
||||
|
||||
# Обновите графический интерфейс FreeCAD
|
||||
App.ActiveDocument.recompute()
|
||||
else:
|
||||
App.Console.PrintError("Выбранные грани не являются параллельными\n")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
create_grip_positions()
|
||||
|
||||
# Добавление обзервера для касаний
|
||||
v=Gui.activeDocument().activeView()
|
||||
|
||||
#This class logs any mouse button events. As the registered callback function fires twice for 'down' and
|
||||
#'up' events we need a boolean flag to handle this.
|
||||
class ViewObserver:
|
||||
def __init__(self, view):
|
||||
self.view = view
|
||||
|
||||
def logPosition(self, info):
|
||||
down = (info["State"] == "DOWN")
|
||||
pos = info["Position"]
|
||||
if (down):
|
||||
FreeCAD.Console.PrintMessage("Clicked on position: ("+str(pos[0])+", "+str(pos[1])+")\n")
|
||||
pnt = self.view.getPoint(pos)
|
||||
FreeCAD.Console.PrintMessage("World coordinates: " + str(pnt) + "\n")
|
||||
info = self.view.getObjectInfo(pos)
|
||||
FreeCAD.Console.PrintMessage("Object info: " + str(info) + "\n")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
o = ViewObserver(v)
|
||||
c = v.addEventCallback("SoMouseButtonEvent",o.logPosition)
|
||||
|
||||
|
||||
|
||||
|
||||
### getObjectInfo работает
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
|
||||
def getFaceInfo(face):
|
||||
if face:
|
||||
App.Console.PrintMessage(f"Информация о грани: {face}\n")
|
||||
|
||||
# Получите позицию (Base) и ориентацию (Rotation) грани в глобальных координатах
|
||||
placement = face.Placement
|
||||
position = App.Vector(placement.Base)
|
||||
orientation = App.Rotation(placement.Rotation)
|
||||
|
||||
App.Console.PrintMessage(f"Позиция грани: {position}\n")
|
||||
App.Console.PrintMessage(f"Ориентация грани: {orientation}\n")
|
||||
|
||||
def getObjectInfo():
|
||||
selection = Gui.Selection.getSelectionEx()
|
||||
if selection:
|
||||
selected_object = selection[0].Object
|
||||
if selected_object:
|
||||
subelement_name = selection[0].SubElementNames[0]
|
||||
if "Face" in subelement_name:
|
||||
face = selected_object.Shape.Faces[int(subelement_name.split("Face")[1])]
|
||||
getFaceInfo(face)
|
||||
else:
|
||||
App.Console.PrintError("Выберите грань, а не тело или другой элемент\n")
|
||||
else:
|
||||
App.Console.PrintError("Объект не найден\n")
|
||||
else:
|
||||
App.Console.PrintError("Не выбраны объекты\n")
|
||||
|
||||
getObjectInfo()
|
||||
|
||||
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import Part
|
||||
|
||||
|
||||
|
||||
# Функция для получения списка всех объектов с заданным свойством
|
||||
def get_objects_with_property(property_name, property_value):
|
||||
result = []
|
||||
for obj in FreeCAD.ActiveDocument.Objects:
|
||||
if hasattr(obj, "PropertiesList") and property_name in obj.PropertiesList:
|
||||
if obj.getPropertyByName(property_name) == property_value:
|
||||
result.append(obj)
|
||||
return result
|
||||
|
||||
# Получение списка всех объектов с названием тела в свойстве
|
||||
bodies = get_objects_with_property("BodyName", "Body")
|
||||
|
||||
# Получение списка всех объектов
|
||||
all_objects = FreeCAD.ActiveDocument.Objects
|
||||
|
||||
# Поиск и вывод тел, у которых нет связанных вспомогательных объектов
|
||||
for body in bodies:
|
||||
linked_objects = []
|
||||
for obj in all_objects:
|
||||
if obj.hasLinkOf(body):
|
||||
linked_objects.append(obj.Name)
|
||||
if not linked_objects:
|
||||
print(f"Тело без связанных объектов: {body.Name}")
|
||||
|
||||
# Пример использования:
|
||||
# Убедитесь, что в FreeCAD активный документ содержит объекты с свойством "BodyName" и значением "Body"
|
||||
# Затем запустите этот скрипт, и он выведет тела без связанных объектов в терминал
|
||||
|
||||
|
||||
|
||||
def create_coordinate_system(surface1, surface2):
|
||||
if surface1 is None or surface2 is None:
|
||||
App.Console.PrintError("Не удалось найти одну из поверхностей\n")
|
||||
return
|
||||
|
||||
# Проверьте, являются ли поверхности плоскими
|
||||
if surface1.Shape.Faces[0].Surface.TypeId == "Part::Plane" and surface2.Shape.Faces[0].Surface.TypeId == "Part::Plane":
|
||||
# Проверьте, являются ли поверхности параллельными
|
||||
normal1 = surface1.Shape.normalAt(0, 0)
|
||||
normal2 = surface2.Shape.normalAt(0, 0)
|
||||
|
||||
if normal1.isParallel(normal2):
|
||||
# Найдите центры поверхностей
|
||||
center1 = surface1.Shape.BoundBox.Center
|
||||
center2 = surface2.Shape.BoundBox.Center
|
||||
|
||||
# Вычислите расстояние между центрами поверхностей
|
||||
distance = center2 - center1
|
||||
distance = distance.Length
|
||||
|
||||
# Создайте вспомогательную систему координат между поверхностями
|
||||
coordinate_system = App.ActiveDocument.addObject("Part::CoordinateSystem", "CoordinateSystem")
|
||||
coordinate_system.Placement.Base = center1 + 0.5 * distance * normal1
|
||||
coordinate_system.Placement.Rotation = normal1.getRotationTo(App.Vector(0, 0, 1))
|
||||
|
||||
# Выведите информацию о расстоянии
|
||||
App.Console.PrintMessage(f"Расстояние между поверхностью 1 и поверхностью 2: {distance} мм\n")
|
||||
|
||||
# Обновите графический интерфейс FreeCAD
|
||||
App.ActiveDocument.recompute()
|
||||
else:
|
||||
App.Console.PrintError("Выбранные поверхности не являются параллельными\n")
|
||||
else:
|
||||
App.Console.PrintError("Выбранные поверхности не являются плоскими\n")
|
||||
|
||||
# Создайте пользовательский интерфейс кнопки для вызова функции
|
||||
class CoordinateSystemTool:
|
||||
def Activated(self):
|
||||
selection = Gui.Selection.getSelectionEx()
|
||||
if len(selection) == 2:
|
||||
create_coordinate_system(selection[0].Object, selection[1].Object)
|
||||
else:
|
||||
App.Console.PrintError("Выберите две параллельные плоскости\n")
|
||||
|
||||
def GetResources(self):
|
||||
return {
|
||||
'Pixmap': 'path/to/your/icon.png', # Замените на путь к значку кнопки
|
||||
'MenuText': 'Создать вспомогательную систему координат',
|
||||
'ToolTip': 'Создать вспомогательную систему координат между двумя плоскостями'
|
||||
}
|
||||
|
||||
# Зарегистрируйте пользовательский инструмент
|
||||
Gui.addCommand('My_Coordinate_System_Tool', CoordinateSystemTool())
|
||||
|
||||
|
||||
#### эта штука работает vvv
|
||||
|
||||
# Функция для создания вспомогательного объекта и установки свойства "AttachmentType"
|
||||
def create_helper_object_with_attribute(body, attribute_value):
|
||||
helper_object = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "HelperObject")
|
||||
helper_object.addProperty("App::PropertyString", "AttachmentType").AttachmentType = attribute_value
|
||||
helper_object.addProperty("App::PropertyString", "AttachedObject")
|
||||
helper_object.AttachedObject = body.Label
|
||||
|
||||
|
||||
# Пример использования:
|
||||
# Замените "MyBody" на имя тела, к которому вы хотите привязать вспомогательный объект
|
||||
body_to_attach = FreeCAD.ActiveDocument.getObjectsByLabel("gear_frame_221213")[0]
|
||||
if body_to_attach:
|
||||
create_helper_object_with_attribute(body_to_attach, "Body")
|
||||
else:
|
||||
print("Тело не найдено в активном документе.")
|
||||
|
||||
|
||||
#итого, план такой:
|
||||
|
||||
0. Проверяем тело на наличие позиций захвата
|
||||
0.1. Выводим список всех тел без позиции, иначе говорим что все ок
|
||||
1. Создаем вспомогательную систему координат. у нее имеется свойство, привязывающее ее к определенному телу
|
||||
1.1 Создаем ее с помощью выбора двух поверхностей, которые противоположно направлены друг к другу. Все данные вносим в созданный обьект
|
||||
1.2 Опционально - проверяем ее с помощью призрака захвата
|
||||
2. Экспортируем ее в json
|
|
@ -47,7 +47,7 @@ def export_coordinate_systems():
|
|||
|
||||
print("Экспорт обьектов завершен.")
|
||||
|
||||
export_coordinate_systems()
|
||||
# export_coordinate_systems()
|
||||
|
||||
|
||||
#работает
|
||||
|
@ -100,6 +100,6 @@ export_coordinate_systems()
|
|||
|
||||
# print("Импорт локальных систем координат завершен.")
|
||||
|
||||
|
||||
# # Пример использования
|
||||
# #import_coordinate_systems()
|
||||
|
||||
|
|
|
@ -46,9 +46,15 @@ class Frames(Workbench):
|
|||
]
|
||||
self.toolcommands = [
|
||||
"ExportPlacementAndPropertiesCommand",
|
||||
"Export_Entities",
|
||||
"ExportGazeboModels",
|
||||
"InsertGraspPose",
|
||||
"ASM4StructureParsing"
|
||||
"ASM4StructureParsing",
|
||||
"PDDL_CreateTypes",
|
||||
"PDDL_CreateParameters",
|
||||
"PDDL_CreateAction",
|
||||
"PDDL_CreatePredicate",
|
||||
"PDDL_CreateDurativeAction"
|
||||
]
|
||||
self.appendToolbar(f"{__class__.__name__} Frames", self.framecommands)
|
||||
self.appendToolbar(f"{__class__.__name__} Tools", self.toolcommands)
|
||||
|
|
29
cg/freecad/Frames/chekingEntities.py
Normal file
29
cg/freecad/Frames/chekingEntities.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import FreeCAD
|
||||
|
||||
# Функция для получения списка всех объектов с заданным свойством
|
||||
def get_objects_with_property(property_name, property_value):
|
||||
result = []
|
||||
for obj in FreeCAD.ActiveDocument.Objects:
|
||||
if hasattr(obj, "PropertiesList") and property_name in obj.PropertiesList:
|
||||
if obj.getPropertyByName(property_name) == property_value:
|
||||
result.append(obj)
|
||||
return result
|
||||
|
||||
# Получение списка всех объектов с названием тела в свойстве
|
||||
bodies = get_objects_with_property("BodyName", "Body")
|
||||
|
||||
# Получение списка всех объектов
|
||||
all_objects = FreeCAD.ActiveDocument.Objects
|
||||
|
||||
# Поиск и вывод тел, у которых нет связанных вспомогательных объектов
|
||||
for body in bodies:
|
||||
linked_objects = []
|
||||
for obj in all_objects:
|
||||
if obj.hasLinkOf(body):
|
||||
linked_objects.append(obj.Name)
|
||||
if not linked_objects:
|
||||
print(f"Тело без связанных объектов: {body.Name}")
|
||||
|
||||
# Пример использования:
|
||||
# Убедитесь, что в FreeCAD активный документ содержит объекты с свойством "BodyName" и значением "Body"
|
||||
# Затем запустите этот скрипт, и он выведет тела без связанных объектов в терминал
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
import subprocess
|
||||
# import FreeCAD
|
||||
# import Mesh
|
||||
|
||||
|
||||
import gcoder
|
||||
|
||||
|
||||
# gcode_path = '/home/mark-voltov/Winder/axis.gcode'
|
||||
|
||||
# gcode.main(gcode)
|
||||
|
||||
|
||||
|
||||
file_path = '/home/mark-voltov/Winder/axis.gcode'
|
||||
gcoder_path = '/home/mark-voltov/GitProjects/framework/cg/freecad/Frames/gcoder.py'
|
||||
|
||||
|
||||
with open(file_path, 'r') as file:
|
||||
gcode = file.readlines()
|
||||
|
||||
# print(gcode)
|
||||
|
||||
(gcoder.LightGCode(gcode))
|
||||
cmd = [file_path gcoder_path]
|
||||
subprocess.run(cmd)
|
||||
# subprocess.run( '/home/mark-voltov/Winder/axis.gcode', '/home/mark-voltov/GitProjects/framework/cg/freecad/Frames/gcoder.py')
|
|
@ -1,60 +0,0 @@
|
|||
# import FreeCAD as App
|
||||
|
||||
|
||||
# doc = App.ActiveDocument
|
||||
|
||||
|
||||
#генерируем pddl
|
||||
#импортируем кучу обьектов из дерева построения freecad
|
||||
|
||||
#задаем шаблон на действие
|
||||
|
||||
predicates = ';; Предикаты \n(:predicates \n(at ?c - component ?location - component) \n(printed ?c - component) \n(has-material ?m - material) \n(compatible ?m - material ?c - component))'
|
||||
|
||||
# print(predicates)
|
||||
|
||||
|
||||
predicates =
|
||||
|
||||
|
||||
(" ;; Предикаты \
|
||||
'(:predicates (at ?c - component ?location - component)' \
|
||||
'(printed ?c - component)' \
|
||||
'(printed ?c - component))'
|
||||
|
||||
|
||||
print(predicates)
|
||||
|
||||
# (:predicates
|
||||
# (at ?c - component ?location - component)
|
||||
# (printed ?c - component)
|
||||
# (has-material ?m - material)
|
||||
# (compatible ?m - material ?c - component))''
|
||||
|
||||
|
||||
|
||||
# ;; Предикаты
|
||||
# (:predicates
|
||||
# (at ?c - component ?location - component)
|
||||
# (printed ?c - component)
|
||||
# (has-material ?m - material)
|
||||
# (compatible ?m - material ?c - component))
|
||||
|
||||
# ;; Действия
|
||||
# (:action load-material
|
||||
# :parameters (?m - material ?c - component)
|
||||
# :precondition (and (at ?m ?c) (compatible ?m ?c))
|
||||
# :effect (has-material ?m))
|
||||
|
||||
# (:action unload-material
|
||||
# :parameters (?m - material ?c - component)
|
||||
# :precondition (has-material ?m)
|
||||
# :effect (and (not (has-material ?m)) (at ?m ?c)))
|
||||
|
||||
# (:action print-component
|
||||
# :parameters (?c - component)
|
||||
# :precondition (and (at ?c ?printer) (has-material ?m) (compatible ?m ?c))
|
||||
# :effect (printed ?c))
|
||||
|
||||
# ;; Цель
|
||||
# (:goal (forall (?c - component) (printed ?c))))
|
81
cg/freecad/Frames/import FreeCAD.py
Normal file
81
cg/freecad/Frames/import FreeCAD.py
Normal file
|
@ -0,0 +1,81 @@
|
|||
import FreeCAD
|
||||
import Part
|
||||
import ImportGui
|
||||
|
||||
class GeometryValidateUseCase:
|
||||
def __init__(self):
|
||||
self.doc = None
|
||||
|
||||
|
||||
|
||||
|
||||
def import_step_and_check(self, file_path):
|
||||
# Очистить сцену перед импортом новой сборки
|
||||
FreeCAD.closeDocument("Unnamed")
|
||||
|
||||
# Создать новый документ FreeCAD
|
||||
self.doc = FreeCAD.newDocument("Unnamed")
|
||||
|
||||
# Импортируйте STEP-файл
|
||||
ImportGui.open(file_path, "Unnamed")
|
||||
|
||||
# Отобразите объект в 3D-виде
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
# Получить список тел в сборке
|
||||
bodies = getBodies(self.doc)
|
||||
|
||||
# Проверить пересечения между телами
|
||||
intersections = self.check_intersections(bodies)
|
||||
self.print_intersections(intersections)
|
||||
|
||||
# Проверить тела на нулевой объем
|
||||
zero_volume_bodies = self.check_zero_volume(bodies)
|
||||
self.print_zero_volume(zero_volume_bodies)
|
||||
|
||||
# Сохранить документ
|
||||
self.save_checked_document(file_path)
|
||||
|
||||
|
||||
def getBodies(doc):
|
||||
bodies = []
|
||||
for obj in doc.Objects:
|
||||
if hasattr(obj, 'TypeId') and obj.TypeId == "Part::Feature":
|
||||
bodies.append(obj)
|
||||
return bodies
|
||||
|
||||
|
||||
|
||||
def check_intersections(self, bodies):
|
||||
intersections = []
|
||||
for i in range(len(bodies)):
|
||||
for j in range(i + 1, len(bodies)):
|
||||
if bodies[i].intersects(bodies[j]):
|
||||
intersections.append((i + 1, j + 1))
|
||||
return intersections
|
||||
|
||||
def check_zero_volume(self, bodies):
|
||||
zero_volume_bodies = [i + 1 for i, body in enumerate(bodies) if body.Volume == 0]
|
||||
return zero_volume_bodies
|
||||
|
||||
def print_intersections(self, intersections):
|
||||
for i, j in intersections:
|
||||
print("Тела пересекаются: Body {} и Body {}".format(i, j))
|
||||
|
||||
def print_zero_volume(self, zero_volume_bodies):
|
||||
for i in zero_volume_bodies:
|
||||
print("Тело {} имеет нулевой объем".format(i))
|
||||
|
||||
def save_checked_document(self, original_file_path):
|
||||
checked_file_path = original_file_path.replace(".step", "_checked.FCStd")
|
||||
FreeCAD.saveDocument(self.doc, checked_file_path)
|
||||
print("Проверенная сборка сохранена в файл:", checked_file_path)
|
||||
FreeCAD.closeDocument("Unnamed")
|
||||
|
||||
|
||||
|
||||
use_case = GeometryValidateUseCase()
|
||||
step_file_path = "/home/mark-voltov/Загрузки/Telegram Desktop/test_asm.STEP"
|
||||
use_case.import_step_and_check(step_file_path)
|
||||
|
84
cg/freecad/Frames/materialOperator.py
Normal file
84
cg/freecad/Frames/materialOperator.py
Normal file
|
@ -0,0 +1,84 @@
|
|||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
|
||||
|
||||
|
||||
#создаем вкладку с материалами
|
||||
|
||||
#концептуально нам нужен лишь обьект, в котором перечислены тела, связанные с материалами
|
||||
|
||||
#создаем объект
|
||||
#указываем референсный материал
|
||||
#указываем референсное тело
|
||||
#добавляем все остальные тела, которые имеют такой же цвет
|
||||
|
||||
|
||||
#план-минимум
|
||||
'''
|
||||
План:
|
||||
|
||||
Сделать приемлемым работу FEM:
|
||||
1. Проверка на уникальность и повторяемость материалов
|
||||
2. Проверка на детали, которые не имеют материала
|
||||
3. Проверка материалов на соответствие требованиям
|
||||
4. Назначение деталям цвета, соответствующего материалам
|
||||
5. Черный материал - тем, кто без материала
|
||||
6. BoM считает плотности деталей и пишет массы. Здесь должна быть функция, считающая массу детали и записывающая ее в свойства детали
|
||||
|
||||
|
||||
'''
|
||||
|
||||
doc = App.ActiveDocument
|
||||
obj = doc.Objects
|
||||
|
||||
|
||||
def partsCheckup(doc):
|
||||
for obj in
|
||||
|
||||
material = doc.addObject('App::Document')
|
||||
|
||||
doc.addObject("App::DocumentObjectGroup", "Materials") #создаем папку с материалами
|
||||
|
||||
group.addObject(material)
|
||||
|
||||
#открываем и выбираем MaterialEditor
|
||||
|
||||
import MaterialEditor
|
||||
MaterialEditor.openEditor()
|
||||
|
||||
doc.addObject('App::')
|
||||
'''
|
||||
Нам нужно указать материал в обьекте
|
||||
'''
|
||||
|
||||
# Создаем папку "Материалы"
|
||||
material_group = doc.addObject("App::DocumentObjectGroup", "Materials")
|
||||
|
||||
'''
|
||||
нужно импортировать материалы
|
||||
самое простое - взять целиком блок fem и работать с этим инструментом
|
||||
в fem они вставляются тупо строкой
|
||||
мы можем считать, что материал задан a.k.a json или что-то такое
|
||||
|
||||
|
||||
'''
|
||||
|
||||
# Создаем файл материалов fcmat
|
||||
material_file = "путь_к_файлу.fcmat" # Укажите путь к файлу материалов
|
||||
|
||||
# Создаем объект "Материал"
|
||||
material_obj = doc.addObject("App::MaterialObject", "Материал")
|
||||
material_obj.Material = material_file
|
||||
|
||||
# Получаем список тел в сборке, состоящих из данного материала
|
||||
part_names = ["Тело1", "Тело2", "Тело3"] # Укажите имена тел
|
||||
for part_name in part_names:
|
||||
part_obj = doc.getObject(part_name)
|
||||
if part_obj:
|
||||
material_obj.addObject(part_obj)
|
||||
|
||||
# Добавляем объект "Материал" в папку "Материалы"
|
||||
material_group.addObject(material_obj)
|
||||
|
||||
# Обновляем вид дерева построения FreeCAD
|
||||
FreeCADGui.updateGui()
|
6
cg/freecad/Frames/material_requirements.JSON
Normal file
6
cg/freecad/Frames/material_requirements.JSON
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
["Density",
|
||||
"DiffuseColor",
|
||||
"EmissiveColor"
|
||||
]
|
169
cg/freecad/Frames/modelExport.py
Normal file
169
cg/freecad/Frames/modelExport.py
Normal file
|
@ -0,0 +1,169 @@
|
|||
'''
|
||||
Эта штука создается с целью проводить все необходимые проверки и манипуляции при движении моделей
|
||||
по пайплайну
|
||||
|
||||
Планируемые фичи:
|
||||
1. Материалы:
|
||||
1.1 Проверка на уникальность
|
||||
1.2 Проверка на повторяемость
|
||||
1.3 Проверки на соответствие материала требованиям
|
||||
1.4 Изменение цветов деталей по факту назначения материалов
|
||||
1.5 Расчет массы по плотностям деталей и прописывание ее в свойствах детали
|
||||
1.6 Указание наименования материала в свойствах детали
|
||||
|
||||
2. Вспомогательные обьекты и тела:
|
||||
2.1. Вспомогательные обьекты имеют отметки о своем статусе
|
||||
2.2. Несолиды имеют пометку несолидовости
|
||||
2.3 Детали без материалов должны быть с материалами
|
||||
|
||||
3. [на будущее] Проверка существования разметки
|
||||
|
||||
4. Дополнение информации в бом-лист (это нужно засунуть в бом, а не сюда)
|
||||
|
||||
|
||||
|
||||
'''
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
from helper.is_solid import is_object_solid
|
||||
import json
|
||||
|
||||
doc = App.ActiveDocument
|
||||
|
||||
#0 Проверка существования директорий
|
||||
#должны быть директории на материалы, на технологические операции, на вспомогательные обьекты
|
||||
#если у нас есть директория "анализ" от Fem, то мы переименуем ее в свою директорию и сделаем ей пометку.
|
||||
#если мы находим материалы в дереве, которые не относятся к этой директории, мы должны засунуть их в нашу директорию
|
||||
#если материалов нет, мы должны указать, что их нет
|
||||
|
||||
|
||||
def materialExistenceCheck(doc):
|
||||
|
||||
# if "Materials" not in doc.Objects:
|
||||
if doc.getObjectsByLabel('Materials') == 0:
|
||||
material_group = doc.addObject("App::DocumentObjectGroup", "Materials")
|
||||
App.Console.PrintMessage("Директория материалов не обнаружена и была создана вновь\n")
|
||||
|
||||
|
||||
else:
|
||||
material_group = doc.getObject("Materials")
|
||||
|
||||
fem_materials = [obj for obj in doc.Objects if (hasattr(obj, 'Proxy') and hasattr(obj.Proxy, 'Type') and obj.Proxy.Type == 'Fem::MaterialCommon')]
|
||||
|
||||
if len(fem_materials) > 0:
|
||||
for material in fem_materials:
|
||||
material_group.addObject(material)
|
||||
print('Материалы успешно скомпонованы')
|
||||
else:
|
||||
|
||||
App.Console.PrintMessage("FEM-материалы не заданы. Укажите FEM-материалы и произведите проверку\n")
|
||||
Gui.updateGui()
|
||||
|
||||
return material_group, fem_materials #шоб не пропадало зазря
|
||||
|
||||
|
||||
[material_group, fem_materials ] = materialExistenceCheck(doc) # укомпоновали материалы
|
||||
|
||||
|
||||
#проверим, что материалы правильно описаны:
|
||||
# Открываем файл JSON с требованиями и загружаем его содержимое
|
||||
# with open('material_requirements.json', 'r') as f:
|
||||
# material_requirements = json.load(f)
|
||||
material_requirements = ["Density",
|
||||
"DiffuseColor",
|
||||
"EmissiveColor"
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
def material_isCorrect(fem_materials, material_requirements):
|
||||
femmat_trobles = {}
|
||||
for femmat in fem_materials:
|
||||
for req in material_requirements:
|
||||
if not ( req in femmat.Material and femmat.Material[req]):
|
||||
if femmat in femmat_trobles:
|
||||
femmat_trobles[femmat].append(req)
|
||||
else:
|
||||
femmat_trobles[femmat] = [req]
|
||||
|
||||
print(femmat_trobles)
|
||||
|
||||
|
||||
material_isCorrect(fem_materials, material_requirements)
|
||||
|
||||
|
||||
#1
|
||||
#1.1 Проверка на уникальность
|
||||
|
||||
#присвоим каждому телу имя материала и значение плотности
|
||||
|
||||
def matProperties2bodies(doc, fem_materials):
|
||||
#проходимся по всем материалам и присваиваем деталюхам параметры
|
||||
#нужно кстати еще цвет им переназначить
|
||||
for femmat in fem_materials:
|
||||
|
||||
body = doc.getObject(femmat.References[0][0].Name).Label #вот эта вот абоба добывает нам тело из перечисления
|
||||
#в это тело нам надо добавить два свойства
|
||||
|
||||
#нужно проверить, есть ли материальные свойства у тела и, если нет, добавить их
|
||||
#в следующей серии будем проверять все тела, есть ли у них материал
|
||||
if 'MaterialName' in body.PropertiesList:
|
||||
if body.getPropertyByName('MaterialName') != femmat.Material['CardName']: #если не совпадает
|
||||
print('ВНИМАНИЕ! Тело ' + body.Label + ' имеет переназначение материалов. Проверьте и укажите один (1) правильный материал!')
|
||||
body.setProperty('MaterialName', femmat.Material['CardName']) #пусть перепишется на новый
|
||||
body.setProperty('Density', femmat.Material['Density']) #плотность
|
||||
else:
|
||||
body.addObjectProperty('MaterialName', femmat.Material['CardName']) #добавляем название материала
|
||||
body.addObjectProperty('Density', femmat.Material['Density']) #добавляем плотность
|
||||
|
||||
|
||||
#считаем массу деталюх
|
||||
density, unit = parse_values(femmat.Material['Density'])
|
||||
volume = body.Shape.Volume
|
||||
body_mass = volume * density
|
||||
body.addObjectProperty('Mass', body_mass) #масса деталюхи
|
||||
|
||||
def bodyWithoutMaterialsCheck(doc):
|
||||
objs = doc.Objects
|
||||
for obj in objs:
|
||||
#проверка на солидовость
|
||||
if (is_object_solid(obj) and ('MaterialName' not in obj.PropertiesList)):
|
||||
print('Деталь ' + obj.Label + 'не имеет назначения материала')
|
||||
|
||||
matProperties2bodies(doc, fem_materials)
|
||||
bodyWithoutMaterialsCheck(doc)
|
||||
|
||||
#после выполнения предыдущей функции у нас появились деталюхи с обозначениями материалов
|
||||
#все деталюхи без этой позиции нужно как-то выделить, а
|
||||
|
||||
#гпт предлагает парсить значение единиц измерения
|
||||
#я с ним соглашусь
|
||||
|
||||
def parse_values(value_str):
|
||||
value = ""
|
||||
unit = ""
|
||||
|
||||
# Проверяем каждый символ в строке плотности
|
||||
for char in value_str:
|
||||
if char.isdigit() or char == ".":
|
||||
# Символ является цифрой или точкой - добавляем его к числу
|
||||
value += char
|
||||
else:
|
||||
# Символ не является цифрой или точкой - считаем его частью единицы измерения
|
||||
unit += char
|
||||
|
||||
# Преобразуем значение плотности в число
|
||||
density = float(value)
|
||||
|
||||
return value, unit
|
||||
|
||||
|
||||
#todo:
|
||||
# сделать проверку на солидовые тела
|
||||
#укомпоновать все вспомогательные обьекты в отдельную штуку
|
||||
#wip
|
||||
|
||||
#подготавливаем действия и состояния для PDDL
|
||||
#
|
69
cg/freecad/Frames/my_problem.pddl
Normal file
69
cg/freecad/Frames/my_problem.pddl
Normal file
|
@ -0,0 +1,69 @@
|
|||
(define (problem my_problem)
|
||||
(:domain roboarm)
|
||||
(:objects
|
||||
ur_manipulator_gripper - arm
|
||||
printer - printer
|
||||
world - zone
|
||||
box1 box2 box3 box4 box5 box6 - part
|
||||
asm0 asm1 asm2 asm3 asm4 asm5 asm6 - assembly
|
||||
)
|
||||
|
||||
(:init
|
||||
not(part_at box1 world)
|
||||
not(part_at box2 world)
|
||||
not(part_at box3 world)
|
||||
not(part_at box4 world)
|
||||
not(part_at box5 world)
|
||||
not(part_at box6 world)
|
||||
(part_of box1 asm1)
|
||||
(part_of box2 asm2)
|
||||
(part_of box3 asm3)
|
||||
(part_of box4 asm4)
|
||||
(part_of box5 asm5)
|
||||
(part_of box6 asm6)
|
||||
(assembly_order asm0 asm1)
|
||||
(assembly_order asm1 asm2)
|
||||
(assembly_order asm2 asm3)
|
||||
(assembly_order asm3 asm4)
|
||||
(assembly_order asm4 asm5)
|
||||
(assembly_order asm5 asm6)
|
||||
|
||||
(printer_available printer)
|
||||
(arm_available ur_manipulator_gripper)
|
||||
(assembly_at asm0 world)
|
||||
(assembled asm0)
|
||||
)
|
||||
|
||||
(:goal (and
|
||||
(assembled asm6)
|
||||
))
|
||||
)
|
||||
|
||||
; нужно указать желаемое конечное состояние
|
||||
; (эффект в конце действия)
|
||||
; в нашем случае, допустим, будет asm6
|
||||
; чтобы включить принтер в процесс, у нас должны спавниться детали
|
||||
|
||||
; будет что-то типа (not part_at box1 workzone)
|
||||
|
||||
; и action print
|
||||
; начальные условия: not part_at box workzone
|
||||
; принтер доступен
|
||||
; в ходе дела парт печатается, принтер не доступен
|
||||
; в конце - принтер доступен, деталь в зоне
|
||||
|
||||
; нужно в генераторе добавить поддержку условий at start и at end
|
||||
; но пока что это можно прописать текстом
|
||||
|
||||
|
||||
; предикаты -
|
||||
; рука доступна - рука
|
||||
; сборка в зоне - сборка зона
|
||||
; деталь часть сборки - деталь сборка
|
||||
; собрана - сборка
|
||||
; сборочный порядок - предсборка следсборка
|
||||
|
||||
; +
|
||||
; деталь в зоне - деталь зона
|
||||
; принтер доступен - принтер
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#creation liste piece
|
||||
LP = []
|
||||
#LC = ['planesParallel','circularEdge']
|
||||
LP2=[]
|
||||
|
||||
for object in FreeCAD.ActiveDocument.Objects:
|
||||
if 'objectType' in object.PropertiesList:
|
||||
LP.append(object.Label)
|
||||
if 'Type' in object.PropertiesList:
|
||||
LP2.append(object.Object1)
|
||||
LP2.append(object.Object2)
|
||||
n=len(LP)
|
||||
for i in range (n):
|
||||
LP[i] = "b_"+str(LP[i]+"_")
|
||||
print(LP)
|
||||
print("le nombre de pièce= : ", len(LP))
|
||||
|
||||
|
||||
|
||||
|
||||
#Matrice X
|
||||
X = [0] * n
|
||||
for i in range (n):
|
||||
X[i] = [0] * n
|
||||
#print(X)
|
||||
#♣Matrice Y
|
||||
Y = [0] * n
|
||||
for i in range (n):
|
||||
Y[i] = [0] * n
|
||||
#print(Y)
|
||||
#Matrice Z
|
||||
Z = [0] * n
|
||||
for i in range (n):
|
||||
Z[i] = [0] * n
|
||||
#print(Z)
|
||||
#Remplisage matrice X
|
||||
for k in range (0,len(LP2),2):
|
||||
if k+1 < (len(LP2)) :
|
||||
i=LP.index(LP2[k])
|
||||
j=LP.index(LP2[k+1])
|
||||
X[i][j] = 1
|
||||
#print(X)
|
||||
u=[0]
|
||||
v=[0]
|
||||
LN=[]
|
||||
for object in FreeCAD.ActiveDocument.Objects:
|
||||
if 'Type' not in object.PropertiesList:
|
||||
maFace = object.Shape.Face[1]
|
||||
myNormal = maFace.normalAt (u, v)
|
||||
LN.append(myNormal)
|
BIN
cg/freecad/Frames/pddl/MillingMachine.FCStd
Normal file
BIN
cg/freecad/Frames/pddl/MillingMachine.FCStd
Normal file
Binary file not shown.
BIN
cg/freecad/Frames/pddl/MillingMachine.FCStd1
Normal file
BIN
cg/freecad/Frames/pddl/MillingMachine.FCStd1
Normal file
Binary file not shown.
BIN
cg/freecad/Frames/pddl/PartDesignExample.FCStd
Normal file
BIN
cg/freecad/Frames/pddl/PartDesignExample.FCStd
Normal file
Binary file not shown.
BIN
cg/freecad/Frames/pddl/PartDesignExample.FCStd1
Normal file
BIN
cg/freecad/Frames/pddl/PartDesignExample.FCStd1
Normal file
Binary file not shown.
BIN
cg/freecad/Frames/pddl/Printer.FCStd
Normal file
BIN
cg/freecad/Frames/pddl/Printer.FCStd
Normal file
Binary file not shown.
8
cg/freecad/Frames/pddl/Readme.md
Normal file
8
cg/freecad/Frames/pddl/Readme.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Модуль "Path2pddl"
|
||||
|
||||
Модуль используется с целью генерации domain-файла pddl на базе созданных в верстаке Path технологических операций.
|
||||
Инженер-технолог, используя верстак, генерирует объекты операций, описывающие процесс создания детали из заготовки. Возможности верстака позволяют описывать работу большинства 2.5D-станков, а так же - 3d-печати (не реализовано в полной мере).
|
||||
|
||||
Для работы необходимо указать ссылки на CAD-модели используемых в сцене инструментов и деталей. Если они были импортированы корректно, то модуль создаст domain-файл. При этом, он будет содержать большое количество индивидуальных операций для каждой детали и станка, у каждой из которых будет своя длительность и свои предусловия, параметры и эффекты.
|
||||
|
||||
Главный недостаток модуля на данный момент - отсутствие автоматической генерации предусловий. Это приводит к тому, что операции необходимо незначительно модернизировать, указывая их вручную. Автоматическое создание предусловий видится довольно сложной задачей, требующей учесть много возможных вариантов, так что, вероятно, будет добавлен позднее.
|
59
cg/freecad/Frames/pddl/domain.pddl
Normal file
59
cg/freecad/Frames/pddl/domain.pddl
Normal file
|
@ -0,0 +1,59 @@
|
|||
(define (domain fabrication)
|
||||
|
||||
(:requirements :strips :typing :fluents :durative-actions)
|
||||
(:types
|
||||
endmill workspace - zone
|
||||
part
|
||||
arm
|
||||
assembly
|
||||
human
|
||||
)
|
||||
(:predicates
|
||||
(endmill_is_ready endmill task observer)
|
||||
(part_at ?p - part ?z - zone)
|
||||
(endmill_ready ?p - printer)
|
||||
(endmill_checked ?p - printer)
|
||||
(endmill_at_work ?p - printer)
|
||||
(assembly_order ?prev ?next - assembly)
|
||||
(assembled ?whole - assembly ?z - zone)
|
||||
(observer_free ?h - human)
|
||||
)
|
||||
(:functions
|
||||
)
|
||||
(:action predpreparing
|
||||
:parameters ()
|
||||
:condition (and
|
||||
(not endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_Profile_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 157)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_Pocket3D_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 170)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_MillFace_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 79)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
)
|
97
cg/freecad/Frames/pddl/etalon_domain.pddl
Normal file
97
cg/freecad/Frames/pddl/etalon_domain.pddl
Normal file
|
@ -0,0 +1,97 @@
|
|||
(define (domain Printer)
|
||||
|
||||
(:requirements :strips :typing :fluents :durative-actions)
|
||||
(:types
|
||||
printer workspace - zone
|
||||
part
|
||||
arm
|
||||
assembly
|
||||
human
|
||||
filament
|
||||
)
|
||||
(:predicates
|
||||
(arm_available ?a - arm)
|
||||
(part_at ?p - part ?z - zone)
|
||||
(printer_ready ?p - printer)
|
||||
(printer_checked ?p - printer)
|
||||
(printer_at_work ?p - printer)
|
||||
(part_of ?part - part ?whole - assembly)
|
||||
(assembly_order ?prev ?next - assembly)
|
||||
(assembled ?whole - assembly ?z - zone)
|
||||
(observer_free ?h - human)
|
||||
(filament_at ?f - filament ?z - zone)
|
||||
)
|
||||
(:functions
|
||||
)
|
||||
(:durative-action print
|
||||
:parameters ( ?p - part ?pr - printer )
|
||||
:duration ( = ?duration 20)
|
||||
:condition (and
|
||||
(at start(printer_ready ?pr))
|
||||
)
|
||||
:effect (and
|
||||
(at start (not (printer_ready ?pr)))
|
||||
(at start (printer_at_work ?pr ))
|
||||
(at end(part_at ?p ?pr))
|
||||
(at end (not (printer_at_work ?pr )))
|
||||
)
|
||||
)
|
||||
(:durative-action remove
|
||||
:parameters ( ?p - part ?pr - printer ?z - zone ?a - arm )
|
||||
:duration ( = ?duration 1)
|
||||
:condition (and
|
||||
(at start (part_at ?p ?pr))
|
||||
(at start (arm_available ?a))
|
||||
)
|
||||
:effect (and
|
||||
(at start (not (arm_available ?a)))
|
||||
(at end (part_at ?p ?z))
|
||||
(at end (arm_available ?a))
|
||||
(at end (printer_ready ?pr))
|
||||
)
|
||||
)
|
||||
(:durative-action assemble
|
||||
:parameters ( ?p - part ?prev ?next - assembly ?arm - arm ?w - workspace )
|
||||
:duration ( = ?duration 5)
|
||||
:condition (and
|
||||
(at start (assembled ?prev ?w))
|
||||
(at start (part_at ?p ?w))
|
||||
(at start (part_of ?p ?next))
|
||||
(at start (arm_available ?arm))
|
||||
(at start (assembly_order ?prev ?next))
|
||||
)
|
||||
:effect (and
|
||||
(at start (not (arm_available ?arm)))
|
||||
(at end (not (part_at ?p ?w)))
|
||||
(at end (arm_available ?arm))
|
||||
(at end (assembled ?next ?w))
|
||||
)
|
||||
)
|
||||
(:durative-action printer_check
|
||||
:parameters ( ?p - printer ?h - human )
|
||||
:duration ( = ?duration 1)
|
||||
:condition (and
|
||||
(at start ( observer_free ?h ))
|
||||
)
|
||||
:effect (and
|
||||
(at start (not (observer_free ?h)))
|
||||
(at end (observer_free ?h))
|
||||
(at end (printer_checked ?p))
|
||||
)
|
||||
)
|
||||
(:durative-action printer_filament_load
|
||||
:parameters ( ?p - printer ?h - human ?f - filament ?z - zone )
|
||||
:duration ( = ?duration 5)
|
||||
:condition (and
|
||||
(at start (printer_checked ?p))
|
||||
(at start (observer_free ?h))
|
||||
(at start (filament_at ?f ?z))
|
||||
)
|
||||
:effect (and
|
||||
(at start (not(observer_free ?h)))
|
||||
(at end (observer_free ?h))
|
||||
(at end (printer_ready ?p))
|
||||
(at end (not (filament_at ?f ?z)))
|
||||
)
|
||||
)
|
||||
)
|
127
cg/freecad/Frames/pddl/etalon_problem.pddl
Normal file
127
cg/freecad/Frames/pddl/etalon_problem.pddl
Normal file
|
@ -0,0 +1,127 @@
|
|||
(define (problem p1)
|
||||
(:domain robossembler)
|
||||
(:objects
|
||||
;; information from Scene
|
||||
rasmt - arm
|
||||
printer1 printer2 printer3 - printer
|
||||
workspace1 - workspace
|
||||
worker - human
|
||||
filament1 filament2 filament3 - filament
|
||||
;; information from CAD
|
||||
pad009003002002 pad009003002003 pad009003002005 pad009003002011 fusion004003 o_2_a001 o_2_m001 o_3_m001 o_3_a001 pad009003002008 fusion005 o_4_m001 o_5_m001 o_5_a001 o_4_a001 fusion006 r_a001 r_m001 r_l001 synfix synfix001 fusion fusion001 synfix002 fusion002 synfix003 fusion007 pad009003002012 pad001 pocket pad002 fusion008 fusion009 bearing_dgsr_6006_001 bearing_dgsr_6006_002 bearing_dgsr_6006_003 bearing_dgsr_6005_ bearing_dgsr_6005_001 bearing_dgsr_6005_002 bearing_dgsr_6005_003 bearing_dgsr_6005_004 pad003 pocket001 - part
|
||||
subasm00 subasm0 subasm1 subasm2 subasm3 subasm4 subasm5 subasm6 subasm7 subasm8 subasm9 subasm10 subasm11 subasm12 subasm13 subasm14 subasm15 subasm16 subasm17 subasm18 subasm19 subasm20 subasm21 subasm22 subasm23 subasm24 subasm25 subasm26 subasm27 subasm28 subasm29 subasm30 subasm31 subasm32 subasm33 subasm34 subasm35 subasm36 subasm37 subasm38 subasm39 subasm40 subasm41 subasm42 - assembly
|
||||
)
|
||||
(:init
|
||||
;; information from Scene
|
||||
|
||||
(observer_free worker)
|
||||
; (not(printer_ready printer1))
|
||||
|
||||
; (printer_ready printer2)
|
||||
; (printer_ready printer3)
|
||||
(filament_at filament1 workspace1)
|
||||
(filament_at filament2 workspace1)
|
||||
(filament_at filament3 workspace1)
|
||||
|
||||
|
||||
(arm_available rasmt)
|
||||
;; information from CAD
|
||||
(assembled subasm00 workspace1)
|
||||
|
||||
|
||||
|
||||
|
||||
(part_of pad009003002002 subasm0)
|
||||
(part_of pad009003002003 subasm1)
|
||||
(part_of pad009003002005 subasm2)
|
||||
(part_of pad009003002011 subasm3)
|
||||
(part_of fusion004003 subasm4)
|
||||
(part_of o_2_a001 subasm5)
|
||||
(part_of o_2_m001 subasm6)
|
||||
(part_of o_3_m001 subasm7)
|
||||
(part_of o_3_a001 subasm8)
|
||||
(part_of pad009003002008 subasm9)
|
||||
(part_of fusion005 subasm10)
|
||||
(part_of o_4_m001 subasm11)
|
||||
(part_of o_5_m001 subasm12)
|
||||
(part_of o_5_a001 subasm13)
|
||||
(part_of o_4_a001 subasm14)
|
||||
(part_of fusion006 subasm15)
|
||||
(part_of r_a001 subasm16)
|
||||
(part_of r_m001 subasm17)
|
||||
(part_of r_l001 subasm18)
|
||||
(part_of synfix subasm19)
|
||||
(part_of synfix001 subasm20)
|
||||
(part_of fusion subasm21)
|
||||
(part_of fusion001 subasm22)
|
||||
(part_of synfix002 subasm23)
|
||||
(part_of fusion002 subasm24)
|
||||
(part_of synfix003 subasm25)
|
||||
(part_of fusion007 subasm26)
|
||||
(part_of pad009003002012 subasm27)
|
||||
(part_of pad001 subasm28)
|
||||
(part_of pocket subasm29)
|
||||
(part_of pad002 subasm30)
|
||||
(part_of fusion008 subasm31)
|
||||
(part_of fusion009 subasm32)
|
||||
(part_of bearing_dgsr_6006_001 subasm33)
|
||||
(part_of bearing_dgsr_6006_002 subasm34)
|
||||
(part_of bearing_dgsr_6006_003 subasm35)
|
||||
(part_of bearing_dgsr_6005_ subasm36)
|
||||
(part_of bearing_dgsr_6005_001 subasm37)
|
||||
(part_of bearing_dgsr_6005_002 subasm38)
|
||||
(part_of bearing_dgsr_6005_003 subasm39)
|
||||
(part_of bearing_dgsr_6005_004 subasm40)
|
||||
(part_of pad003 subasm41)
|
||||
(part_of pocket001 subasm42)
|
||||
|
||||
(assembly_order subasm00 subasm0)
|
||||
(assembly_order subasm0 subasm1)
|
||||
(assembly_order subasm1 subasm2)
|
||||
(assembly_order subasm2 subasm3)
|
||||
(assembly_order subasm3 subasm4)
|
||||
(assembly_order subasm4 subasm5)
|
||||
(assembly_order subasm5 subasm6)
|
||||
(assembly_order subasm6 subasm7)
|
||||
(assembly_order subasm7 subasm8)
|
||||
(assembly_order subasm8 subasm9)
|
||||
(assembly_order subasm9 subasm10)
|
||||
(assembly_order subasm10 subasm11)
|
||||
(assembly_order subasm11 subasm12)
|
||||
(assembly_order subasm12 subasm13)
|
||||
(assembly_order subasm13 subasm14)
|
||||
(assembly_order subasm14 subasm15)
|
||||
(assembly_order subasm15 subasm16)
|
||||
(assembly_order subasm16 subasm17)
|
||||
(assembly_order subasm17 subasm18)
|
||||
(assembly_order subasm18 subasm19)
|
||||
(assembly_order subasm19 subasm20)
|
||||
(assembly_order subasm20 subasm21)
|
||||
(assembly_order subasm21 subasm22)
|
||||
(assembly_order subasm22 subasm23)
|
||||
(assembly_order subasm23 subasm24)
|
||||
(assembly_order subasm24 subasm25)
|
||||
(assembly_order subasm25 subasm26)
|
||||
(assembly_order subasm26 subasm27)
|
||||
(assembly_order subasm27 subasm28)
|
||||
(assembly_order subasm28 subasm29)
|
||||
(assembly_order subasm29 subasm30)
|
||||
(assembly_order subasm30 subasm31)
|
||||
(assembly_order subasm31 subasm32)
|
||||
(assembly_order subasm32 subasm33)
|
||||
(assembly_order subasm33 subasm34)
|
||||
(assembly_order subasm34 subasm35)
|
||||
(assembly_order subasm35 subasm36)
|
||||
(assembly_order subasm36 subasm37)
|
||||
(assembly_order subasm37 subasm38)
|
||||
(assembly_order subasm38 subasm39)
|
||||
(assembly_order subasm39 subasm40)
|
||||
(assembly_order subasm40 subasm41)
|
||||
(assembly_order subasm41 subasm42)
|
||||
)
|
||||
(:goal (and
|
||||
;; information from CAD
|
||||
(assembled subasm42 workspace1)
|
||||
)
|
||||
)
|
||||
)
|
181
cg/freecad/Frames/pddl/freecad2pddl.py
Normal file
181
cg/freecad/Frames/pddl/freecad2pddl.py
Normal file
|
@ -0,0 +1,181 @@
|
|||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#функции для создания обьектов PDDL
|
||||
|
||||
def add_types():
|
||||
doc = App.ActiveDocument
|
||||
types = doc.addObject('App::FeaturePython', 'Types')
|
||||
types.addProperty("App::PropertyString", 'PDDL', 'PDDL').PDDL = 'PDDL'
|
||||
types.addProperty("App::PropertyString", 'Type', 'PDDL').Type = 'Types'
|
||||
types.addProperty("App::PropertyStringList", 'Types', 'PDDL')
|
||||
|
||||
print('Types of objects added successfully')
|
||||
return(types)
|
||||
#слишком много types
|
||||
|
||||
def add_parameters():
|
||||
doc = App.ActiveDocument
|
||||
params = doc.addObject('App::FeaturePython', 'Parameters')
|
||||
params.addProperty("App::PropertyString", 'PDDL', 'PDDL').PDDL = 'PDDL'
|
||||
params.addProperty("App::PropertyString", 'Type', 'PDDL').Type = 'Parameters'
|
||||
params.addProperty('App::PropertyPythonObject', 'Parameters','PDDl')
|
||||
|
||||
print('Domain parameters added successfully')
|
||||
return(params)
|
||||
|
||||
def add_action():
|
||||
doc = App.ActiveDocument
|
||||
|
||||
name = input('Название действия:')
|
||||
action = doc.addObject('App::FeaturePython', str(name))
|
||||
action.addProperty("App::PropertyString", 'PDDL', 'PDDL').PDDL = 'PDDL'
|
||||
action.addProperty("App::PropertyString", 'Type', 'PDDL').Type = 'Action'
|
||||
action.addProperty("App::PropertyStringList", 'Parameters', 'PDDL')
|
||||
action.addProperty("App::PropertyStringList", 'Conditions', 'PDDL')
|
||||
action.addProperty("App::PropertyStringList", 'Effects', 'PDDL')
|
||||
sortEntity(action)
|
||||
print('Action ' + name + 'added successfully')
|
||||
return(action)
|
||||
|
||||
|
||||
def add_predicate():
|
||||
doc = App.ActiveDocument
|
||||
|
||||
name = input('Название предиката:')
|
||||
parms = input('Переменные')
|
||||
predicate = doc.addObject('App::FeaturePython', str(name))
|
||||
predicate.addProperty("App::PropertyString", 'PDDL', 'PDDL').PDDL = 'PDDL'
|
||||
predicate.addProperty("App::PropertyString", 'Type', 'PDDL').Type = 'Predicate'
|
||||
# predicate.addProperty("App::PropertyStringList", 'Name', 'PDDL')
|
||||
predicate.addProperty("App::PropertyStringList", 'Parameters', 'PDDL').Parameters = parms
|
||||
sortEntity(predicate)
|
||||
print('Predicate ' + name + 'added successfully')
|
||||
return(predicate)
|
||||
|
||||
|
||||
def add_durative_action():
|
||||
doc = App.ActiveDocument
|
||||
name = input('Название действия:')
|
||||
action = doc.addObject('App::FeaturePython', str(name))
|
||||
action.addProperty("App::PropertyString", 'PDDL', 'PDDL').PDDL = 'PDDL'
|
||||
action.addProperty("App::PropertyString", 'Type', 'PDDL').Type = 'DurativeAction'
|
||||
action.addProperty("App::PropertyStringList", 'Parameters', 'PDDL')
|
||||
action.addProperty("App::PropertyStringList", 'Conditions', 'PDDL')
|
||||
action.addProperty("App::PropertyStringList", 'Effects', 'PDDL')
|
||||
action.addProperty('App::PropertyString', 'Duration', 'PDDL')
|
||||
sortEntity(action)
|
||||
print('Durative Action ' + name + ' added successfully')
|
||||
return(action)
|
||||
|
||||
|
||||
|
||||
|
||||
def export_to_file():
|
||||
filename = App.ActiveDocument.Name
|
||||
file_path = App.ActiveDocument.FileName.rsplit("/", 1)[0] + filename + '_domain.pddl'
|
||||
|
||||
doc = App.ActiveDocument
|
||||
objs = doc.Objects
|
||||
with open(file_path, 'w') as f:
|
||||
f.write('(define (domain '+ filename +')\n \n')
|
||||
f.write('(:requirements :strips :typing :fluents :durative-actions)\n')
|
||||
|
||||
# Типы обьектов
|
||||
types = doc.getObjectsByLabel('Types')[0]
|
||||
f.write('(:types \n')
|
||||
|
||||
for obj_type in types.Types:
|
||||
f.write(' ' + obj_type + ' \n')
|
||||
f.write(')\n')
|
||||
|
||||
# предикаты
|
||||
f.write(' (:predicates\n')
|
||||
for obj in objs:
|
||||
if hasattr(obj, 'PDDL') and hasattr(obj, 'Type') and obj.Type == 'Predicate':
|
||||
f.write(' ('+ obj.Label)
|
||||
for params in obj.Parameters:
|
||||
f.write(' ' + params)
|
||||
f.write(')\n')
|
||||
f.write(' )\n')
|
||||
|
||||
# функции
|
||||
f.write(' (:functions\n')
|
||||
f.write(' )\n')
|
||||
|
||||
#действия:
|
||||
for obj in objs:
|
||||
if hasattr(obj, 'PDDL') and hasattr(obj, 'Type') and obj.Type == 'Action':
|
||||
f.write('(:action ' + obj.Label + '\n')
|
||||
f.write(' :parameters (')
|
||||
for params in obj.Parameters:
|
||||
f.write('' + params + ' ')
|
||||
f.write(')\n')
|
||||
f.write(' :condition (and \n')
|
||||
|
||||
for condition in obj.Conditions:
|
||||
f.write(' (' + condition + ') \n')
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
f.write(' :effect (and \n')
|
||||
|
||||
for effect in obj.Effects:
|
||||
f.write(' (' + effect + ') \n')
|
||||
# f.write(' ')
|
||||
f.write(')\n')
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
# длительные действия:
|
||||
for obj in objs:
|
||||
if hasattr(obj, 'PDDL') and hasattr(obj, 'Type') and obj.Type == 'DurativeAction':
|
||||
f.write('(:durative-action ' + obj.Label + '\n')
|
||||
f.write(' :parameters (')
|
||||
for params in obj.Parameters:
|
||||
f.write(' ' + params )
|
||||
f.write(' )\n')
|
||||
f.write(' :duration ( = ?duration '+ str(obj.Duration) +')\n')
|
||||
f.write(' :condition (and \n')
|
||||
|
||||
for condition in obj.Conditions:
|
||||
f.write(' (' + condition + ') \n')
|
||||
# f.write(') ')
|
||||
# f.write(')\n')
|
||||
f.write(' )\n')
|
||||
|
||||
f.write(' :effect (and \n')
|
||||
|
||||
for effect in obj.Effects:
|
||||
f.write(' (' + effect + ') \n')
|
||||
# f.write(' ')
|
||||
f.write(')\n')
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
|
||||
|
||||
def sortEntity(object):
|
||||
doc = App.ActiveDocument
|
||||
|
||||
|
||||
if len(doc.getObjectsByLabel(object.Type)) == 0:
|
||||
pddl_group = doc.addObject("App::DocumentObjectGroup", object.Type)
|
||||
else:
|
||||
pddl_group = doc.getObjectsByLabel(object.Type)[0]
|
||||
pddl_group.addObject(object)
|
||||
|
||||
|
||||
|
||||
Gui.updateGui()
|
||||
|
||||
|
||||
|
343
cg/freecad/Frames/pddl/path2pddl.py
Normal file
343
cg/freecad/Frames/pddl/path2pddl.py
Normal file
|
@ -0,0 +1,343 @@
|
|||
import os
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import json
|
||||
|
||||
#1. Экспорт фрикадовских операций
|
||||
|
||||
|
||||
printer = '/home/mark-voltov/GitProjects/framework/cg/freecad/Frames/pddl/Printer.FCStd'
|
||||
endmill = '/home/mark-voltov/GitProjects/framework/cg/freecad/Frames/pddl/MillingMachine.FCStd'
|
||||
part1 = '/home/mark-voltov/GitProjects/framework/cg/freecad/Frames/pddl/PartDesignExample.FCStd'
|
||||
#потенциально, можно здесь полностью задавать все описание сцены
|
||||
|
||||
toolslist = [printer, endmill]
|
||||
partlist = [part1]
|
||||
|
||||
part = App.open(part1)
|
||||
tool = App.open(endmill)
|
||||
|
||||
def pathCheck(part):
|
||||
checker = False
|
||||
for obj in part.Objects:
|
||||
if hasattr(obj, 'TypeId') and obj.TypeId == 'Path::FeaturePython':
|
||||
if obj.Label == 'Job':
|
||||
checker = True
|
||||
return checker
|
||||
|
||||
|
||||
|
||||
operations_data = []
|
||||
|
||||
#нужно дополнить фиксированием принадлежности к телу
|
||||
def is_entity_in_folder(part, entity, folder_name):
|
||||
|
||||
# Поиск папки с заданным именем
|
||||
folder = None
|
||||
for obj in part.Objects:
|
||||
if obj.isDerivedFrom("App::DocumentObjectGroup") and obj.Label == folder_name:
|
||||
folder = obj
|
||||
break
|
||||
|
||||
# Если папка не найдена, вернуть False
|
||||
if not folder:
|
||||
return False
|
||||
|
||||
# Проверка наличия сущности внутри папки
|
||||
return entity in folder.Group
|
||||
|
||||
|
||||
#выделяем те сущности, которые являются операциями
|
||||
def operationsInfoCollecting(part):
|
||||
if pathCheck(part):
|
||||
for obj in part.Objects:
|
||||
if is_entity_in_folder(part, obj, 'Operations'):
|
||||
operations_data.append({'Part_label': part.Label,
|
||||
'Operation_name': obj.Label,
|
||||
'Tool': obj.ToolController.Label,
|
||||
'Duration': obj.CycleTime})
|
||||
|
||||
else:
|
||||
print('Операции не были обнаружены')
|
||||
|
||||
return operations_data
|
||||
|
||||
|
||||
# Словарь для группировки операций по станкам
|
||||
machines_operations = {}
|
||||
|
||||
|
||||
|
||||
|
||||
def toolOperationCollector(tool):
|
||||
#соберем отдельно список pddl-операций из файла станка и будем работать с ним отдельно
|
||||
tool_operations = []
|
||||
for obj in tool.Objects:
|
||||
if hasattr(obj, 'PDDL') and hasattr(obj, 'Type') and obj.Type == 'DurativeAction':
|
||||
tool_operations.append({'Label': obj.Label,
|
||||
'Conditions': obj.Conditions,
|
||||
'Duration': 0,
|
||||
'Effects': obj.Effects,
|
||||
'Parameters': obj.Parameters,
|
||||
'Type': obj.Type
|
||||
})
|
||||
return tool_operations
|
||||
|
||||
|
||||
def operationGenerator(tool, operations_data):
|
||||
|
||||
tool_operations = toolOperationCollector(tool)
|
||||
|
||||
|
||||
#отсеиваем все действия
|
||||
pddl_actions = []
|
||||
for part_operation in operations_data:
|
||||
for tool_operation in tool_operations:
|
||||
if tool_operation['Label'] == part_operation['Tool']:
|
||||
pddl_actions.append({'Label': part_operation['Part_label'] + '_' + part_operation['Operation_name'] + '_' + tool_operation['Label'],
|
||||
'Partname': part_operation['Part_label'],
|
||||
'Conditions': tool_operation['Conditions'],
|
||||
'Duration': part_operation['Duration'],
|
||||
'Effects': tool_operation['Effects'],
|
||||
'Parameters': tool_operation['Parameters'],
|
||||
'Type': tool_operation['Type'],
|
||||
'Tool': tool_operation['Label']
|
||||
})
|
||||
#здесь у нас появился список операций применительно к одному станку
|
||||
#выполнив эту функцию для каждого станка, получим кучу операций для всего
|
||||
return pddl_actions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#теперь нужно собрать все операции в один pddl
|
||||
#нужно извлечь все действия и все не-действия, первое идет из tool_operations, второе - нужно отбирать из станков напрямую
|
||||
|
||||
def collectingNonActions(tool):
|
||||
tool_non_operations = []
|
||||
for obj in tool.Objects:
|
||||
if hasattr(obj, 'PDDL') and hasattr(obj,'Type') and obj.Type != 'DurativeAction':
|
||||
tool_non_operations.append(export_object_properties(obj))
|
||||
return tool_non_operations
|
||||
|
||||
|
||||
|
||||
def export_object_properties(obj):
|
||||
obj_dict = {}
|
||||
|
||||
# Получение всех свойств объекта
|
||||
properties = obj.PropertiesList
|
||||
|
||||
for prop_name in properties:
|
||||
prop = obj.getPropertyByName(prop_name)
|
||||
obj_dict[prop_name] = prop
|
||||
|
||||
return obj_dict
|
||||
|
||||
#у нас есть словари с действиями и недействиями
|
||||
#собираем их в pddl
|
||||
|
||||
def time_in_sec(time_str):
|
||||
|
||||
# Разделяем часы, минуты и секунды
|
||||
hours, minutes, seconds = map(int, time_str.split(":"))
|
||||
# Переводим в секунды
|
||||
time_in_seconds = (hours * 3600) + (minutes * 60) + seconds
|
||||
return time_in_seconds
|
||||
|
||||
|
||||
|
||||
|
||||
#основной документ здесь - станок. Нужно поместить файл домена в папку с оборудованием
|
||||
|
||||
def domain_export(tool, pddl_entities_list):
|
||||
|
||||
file_path = endmill.rsplit("/", 1)[0] + '/domain.pddl'
|
||||
|
||||
filename = 'fabrication'
|
||||
|
||||
|
||||
with open(file_path, 'w') as f:
|
||||
f.write('(define (domain '+ filename +')\n \n')
|
||||
f.write('(:requirements :strips :typing :fluents :durative-actions)\n')
|
||||
|
||||
# Типы обьектов
|
||||
#выбираем словари, которые соответствуют типу types
|
||||
types_list = [d for d in pddl_entities_list if d.get("Type") == 'Types']
|
||||
|
||||
|
||||
f.write('(:types \n')
|
||||
|
||||
for obj in types_list:
|
||||
for type in obj['Types']:
|
||||
f.write(' ' + str(type) + ' \n')
|
||||
f.write(')\n')
|
||||
|
||||
|
||||
|
||||
# предикаты
|
||||
#выбираем словари, соответствующие предикатам
|
||||
f.write(' (:predicates\n')
|
||||
predicates_list = [d for d in pddl_entities_list if d.get("Type") == 'Predicate']
|
||||
|
||||
for obj in predicates_list:
|
||||
|
||||
f.write(' ('+ obj['Label'])
|
||||
for params in obj['Parameters']:
|
||||
f.write(' ' + params)
|
||||
f.write(')\n')
|
||||
f.write(' )\n')
|
||||
|
||||
# функции
|
||||
f.write(' (:functions\n')
|
||||
f.write(' )\n')
|
||||
|
||||
#действия:
|
||||
#выбираем словари, соответствующие действиям
|
||||
|
||||
actions_list = [d for d in pddl_entities_list if d.get("Type") == 'Action']
|
||||
|
||||
for obj in actions_list:
|
||||
|
||||
|
||||
f.write('(:action ' + obj['Label'] + '\n')
|
||||
f.write(' :parameters (')
|
||||
for params in obj['Parameters']:
|
||||
f.write('' + params + ' ')
|
||||
f.write(')\n')
|
||||
f.write(' :condition (and \n')
|
||||
|
||||
for condition in obj['Conditions']:
|
||||
f.write(' (' + condition + ') \n')
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
f.write(' :effect (and \n')
|
||||
|
||||
for effect in obj['Effects']:
|
||||
f.write(' (' + effect + ') \n')
|
||||
|
||||
f.write(')\n')
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
# длительные действия:
|
||||
#выбираем словари, соответствующие действиям
|
||||
|
||||
durative_actions_list = [d for d in pddl_entities_list if d.get("Type") == 'DurativeAction']
|
||||
|
||||
for obj in durative_actions_list:
|
||||
f.write('(:durative-action ' + obj['Label'] + '\n')
|
||||
f.write(' :parameters (')
|
||||
for params in obj['Parameters']:
|
||||
f.write(' ' + params )
|
||||
f.write(' )\n')
|
||||
f.write(' :duration ( = ?duration '+ str(time_in_sec(str(obj['Duration']))) +')\n')
|
||||
f.write(' :condition (and \n')
|
||||
|
||||
for condition in obj['Conditions']:
|
||||
f.write(' (' + condition + ') \n')
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
f.write(' :effect (and \n')
|
||||
|
||||
for effect in obj['Effects']:
|
||||
f.write(' (' + effect + ') \n')
|
||||
f.write(')\n')
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
|
||||
|
||||
f.write(' )\n')
|
||||
|
||||
tool_non_operations = []
|
||||
|
||||
|
||||
operations_data = operationsInfoCollecting(part)
|
||||
|
||||
|
||||
|
||||
pddl_actions = operationGenerator(tool, operations_data)
|
||||
|
||||
pddl_non_actions = collectingNonActions(tool)
|
||||
|
||||
pddl_entities_list = pddl_non_actions + pddl_actions
|
||||
|
||||
domain_export(tool, pddl_entities_list)
|
||||
|
||||
def problem_export(partlist):
|
||||
pass
|
||||
|
||||
|
||||
def predicate_generator():
|
||||
#как определять операции? по тегам, означающим действие и/или подготовку
|
||||
#нужно выделить порядок
|
||||
#как выделить порядок операций для детали?
|
||||
#операции импортируются по порядку сверху вниз.
|
||||
#можно создавать переходы по следующим признакам:
|
||||
#операция создает условие "operation_name_done", следующая операция требует условия "operation_name_n-1_done"
|
||||
#операция при начале делает условие "not operation_name_done"
|
||||
#если операция требует изменения инструмента, то должна выполняться операция по замене инструмента
|
||||
#
|
||||
for n in range(pddl_actions):
|
||||
if pddl_actions[n+1]['Tool'] == pddl_actions[n]['Tool']:
|
||||
#замена инструмента не требуется
|
||||
pddl_actions[n+1]['Conditions'].append(pddl_actions[n]["Label"] + '_done')
|
||||
|
||||
else:
|
||||
#включается операция по замене инструмента
|
||||
pddl_actions[n+1]['Conditions'].append( pddl_actions[n]["Label"] + '_done')
|
||||
pddl_actions[n+1]['Conditions'].append('change_' + pddl_actions[n]['Tool'] + 'to' + pddl_actions[n+1]['Tool'] + '_done' ) #сюда нужно воткнуть операцию по замене
|
||||
#нужно создать операцию, которая произведет эту замену.
|
||||
|
||||
aux_pddl_actions = []
|
||||
|
||||
def auxActionsGenerator(pddl_action_1, pddl_action_2):
|
||||
aux_pddl_actions.append({{'Label': 'change_tool' + pddl_action_1['Tool'] + 'to' + pddl_action_2['Tool'],
|
||||
'Partname': part_operation['Part_label'],
|
||||
'Conditions': tool_operation['Conditions'],
|
||||
'Duration': part_operation['Duration'],
|
||||
'Effects': tool_operation['Effects'],
|
||||
'Parameters': tool_operation['Parameters'],
|
||||
'Type': tool_operation['Type'],
|
||||
'Tool': tool_operation['Label']
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
#генерируется pddl-домен относительно нормально
|
||||
#нужно увязать последовательность операций с пред и пост условиями, создавая предикаты автоматически
|
||||
#problem можно создавать на основе операции сборки. Генератор последовательности сборки выдает основную информацию
|
||||
#для сборки нужно, чтобы все операции подготовки детали были выполнены
|
||||
|
||||
|
||||
|
||||
# какие могут быть ситуации?
|
||||
|
||||
# ряд последовательных операций
|
||||
|
||||
# если станок один:
|
||||
# если операции на одном виде инструментов:
|
||||
# то операция1 имеет пред "операция0 готова"
|
||||
# создает пред "операция1 готова"
|
||||
# операция2 имеет пред "операция1 готова"
|
||||
# создает пред "операция2 готова"
|
||||
# если операция на разных видах инструментов:
|
||||
# то операция1 имеет пред "операция0 готова"
|
||||
# создает пред "операция1 готова"
|
||||
# создает пред "смена инструмента не готова"
|
||||
# операция смены имеет пред "операция1 готова"
|
||||
# имеет пред "смена инструмента не готова"
|
||||
# создает пред "смена инструмента готова"
|
||||
# операция2 имеет пред "операция1 готова"
|
||||
# имеет пред "смена инструмента готова"
|
||||
|
||||
# остальное аналогично
|
BIN
cg/freecad/Frames/pddl/test_asm.FCStd
Normal file
BIN
cg/freecad/Frames/pddl/test_asm.FCStd
Normal file
Binary file not shown.
82
cg/freecad/Frames/pddldomain.pddl
Normal file
82
cg/freecad/Frames/pddldomain.pddl
Normal file
|
@ -0,0 +1,82 @@
|
|||
(define (domain fabrication)
|
||||
|
||||
(:requirements :strips :typing :fluents :durative-actions)
|
||||
(:types
|
||||
['endmill workspace - zone', 'part', 'arm', 'assembly', 'human', '']
|
||||
)
|
||||
(:predicates
|
||||
(endmill_is_ready endmill task observer)
|
||||
(part_at [?p - part ?z - zone])
|
||||
(endmill_ready ?p - printer)
|
||||
(endmill_checked ?p - printer)
|
||||
(endmill_at_work ?p - printer)
|
||||
(assembly_order ?prev ?next - assembly)
|
||||
(assembled ?whole - assembly ?z - zone)
|
||||
(observer_free ?h - human)
|
||||
)
|
||||
(:functions
|
||||
)
|
||||
(:action predpreparing
|
||||
:parameters ()
|
||||
:condition (and
|
||||
(not endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 00:02:37)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 00:02:50)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 00:01:18)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 00:02:37)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 00:02:50)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
(:durative-action PartDesignExample_TC: Default Tool
|
||||
:parameters ( )
|
||||
:duration ( = ?duration 00:01:18)
|
||||
:condition (and
|
||||
(endmill_is_ready)
|
||||
)
|
||||
:effect (and
|
||||
)
|
||||
)
|
||||
)
|
52
geometric_feasibility_predicate/out/adjacency_matrix.json
Normal file
52
geometric_feasibility_predicate/out/adjacency_matrix.json
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"allParts": [
|
||||
"Бутылочный домкрат 4т_Гильза",
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Шток насоса",
|
||||
"Бутылочный домкрат 4т_Коромысло",
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Винт штока",
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
],
|
||||
"firstDetail": "Бутылочный домкрат 4т_Гильза",
|
||||
"matrix": {
|
||||
"Бутылочный домкрат 4т_Гильза": [
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Шток насоса",
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
],
|
||||
"Бутылочный домкрат 4т_Тяга": [
|
||||
"Бутылочный домкрат 4т_Гильза",
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Коромысло"
|
||||
],
|
||||
"Бутылочный домкрат 4т_Тяга001": [
|
||||
"Бутылочный домкрат 4т_Гильза",
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Коромысло"
|
||||
],
|
||||
"Бутылочный домкрат 4т_Шток насоса": [
|
||||
"Бутылочный домкрат 4т_Гильза",
|
||||
"Бутылочный домкрат 4т_Коромысло"
|
||||
],
|
||||
"Бутылочный домкрат 4т_Коромысло": [
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Шток насоса"
|
||||
],
|
||||
"Бутылочный домкрат 4т_Шток": [
|
||||
"Бутылочный домкрат 4т_Гильза",
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
],
|
||||
"Бутылочный домкрат 4т_Винт штока": [
|
||||
"Бутылочный домкрат 4т_Шток"
|
||||
],
|
||||
"Бутылочный домкрат 4т_Вентиль": [
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
]
|
||||
},
|
||||
"matrixError": null
|
||||
}
|
142
geometric_feasibility_predicate/out/assembly_sequence.json
Normal file
142
geometric_feasibility_predicate/out/assembly_sequence.json
Normal file
|
@ -0,0 +1,142 @@
|
|||
[
|
||||
[
|
||||
[
|
||||
"Бутылочный домкрат 4т_Вентиль",
|
||||
"Бутылочный домкрат 4т_Шток насоса",
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Коромысло",
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток насоса",
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Коромысло",
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Коромысло",
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток насоса"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Тяга",
|
||||
"Бутылочный домкрат 4т_Коромысло"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток насоса"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга001",
|
||||
"Бутылочный домкрат 4т_Коромысло"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток насоса"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга001"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток насоса"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток",
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Коромысло"
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"Бутылочный домкрат 4т_Гильза"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Тяга001"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток насоса"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Шток"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Вентиль"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Коромысло"
|
||||
],
|
||||
[
|
||||
"Бутылочный домкрат 4т_Винт штока"
|
||||
]
|
||||
]
|
||||
]
|
11
markup_workbench/README.md
Normal file
11
markup_workbench/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
Запуск фрикада с верстаком
|
||||
../../../AppImages/FreeCAD_0.20.2.AppImage main.py
|
||||
|
||||
Зависимости для env.json:
|
||||
|
||||
Путь до ассетов сборки - "aspPath":"/home/mark-voltov/Рабочий стол/out/",
|
||||
Имя используемого гриппера - "gripperName": "Gripper01"
|
||||
|
||||
решить задачу определения размеченныъ и неразмеченных деталей
|
||||
найти джсон со сборкой и сопоставить имена деталей с разметкой
|
||||
|
7
markup_workbench/env.json
Normal file
7
markup_workbench/env.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"aspPath":"/home/mark-voltov/Рабочий стол/out/",
|
||||
"gripperName": "Gripper01"
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -60,13 +60,32 @@ class SyncServer:
|
|||
def IsActive(self):
|
||||
return True
|
||||
|
||||
class TestButton:
|
||||
|
||||
httpURL = None
|
||||
def __init__(self, httpURL):
|
||||
self.httpURL = httpURL
|
||||
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': os.path.join(ICONPATH, "server_sync.svg"),
|
||||
'Accel': "Ctrl+A",
|
||||
'MenuText': QT_TRANSLATE_NOOP("My_Command", "My Command"),
|
||||
'ToolTip': QT_TRANSLATE_NOOP("My_Command", "Runs my command in the active document")}
|
||||
|
||||
def Activated(self):
|
||||
print(200)
|
||||
pass
|
||||
|
||||
def IsActive(self):
|
||||
return True
|
||||
|
||||
class StabilityWorkbench(Gui.Workbench):
|
||||
|
||||
MenuText = "stability workbench"
|
||||
ToolTip = "a simple template workbench"
|
||||
MenuText = "MarkUp"
|
||||
ToolTip = "a simple workbench for some markup"
|
||||
Icon = os.path.join(ICONPATH, "template_resource.svg")
|
||||
toolbox = ['AddStabilityZone', 'SyncServer']
|
||||
toolbox = ['AddStabilityZone', 'SyncServer',"TestButton"]
|
||||
httpURL = None
|
||||
def __init__(self,httpURL):
|
||||
self.httpURL = httpURL
|
||||
|
@ -79,6 +98,8 @@ class StabilityWorkbench(Gui.Workbench):
|
|||
Gui.addCommand('AddStabilityZone', AddStabilityZone())
|
||||
Gui.addCommand('SyncServer', SyncServer(
|
||||
self.httpURL))
|
||||
Gui.addCommand('TestButton', TestButton(
|
||||
self.httpURL))
|
||||
self.appendToolbar("Tools", self.toolbox)
|
||||
self.appendMenu("Tools", self.toolbox)
|
||||
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
183
markup_workbench/gui/resources/template_resource.svg
Normal file
183
markup_workbench/gui/resources/template_resource.svg
Normal file
|
@ -0,0 +1,183 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="64px" height="64px" id="svg2985" version="1.1" inkscape:version="0.48.5 r10040" sodipodi:docname="techdraw-clipplus.svg">
|
||||
<defs id="defs2987">
|
||||
<linearGradient id="linearGradient4256">
|
||||
<stop id="stop4258" offset="0" style="stop-color:#4e9a06;stop-opacity:1"/>
|
||||
<stop id="stop4260" offset="1" style="stop-color:#8ae234;stop-opacity:1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient4113">
|
||||
<stop id="stop4115" offset="0" style="stop-color:#cc0000;stop-opacity:1"/>
|
||||
<stop id="stop4117" offset="1" style="stop-color:#ef2929;stop-opacity:1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3883">
|
||||
<stop style="stop-color:#ffb400;stop-opacity:1;" offset="0" id="stop3885"/>
|
||||
<stop style="stop-color:#ffe900;stop-opacity:1;" offset="1" id="stop3887"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3793">
|
||||
<stop style="stop-color:#000f8a;stop-opacity:1;" offset="0" id="stop3795"/>
|
||||
<stop style="stop-color:#0066ff;stop-opacity:1;" offset="1" id="stop3797"/>
|
||||
</linearGradient>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3793-2" id="linearGradient3799-8" x1="12.037806" y1="54.001419" x2="52.882648" y2="9.274148" gradientUnits="userSpaceOnUse"/>
|
||||
<linearGradient id="linearGradient3793-2">
|
||||
<stop style="stop-color:#000f8a;stop-opacity:1;" offset="0" id="stop3795-6"/>
|
||||
<stop style="stop-color:#0066ff;stop-opacity:1;" offset="1" id="stop3797-0"/>
|
||||
</linearGradient>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3883-6" id="linearGradient3889-4" x1="3" y1="31.671875" x2="59.25" y2="31.671875" gradientUnits="userSpaceOnUse" gradientTransform="translate(-1.2727273,-0.18181818)"/>
|
||||
<linearGradient id="linearGradient3883-6">
|
||||
<stop style="stop-color:#ffb400;stop-opacity:1;" offset="0" id="stop3885-4"/>
|
||||
<stop style="stop-color:#ffe900;stop-opacity:1;" offset="1" id="stop3887-5"/>
|
||||
</linearGradient>
|
||||
<radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.0526127,0,0,0.7540853,-19.699324,101.21241)" r="225.89062" fy="655.5625" fx="374.42188" cy="655.5625" cx="374.42188" id="radialGradient4475" xlink:href="#linearGradient3533" inkscape:collect="always"/>
|
||||
<radialGradient r="149.30214" fy="315.40961" fx="298.10294" cy="315.40961" cx="298.10294" gradientTransform="matrix(1.131046,0,0,0.5900932,-22.100471,489.57569)" gradientUnits="userSpaceOnUse" id="radialGradient4466" xlink:href="#linearGradient3364" inkscape:collect="always"/>
|
||||
<radialGradient r="149.30214" fy="315.40961" fx="298.10294" cy="315.40961" cx="298.10294" gradientTransform="matrix(1.131046,0,0,1.131204,-22.100471,282.3446)" gradientUnits="userSpaceOnUse" id="radialGradient4429" xlink:href="#linearGradient3364" inkscape:collect="always"/>
|
||||
<radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.2871291,0,0,0.588703,-103.70783,273.98098)" r="143.60872" fy="641.82562" fx="361.18896" cy="641.82562" cx="361.18896" id="radialGradient3539" xlink:href="#linearGradient3533" inkscape:collect="always"/>
|
||||
<radialGradient r="149.30214" fy="315.40961" fx="298.10294" cy="315.40961" cx="298.10294" gradientTransform="matrix(1.131046,0,0,1.131204,-22.100471,-17.655402)" gradientUnits="userSpaceOnUse" id="radialGradient3979" xlink:href="#linearGradient3364" inkscape:collect="always"/>
|
||||
<radialGradient r="141.81195" fy="249.47238" fx="317.86237" cy="249.47238" cx="317.86237" spreadMethod="reflect" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,218.04449,-49.879453)" gradientUnits="userSpaceOnUse" id="radialGradient3976" xlink:href="#linearGradient6692" inkscape:collect="always"/>
|
||||
<radialGradient r="130.08176" fy="309.10764" fx="298.66852" cy="309.10764" cx="298.66852" gradientTransform="matrix(0.2436217,0.8776417,-1.1344403,0.3149057,586.4121,-25.658023)" gradientUnits="userSpaceOnUse" id="radialGradient3969" xlink:href="#linearGradient3351" inkscape:collect="always"/>
|
||||
<radialGradient r="149.30214" fy="315.40961" fx="298.10294" cy="315.40961" cx="298.10294" gradientTransform="matrix(1.131046,0,0,1.131204,-22.100471,-17.655402)" gradientUnits="userSpaceOnUse" id="radialGradient3813" xlink:href="#linearGradient3364" inkscape:collect="always"/>
|
||||
<radialGradient r="141.81195" fy="249.47238" fx="317.86237" cy="249.47238" cx="317.86237" spreadMethod="reflect" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,218.04449,-49.879453)" gradientUnits="userSpaceOnUse" id="radialGradient3732" xlink:href="#linearGradient6692" inkscape:collect="always"/>
|
||||
<radialGradient r="130.08176" fy="314.29395" fx="290.86432" cy="314.29395" cx="290.86432" gradientTransform="matrix(1.4674635,0,0,1.0734203,-127.41403,-8.614628)" gradientUnits="userSpaceOnUse" id="radialGradient3686" xlink:href="#linearGradient3351" inkscape:collect="always"/>
|
||||
<radialGradient r="130.08176" fy="314.29395" fx="290.86432" cy="314.29395" cx="290.86432" gradientTransform="matrix(1.4674635,0,0,1.0734203,-134.66628,-8.6146276)" gradientUnits="userSpaceOnUse" id="radialGradient3396" xlink:href="#linearGradient3351" inkscape:collect="always"/>
|
||||
<radialGradient r="141.81195" fy="249.47238" fx="317.86237" cy="249.47238" cx="317.86237" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,210.79224,-49.879453)" gradientUnits="userSpaceOnUse" id="radialGradient3394" xlink:href="#linearGradient6692" inkscape:collect="always"/>
|
||||
<radialGradient r="149.30214" fy="315.40961" fx="298.10294" cy="315.40961" cx="298.10294" gradientTransform="matrix(1.131046,0,0,1.131204,-29.352716,-17.655402)" gradientUnits="userSpaceOnUse" id="radialGradient3392" xlink:href="#linearGradient3364" inkscape:collect="always"/>
|
||||
<radialGradient r="179.50987" fy="365.75668" fx="318.06638" cy="365.75668" cx="318.06638" gradientTransform="matrix(1.0565445,0,0,0.5956187,-200.72763,179.91578)" gradientUnits="userSpaceOnUse" id="radialGradient3385" xlink:href="#linearGradient4328" inkscape:collect="always"/>
|
||||
<radialGradient r="179.38509" fy="244.68217" fx="333.362" cy="244.68217" cx="333.362" gradientTransform="matrix(1.0565445,0,0,0.5952981,-200.72763,124.1879)" gradientUnits="userSpaceOnUse" id="radialGradient3383" xlink:href="#linearGradient4328" inkscape:collect="always"/>
|
||||
<radialGradient r="179.50987" fy="365.75668" fx="318.06638" cy="365.75668" cx="318.06638" gradientTransform="matrix(1.0565445,0,0,0.5956187,-200.72763,179.91578)" gradientUnits="userSpaceOnUse" id="radialGradient3377" xlink:href="#linearGradient4328" inkscape:collect="always"/>
|
||||
<radialGradient r="179.38509" fy="244.68217" fx="333.362" cy="244.68217" cx="333.362" gradientTransform="matrix(1.0565445,0,0,0.5952981,-200.72763,124.1879)" gradientUnits="userSpaceOnUse" id="radialGradient3375" xlink:href="#linearGradient4328" inkscape:collect="always"/>
|
||||
<radialGradient r="141.81195" fy="249.47238" fx="317.86237" cy="249.47238" cx="317.86237" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,-0.1554987,-133.93797)" gradientUnits="userSpaceOnUse" id="radialGradient3373" xlink:href="#linearGradient6692" inkscape:collect="always"/>
|
||||
<radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.131046,0,0,1.131204,-29.352716,-17.655402)" r="149.30214" fy="315.40961" fx="298.10294" cy="315.40961" cx="298.10294" id="radialGradient3361" xlink:href="#linearGradient3364" inkscape:collect="always"/>
|
||||
<radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.4674635,0,0,1.0734203,-134.66628,-8.6146276)" r="130.08176" fy="314.29395" fx="290.86432" cy="314.29395" cx="290.86432" id="radialGradient3357" xlink:href="#linearGradient3351" inkscape:collect="always"/>
|
||||
<radialGradient r="179.50987" fy="365.75668" fx="318.06638" cy="365.75668" cx="318.06638" gradientTransform="matrix(1.0565445,0,0,0.5956187,10.2201,263.97431)" gradientUnits="userSpaceOnUse" id="radialGradient2337" xlink:href="#linearGradient4328" inkscape:collect="always"/>
|
||||
<linearGradient id="linearGradient4328">
|
||||
<stop id="stop4330" offset="0" style="stop-color:#398fe5;stop-opacity:1;"/>
|
||||
<stop id="stop4332" offset="1" style="stop-color:#0066cc;stop-opacity:1"/>
|
||||
</linearGradient>
|
||||
<radialGradient r="179.38509" fy="244.68217" fx="333.362" cy="244.68217" cx="333.362" gradientTransform="matrix(1.0565445,0,0,0.5952981,10.2201,208.24643)" gradientUnits="userSpaceOnUse" id="radialGradient2335" xlink:href="#linearGradient4328" inkscape:collect="always"/>
|
||||
<radialGradient r="141.81195" fy="249.47238" fx="317.86237" cy="249.47238" cx="317.86237" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,210.79224,-49.879453)" gradientUnits="userSpaceOnUse" id="radialGradient2331" xlink:href="#linearGradient6692" inkscape:collect="always"/>
|
||||
<linearGradient id="linearGradient6692">
|
||||
<stop id="stop6694" offset="0" style="stop-color:#9bffbd;stop-opacity:1;"/>
|
||||
<stop style="stop-color:#689e33;stop-opacity:1;" offset="1" id="stop6700"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3364">
|
||||
<stop id="stop3366" offset="0" style="stop-color:#79a7fc;stop-opacity:1;"/>
|
||||
<stop id="stop3368" offset="1" style="stop-color:#1d3340;stop-opacity:1;"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3351">
|
||||
<stop id="stop3353" offset="0" style="stop-color:#ffffff;stop-opacity:0.86734694;"/>
|
||||
<stop id="stop3355" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
|
||||
</linearGradient>
|
||||
<radialGradient r="19.966738" fy="578.88593" fx="82.9272" cy="578.88593" cx="82.9272" gradientTransform="matrix(7.6237907,4.4015976,-5.0675166,8.7771962,2328.4492,-5270.6109)" gradientUnits="userSpaceOnUse" id="radialGradient2333" xlink:href="#linearGradient3364" inkscape:collect="always"/>
|
||||
<linearGradient id="linearGradient3615">
|
||||
<stop id="stop3619" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
|
||||
<stop style="stop-color:#398fe5;stop-opacity:1;" offset="1" id="stop3621"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3624">
|
||||
<stop style="stop-color:#398fe5;stop-opacity:1;" offset="0" id="stop3628"/>
|
||||
<stop id="stop3630" offset="1" style="stop-color:#acc1d5;stop-opacity:1;"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3533">
|
||||
<stop id="stop3535" offset="0" style="stop-color:#3a3a3a;stop-opacity:1;"/>
|
||||
<stop id="stop3537" offset="1" style="stop-color:#ffffff;stop-opacity:1;"/>
|
||||
</linearGradient>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3364" id="radialGradient3258" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.131046,0,0,1.131204,-22.100471,-17.655402)" cx="298.10294" cy="315.40961" fx="298.10294" fy="315.40961" r="149.30214"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient6692" id="radialGradient3260" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,218.04449,-49.879453)" spreadMethod="reflect" cx="317.86237" cy="249.47238" fx="317.86237" fy="249.47238" r="141.81195"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3351" id="radialGradient3262" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.2436217,0.8776417,-1.1344403,0.3149057,586.4121,-25.658023)" cx="298.66852" cy="309.10764" fx="298.66852" fy="309.10764" r="130.08176"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3364" id="radialGradient3268" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.131046,0,0,1.131204,-22.100471,-17.655402)" cx="298.10294" cy="315.40961" fx="298.10294" fy="315.40961" r="149.30214"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient6692" id="radialGradient3270" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,218.04449,-49.879453)" spreadMethod="reflect" cx="317.86237" cy="249.47238" fx="317.86237" fy="249.47238" r="141.81195"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3351" id="radialGradient3272" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.2436217,0.8776417,-1.1344403,0.3149057,586.4121,-25.658023)" cx="298.66852" cy="309.10764" fx="298.66852" fy="309.10764" r="130.08176"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3351" id="radialGradient3275" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.2436217,0.8776417,-1.1344403,0.3149057,23.62227,-368.49652)" cx="298.66852" cy="309.10764" fx="298.66852" fy="309.10764" r="130.08176"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient6692" id="radialGradient3278" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,-344.74534,-392.71795)" spreadMethod="reflect" cx="317.86237" cy="249.47238" fx="317.86237" fy="249.47238" r="141.81195"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3364" id="radialGradient3281" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.1174411,0,0,0.1174575,-18.224818,-25.892201)" cx="298.10294" cy="315.40961" fx="298.10294" fy="315.40961" r="149.30214"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient6692" id="radialGradient3284" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,-344.74534,-392.71795)" spreadMethod="reflect" cx="317.86237" cy="249.47238" fx="317.86237" fy="249.47238" r="141.81195"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient6692" id="radialGradient3287" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9225535,0.5499376,-0.6128212,1.0614374,-344.74534,-392.71795)" spreadMethod="reflect" cx="317.86237" cy="249.47238" fx="317.86237" fy="249.47238" r="141.81195"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient6692" id="radialGradient3290" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.09579247,0.05710226,-0.06363172,0.11021335,6.7104086,-29.238154)" spreadMethod="reflect" cx="317.86237" cy="249.47238" fx="317.86237" fy="249.47238" r="141.81195"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3364-1" id="radialGradient3281-8" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.1174411,0,0,0.1174575,-18.224818,-25.892201)" cx="298.10294" cy="315.40961" fx="298.10294" fy="315.40961" r="149.30214"/>
|
||||
<linearGradient id="linearGradient3364-1">
|
||||
<stop id="stop3366-0" offset="0" style="stop-color:#79a7fc;stop-opacity:1;"/>
|
||||
<stop id="stop3368-2" offset="1" style="stop-color:#1d3340;stop-opacity:1;"/>
|
||||
</linearGradient>
|
||||
<radialGradient r="149.30214" fy="315.40961" fx="298.10294" cy="315.40961" cx="298.10294" gradientTransform="matrix(0.1174411,0,0,0.1174575,-24.327872,-29.478297)" gradientUnits="userSpaceOnUse" id="radialGradient4075" xlink:href="#linearGradient3364-1" inkscape:collect="always"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3364-7" id="radialGradient3281-0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.1174411,0,0,0.1174575,-18.224818,-25.892201)" cx="298.10294" cy="315.40961" fx="298.10294" fy="315.40961" r="149.30214"/>
|
||||
<linearGradient id="linearGradient3364-7">
|
||||
<stop id="stop3366-6" offset="0" style="stop-color:#79a7fc;stop-opacity:1;"/>
|
||||
<stop id="stop3368-3" offset="1" style="stop-color:#1d3340;stop-opacity:1;"/>
|
||||
</linearGradient>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient3364" id="radialGradient4158" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.1174411,0,0,0.1174575,-18.224818,-25.892201)" cx="298.10294" cy="315.40961" fx="298.10294" fy="315.40961" r="149.30214"/>
|
||||
<radialGradient inkscape:collect="always" xlink:href="#linearGradient6692" id="radialGradient4160" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.09579247,0.05710226,-0.06363172,0.11021335,6.7104086,-29.238154)" spreadMethod="reflect" cx="317.86237" cy="249.47238" fx="317.86237" fy="249.47238" r="141.81195"/>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3866" id="linearGradient3872" x1="35" y1="53" x2="24" y2="9" gradientUnits="userSpaceOnUse"/>
|
||||
<linearGradient inkscape:collect="always" id="linearGradient3866">
|
||||
<stop style="stop-color:#d3d7cf;stop-opacity:1" offset="0" id="stop3868"/>
|
||||
<stop style="stop-color:#ffffff;stop-opacity:1" offset="1" id="stop3870"/>
|
||||
</linearGradient>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3874" id="linearGradient3880" x1="56" y1="47" x2="53" y2="39" gradientUnits="userSpaceOnUse"/>
|
||||
<linearGradient inkscape:collect="always" id="linearGradient3874">
|
||||
<stop style="stop-color:#555753;stop-opacity:1" offset="0" id="stop3876"/>
|
||||
<stop style="stop-color:#babdb6;stop-opacity:1" offset="1" id="stop3878"/>
|
||||
</linearGradient>
|
||||
<linearGradient y2="39" x2="53" y1="47" x1="56" gradientUnits="userSpaceOnUse" id="linearGradient3120" xlink:href="#linearGradient3874" inkscape:collect="always"/>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3836" id="linearGradient3850" x1="160.4444" y1="149.22015" x2="158.4444" y2="143.22015" gradientUnits="userSpaceOnUse"/>
|
||||
<linearGradient id="linearGradient3836">
|
||||
<stop style="stop-color:#3465a4;stop-opacity:1;" offset="0" id="stop3838"/>
|
||||
<stop style="stop-color:#729fcf;stop-opacity:1;" offset="1" id="stop3840"/>
|
||||
</linearGradient>
|
||||
<linearGradient gradientTransform="translate(-118.44439,-120.22016)" y2="143.22015" x2="158.4444" y1="149.22015" x1="160.4444" gradientUnits="userSpaceOnUse" id="linearGradient3167" xlink:href="#linearGradient4113" inkscape:collect="always"/>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3836-5" id="linearGradient3850-7" x1="164.4444" y1="161.22015" x2="154.4444" y2="131.22015" gradientUnits="userSpaceOnUse"/>
|
||||
<linearGradient id="linearGradient3836-5">
|
||||
<stop style="stop-color:#3465a4;stop-opacity:1;" offset="0" id="stop3838-3"/>
|
||||
<stop style="stop-color:#729fcf;stop-opacity:1;" offset="1" id="stop3840-5"/>
|
||||
</linearGradient>
|
||||
<linearGradient gradientTransform="translate(-119.44439,-118.22016)" y2="131.22015" x2="154.4444" y1="161.22015" x1="164.4444" gradientUnits="userSpaceOnUse" id="linearGradient3185" xlink:href="#linearGradient4256" inkscape:collect="always"/>
|
||||
</defs>
|
||||
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="13.359272" inkscape:cx="-0.08607535" inkscape:cy="34.022675" inkscape:current-layer="layer1" showgrid="true" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:window-width="1920" inkscape:window-height="1057" inkscape:window-x="1912" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:snap-bbox="true" inkscape:snap-nodes="false" inkscape:snap-global="true">
|
||||
<inkscape:grid type="xygrid" id="grid3147" empspacing="2" visible="true" enabled="true" snapvisiblegridlinesonly="true" units="px" spacingx="1px" spacingy="1px"/>
|
||||
</sodipodi:namedview>
|
||||
<metadata id="metadata2990">
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
<dc:title/>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>[WandererFan]</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:title>techdraw-clipplus</dc:title>
|
||||
<dc:date>2016-01-14</dc:date>
|
||||
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier>FreeCAD/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-clipplus.svg</dc:identifier>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD LGPL2+</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>[agryson] Alexander Gryson</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer">
|
||||
<g id="layer2" inkscape:label="layer2" transform="translate(-562.78983,-342.8385)"/>
|
||||
<g id="g4153-1" style="fill:#d3d7cf">
|
||||
<path d="M 3,9 3,53 51,53 61,43 61,9 z" id="rect3005-7" style="color:#000000;fill:url(#linearGradient3872);fill-opacity:1;fill-rule:evenodd;stroke:#3f3f3f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc"/>
|
||||
<path style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 5,51 0,-40 54,0 0,32 -6,8 z" id="path3096" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc"/>
|
||||
<path d="m 61,43 c 0,-1 -4,-4 -8,-4 0,0 2,10 -2,14 z" id="path3778-4" style="color:#000000;fill:url(#linearGradient3120);fill-opacity:1;fill-rule:evenodd;stroke:#3f3f3f;stroke-width:1.95121026;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc"/>
|
||||
</g>
|
||||
<rect style="fill:#babdb6;stroke:#172a04;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:4, 8;stroke-dashoffset:0" id="rect4138-7" width="30.10585" height="26" x="10.895793" y="17"/>
|
||||
<path style="fill:none;stroke:#babdb6;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 53.085507,48.1244 6.658435,-6.453618" id="path3125" inkscape:connector-curvature="0" sodipodi:nodetypes="cc"/>
|
||||
<path d="m 61,43 c 0,-1 -4,-4 -8,-4 0,0 2,10 -2,14 z" id="path3778-3" style="color:#000000;fill:none;stroke:#3f3f3f;stroke-width:1.95121026;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc"/>
|
||||
<rect style="fill:none;stroke:#73d216;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:4, 8;stroke-dashoffset:0" id="rect4138-7-6" width="30.10585" height="26" x="10.89415" y="17"/>
|
||||
<path style="color:#000000;fill:url(#linearGradient3185);fill-opacity:1;fill-rule:evenodd;stroke:#172a04;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="m 35,13 0,10 -10,0 0,10 10,0 0,10 10,0 0,-10 10,0 0,-10 -10,0 0,-10 z" id="rect3558" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccccc"/>
|
||||
<path style="fill:none;stroke:#8ae234;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 27,25 10,0 0,-10 6,0 0,10 10,0 0,6 -10,0 0,10 -6,0 0,-10 -10,0 z" id="path3826" inkscape:connector-curvature="0"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 24 KiB |
30
markup_workbench/main.py
Normal file
30
markup_workbench/main.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import os
|
||||
import FreeCADGui as Gui
|
||||
import FreeCAD as App
|
||||
from gui.init_gui import StabilityWorkbench
|
||||
import json
|
||||
|
||||
|
||||
def importObjAtPath(path: str):
|
||||
import importOBJ
|
||||
importOBJ.insert(u"" + path, App.ActiveDocument.Label)
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def getFullPathObj(assemblyFolder: str, name: str):
|
||||
return assemblyFolder + 'sdf/meshes/' + name + '.obj'
|
||||
|
||||
|
||||
def main():
|
||||
App.newDocument()
|
||||
#TODO(Mark): 1. Добавить парсер файлов пути генерации. Нужно определить неразмеченные детали и импортировать объекты, которые соответствуют неразмеченным деталям
|
||||
#2. Добавить процедуру экспорта информации о разметке
|
||||
#3.
|
||||
Gui.SendMsgToActiveView("ViewSelection")
|
||||
|
||||
Gui.addWorkbench(StabilityWorkbench(''))
|
||||
Gui.activateWorkbench("StabilityWorkbench")
|
||||
|
||||
|
||||
main()
|
|
@ -4,8 +4,7 @@ from src.model.asm4_structure import Asm4Structure
|
|||
|
||||
from src.usecases.assembly_to_pddl_use_case import AssemblyToPddlUseCase
|
||||
|
||||
|
||||
# python3 main.py --stepStructurePath /Users/idontsudo/robo/step-structure.json --outPath /Users/idontsudo/robo/pddl/out/
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
|
|
79
sequence_generation/Init.py
Normal file
79
sequence_generation/Init.py
Normal file
|
@ -0,0 +1,79 @@
|
|||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
FreeCADGui.addCommand(, my_function1)
|
||||
|
||||
|
||||
|
||||
class MyWorkbenchGui:
|
||||
def Initialize(self):
|
||||
# Словарь с именами функций и путями к иконкам
|
||||
commands_dict = {
|
||||
"MyCommand1": (my_function1, "Path/to/icon1.svg"),
|
||||
"MyCommand2": (my_function2, "Path/to/icon2.svg")
|
||||
}
|
||||
|
||||
# Регистрация команд и иконок
|
||||
register_commands(commands_dict)
|
||||
|
||||
# Создание панели инструментов и добавление команд с иконками
|
||||
self.appendToolbar("My Tools", [("MyCommand1", "MyCommand1_icon"), ("MyCommand2", "MyCommand2_icon")])
|
||||
|
||||
def appendToolbar(self, toolbar_name, commands):
|
||||
toolbar = FreeCADGui.ToolBar(toolbar_name)
|
||||
for cmd, icon in commands:
|
||||
toolbar.appendCommand(cmd, icon)
|
||||
|
||||
|
||||
class MyWorkbench:
|
||||
def __init__(self):
|
||||
self.__class__.Icon = FreeCAD.getHomePath() + "Path\\to\\icon.svg"
|
||||
self.__class__.MenuText = "Assembly Structure Analysis"
|
||||
self.__class__.ToolTip = "Workbench made for structure analysis and assembly planning"
|
||||
|
||||
def GetClassName(self):
|
||||
return "Gui::AsmSAWorkbench"
|
||||
|
||||
def Initialize(self):
|
||||
# Create toolbar
|
||||
self.appendToolbar("Preprocessing", ["Check Model", "Constraints Autogeneration", "Constraints Editing"])
|
||||
self.appendToolbar("Analysis", ["Generate AdjMatrix", "Generate Relationship Matrix", "Clusterisation", "StepByStepClusterisation"])
|
||||
self.appendToolbar("AssemblySequence", ["Generate Assembly Sequences", "Decomposition Step" ])
|
||||
|
||||
# Create menu
|
||||
# self.appendMenu("My Menu", ["MySubMenu1", "MySubMenu2"])
|
||||
|
||||
def Activated(self):
|
||||
# Code to run when the workbench is activated
|
||||
pass
|
||||
|
||||
def Deactivated(self):
|
||||
# Code to run when the workbench is deactivated
|
||||
pass
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': self.__class__.Icon, 'MenuText': self.__class__.MenuText, 'ToolTip': self.__class__.ToolTip}
|
||||
|
||||
def appendToolbar(self, toolbar_name, commands):
|
||||
toolbar = FreeCADGui.ToolBar(toolbar_name)
|
||||
for cmd in commands:
|
||||
toolbar.appendCommand(cmd)
|
||||
|
||||
def appendMenu(self, menu_name, commands):
|
||||
menu = FreeCADGui.Menu(menu_name)
|
||||
for cmd in commands:
|
||||
menu.appendCommand(cmd)
|
||||
|
||||
# Create instance of the workbench
|
||||
my_workbench = MyWorkbench()
|
||||
|
||||
# Register the workbench with FreeCAD
|
||||
FreeCADGui.addWorkbench(my_workbench)
|
45
sequence_generation/InitGui.py
Normal file
45
sequence_generation/InitGui.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
def register_commands(commands_dict):
|
||||
for cmd_name, (func, icon_path) in commands_dict.items():
|
||||
FreeCADGui.addCommand(cmd_name, func)
|
||||
FreeCADGui.addIcon(cmd_name + "_icon", icon_path)
|
||||
|
||||
class MyWorkbenchGui:
|
||||
def Initialize(self):
|
||||
pass
|
||||
|
||||
def InitGui(self):
|
||||
# Словарь с именами функций и путями к иконкам
|
||||
commands_dict = {
|
||||
'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")
|
||||
|
||||
}
|
||||
|
||||
# Регистрация команд и иконок
|
||||
register_commands(commands_dict)
|
||||
|
||||
# Создание панели инструментов и добавление команд с иконками
|
||||
self.appendToolbar("Preprocessing", ["Check Model", "Constraints Autogeneration", "Constraints Editing"])
|
||||
self.appendToolbar("Analysis", ["Generate AdjMatrix", "Generate Relationship Matrix", "Clusterisation", "StepByStepClusterisation"])
|
||||
self.appendToolbar("AssemblySequence", ["Generate Assembly Sequences", "Decomposition Step" ])
|
||||
|
||||
def appendToolbar(self, toolbar_name, commands):
|
||||
toolbar = FreeCADGui.ToolBar(toolbar_name)
|
||||
for cmd, icon in commands:
|
||||
toolbar.appendCommand(cmd, icon)
|
||||
|
||||
# Создание экземпляра верстака GUI
|
||||
my_workbench_gui = MyWorkbenchGui()
|
||||
|
||||
# Регистрация верстака
|
||||
FreeCADGui.addWorkbench(my_workbench_gui)
|
109
sequence_generation/Main.py
Normal file
109
sequence_generation/Main.py
Normal file
|
@ -0,0 +1,109 @@
|
|||
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()
|
0
sequence_generation/usecases/__init__.py
Normal file
0
sequence_generation/usecases/__init__.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
from helpers.either import Either, Left, Right
|
||||
from models.adjacency_matrix_model import (
|
||||
AdjacencyMatrixModel,
|
||||
)
|
||||
from models.error_string_model import ErrorStringModel
|
||||
from repository.freecad_repository import (
|
||||
FreeCadRepository,
|
||||
)
|
||||
from usecases.get_first_detail_use_case import (
|
||||
GetFirstDetailUseCase,
|
||||
)
|
||||
|
||||
|
||||
class CheckObjectHasTouchesUseCase:
|
||||
"""Check touches between objects and returns matrix
|
||||
|
||||
Returns:
|
||||
dict: adjacency matrix
|
||||
"""
|
||||
|
||||
freeCadRepository = FreeCadRepository()
|
||||
|
||||
def call(self, solidBodyPadding: float) -> Either:
|
||||
try:
|
||||
errorResult = []
|
||||
matrix = {}
|
||||
for part in self.freeCadRepository.getAllSolids():
|
||||
matrix[part.Label] = []
|
||||
touches = FreeCadRepository().objectHasTouches(
|
||||
part=part, solidBodyPadding=solidBodyPadding
|
||||
)
|
||||
matrix[part.Label].extend(touches)
|
||||
if errorResult.__len__() == 0:
|
||||
return Left(
|
||||
AdjacencyMatrixModel(
|
||||
all_parts=self.freeCadRepository.getAllLabelsSolids(),
|
||||
first_detail=GetFirstDetailUseCase().call(),
|
||||
matrix=matrix,
|
||||
)
|
||||
)
|
||||
else:
|
||||
return Right(
|
||||
ErrorStringModel(
|
||||
error="Solids bodies have no recounts: " + ",".join(errorResult)
|
||||
)
|
||||
)
|
||||
except Exception as error:
|
||||
print(error)
|
||||
print("CheckObjectHasTouchesUseCase error")
|
||||
return Right(ErrorStringModel(error="CheckObjectHasTouchesUseCase error"))
|
11
sequence_generation/usecases/check_sequence_use_case.py
Normal file
11
sequence_generation/usecases/check_sequence_use_case.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from extensions.list import CoreList
|
||||
|
||||
class CheckSequenceUsecase(list):
|
||||
def isCorrectByParts(self, checkList) -> bool:
|
||||
parts = self[len(self) - 1]
|
||||
for part in parts:
|
||||
part = str(part)
|
||||
part = part[1:-1]
|
||||
|
||||
return CoreList(self).equal(checkList)
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
import os
|
||||
import json
|
||||
import networkx as nx
|
||||
from repository.file_system_repository import FileSystemRepository
|
||||
|
||||
|
||||
class GraphProcessor:
|
||||
file_path: str
|
||||
graph = None
|
||||
|
||||
def __init__(self, file_path: str):
|
||||
self.file_path = file_path
|
||||
self.graph = self.load_graph_from_json()
|
||||
|
||||
def load_graph_from_json(self):
|
||||
with open(self.file_path, "r") as file:
|
||||
data = json.load(file)
|
||||
|
||||
G = nx.Graph()
|
||||
|
||||
if "matrix" in data:
|
||||
matrix = data["matrix"]
|
||||
for part1, neighbors in matrix.items():
|
||||
for neighbor in neighbors:
|
||||
G.add_edge(part1, neighbor)
|
||||
|
||||
return G
|
||||
|
||||
|
||||
class EdgeBetweennessClustering:
|
||||
def __init__(self, graph):
|
||||
self.graph = graph.copy()
|
||||
self.clusters = []
|
||||
|
||||
def cluster(self):
|
||||
while self.graph.number_of_edges() > 0:
|
||||
edge_betweenness = nx.edge_betweenness_centrality(self.graph)
|
||||
max_betweenness_edge = max(edge_betweenness, key=edge_betweenness.get)
|
||||
|
||||
# Removing the edge with the highest centrality
|
||||
self.graph.remove_edge(*max_betweenness_edge)
|
||||
|
||||
# Formation of clusters after edge removal
|
||||
components = list(nx.connected_components(self.graph))
|
||||
if components not in self.clusters:
|
||||
self.clusters.append(components)
|
||||
|
||||
def get_clusters(self):
|
||||
return self.clusters
|
||||
|
||||
|
||||
def clusterisationSequence(file_path):
|
||||
#outFolder = os.path.dirname(__file__) + "/out/"
|
||||
#file_path = outFolder + 'adjacency_matrix.json'
|
||||
graph_processor = GraphProcessor(file_path + "adjacency_matrix.json")
|
||||
G = graph_processor.load_graph_from_json()
|
||||
ebc = EdgeBetweennessClustering(G)
|
||||
ebc.cluster()
|
||||
clusters = ebc.get_clusters()
|
||||
|
||||
|
||||
|
||||
for i in range(len(clusters)):
|
||||
for j in range(len(clusters[i])):
|
||||
clusters[i][j] = list(clusters[i][j])
|
||||
|
||||
#print(clusters)
|
||||
FileSystemRepository.writeFile(json.dumps(clusters, ensure_ascii=False, indent=2), file_path, "assembly_sequence.json")
|
||||
return clusters
|
|
@ -0,0 +1,16 @@
|
|||
class ClearWorkSpaceDocumentUseCase(object):
|
||||
"""Clear of the workspace
|
||||
|
||||
Args:
|
||||
object : active CAD-model
|
||||
"""
|
||||
|
||||
def call(self, detailSquares):
|
||||
import FreeCAD as App
|
||||
|
||||
for key in detailSquares:
|
||||
for renderPrimitive in detailSquares[key]:
|
||||
primitivePart = App.ActiveDocument.getObjectsByLabel(
|
||||
renderPrimitive.cadLabel
|
||||
)[0]
|
||||
App.ActiveDocument.removeObject(primitivePart.Name)
|
|
@ -0,0 +1,66 @@
|
|||
import os
|
||||
import json
|
||||
import networkx as nx
|
||||
from repository.file_system_repository import FileSystemRepository
|
||||
|
||||
|
||||
class GraphProcessor:
|
||||
file_path: str
|
||||
graph = None
|
||||
|
||||
def __init__(self, file_path: str):
|
||||
self.file_path = file_path
|
||||
self.graph = self.load_graph_from_json()
|
||||
|
||||
def load_graph_from_json(self):
|
||||
with open(self.file_path, "r") as file:
|
||||
data = json.load(file)
|
||||
|
||||
G = nx.Graph()
|
||||
|
||||
if "matrix" in data:
|
||||
matrix = data["matrix"]
|
||||
for part1, neighbors in matrix.items():
|
||||
for neighbor in neighbors:
|
||||
G.add_edge(part1, neighbor)
|
||||
|
||||
return G
|
||||
|
||||
|
||||
class EdgeBetweensClustering:
|
||||
def __init__(self, graph):
|
||||
self.graph = graph.copy()
|
||||
self.clusters = []
|
||||
|
||||
def cluster(self):
|
||||
while self.graph.number_of_edges() > 0:
|
||||
edge_betweens = nx.edge_betweenness_centrality(self.graph)
|
||||
max_betweens_edge = max(edge_betweens, key=edge_betweens.get)
|
||||
self.graph.remove_edge(*max_betweens_edge)
|
||||
components = list(nx.connected_components(self.graph))
|
||||
if components not in self.clusters:
|
||||
self.clusters.append(components)
|
||||
return []
|
||||
|
||||
def get_clusters(self):
|
||||
return self.clusters
|
||||
|
||||
|
||||
class ClusterisationSequenceUseCase:
|
||||
def call(self, file_path: str):
|
||||
graph_processor = GraphProcessor(file_path + "adjacency_matrix.json")
|
||||
G = graph_processor.load_graph_from_json()
|
||||
ebc = EdgeBetweensClustering(G)
|
||||
ebc.cluster()
|
||||
clusters = ebc.get_clusters()
|
||||
|
||||
for i in range(len(clusters)):
|
||||
for j in range(len(clusters[i])):
|
||||
clusters[i][j] = list(clusters[i][j])
|
||||
|
||||
FileSystemRepository.writeFile(
|
||||
json.dumps(clusters, ensure_ascii=False, indent=2),
|
||||
file_path,
|
||||
"assembly_sequence.json",
|
||||
)
|
||||
return clusters
|
12
sequence_generation/usecases/env_reader_use_case.py
Normal file
12
sequence_generation/usecases/env_reader_use_case.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from repository.file_system_repository import FileSystemRepository
|
||||
from helpers.either import Either, Left, Right
|
||||
from models.env_model import EnvModel
|
||||
|
||||
|
||||
class EnvReaderUseCase:
|
||||
def call() -> Either:
|
||||
try:
|
||||
return Left(EnvModel.from_dict(FileSystemRepository.readJSON("env.json")))
|
||||
except:
|
||||
print("env reader error")
|
||||
return Right(None)
|
6
sequence_generation/usecases/exit_freecad_use_case.py
Normal file
6
sequence_generation/usecases/exit_freecad_use_case.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from repository.freecad_repository import FreeCadRepository
|
||||
|
||||
|
||||
class ExitFreeCadUseCase:
|
||||
def call():
|
||||
FreeCadRepository().closeIfOpenDocument()
|
|
@ -0,0 +1,13 @@
|
|||
from repository.freecad_repository import (
|
||||
FreeCadRepository,
|
||||
)
|
||||
|
||||
|
||||
class GetAllPartsLabelsUseCase:
|
||||
"""Get all parts label in assembly"""
|
||||
|
||||
def call(self):
|
||||
parts = []
|
||||
for part in FreeCadRepository().getAllSolids():
|
||||
parts.append(part.Label)
|
||||
return parts
|
|
@ -0,0 +1,44 @@
|
|||
from typing import List, Dict
|
||||
|
||||
|
||||
def isUnique(array, element):
|
||||
for i in array:
|
||||
if i == element:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class GetCollisionAtPrimitiveUseCase(object):
|
||||
"""Get collisions between primitives
|
||||
|
||||
Args:
|
||||
object: cad-model
|
||||
|
||||
Returns:
|
||||
dict: collision matrix
|
||||
"""
|
||||
|
||||
# Получение колизий примитивов
|
||||
def call(self, freeCadMetaModels, detailSquares) -> Dict[str, List[str]]:
|
||||
import FreeCAD as App
|
||||
|
||||
matrix: Dict[str, List[str]] = {}
|
||||
for model in freeCadMetaModels:
|
||||
activePart = App.ActiveDocument.getObjectsByLabel(model.label)[0]
|
||||
for key in detailSquares:
|
||||
if model.label != key:
|
||||
for renderPrimitive in detailSquares[key]:
|
||||
primitivePart = App.ActiveDocument.getObjectsByLabel(
|
||||
renderPrimitive.cadLabel
|
||||
)[0]
|
||||
collisionResult: int = int(
|
||||
activePart.Shape.distToShape(primitivePart.Shape)[0]
|
||||
)
|
||||
if collisionResult == 0:
|
||||
if matrix.get(model.label) == None:
|
||||
matrix[model.label] = [renderPrimitive.label]
|
||||
else:
|
||||
if isUnique(matrix[model.label], renderPrimitive.label):
|
||||
matrix[model.label].append(renderPrimitive.label)
|
||||
return matrix
|
|
@ -0,0 +1,8 @@
|
|||
from repository.freecad_repository import FreeCadRepository
|
||||
|
||||
|
||||
class GetFirstDetailUseCase:
|
||||
"""Get label of first part in tree assembly"""
|
||||
|
||||
def call(self):
|
||||
return FreeCadRepository().getAllSolids()[0].Label
|
|
@ -0,0 +1,27 @@
|
|||
from models.mesh_geometry_coordinate_model import (
|
||||
MeshGeometryCoordinateModel,
|
||||
)
|
||||
|
||||
|
||||
class GetPartPrimitiveCoordinatesUseCase(object):
|
||||
"""Get positions of parts in assembly
|
||||
|
||||
Args:
|
||||
object : cad-model
|
||||
"""
|
||||
|
||||
def call(self, freeCadMetaModels):
|
||||
meshCoordinates: list[MeshGeometryCoordinateModel] = []
|
||||
for model in freeCadMetaModels:
|
||||
vertexesDetail = model.vertex
|
||||
labelDetail = model.label
|
||||
for coords in vertexesDetail:
|
||||
detailVertex = MeshGeometryCoordinateModel(
|
||||
coords.X,
|
||||
coords.Y,
|
||||
coords.Z,
|
||||
labelDetail,
|
||||
)
|
||||
meshCoordinates.append(detailVertex)
|
||||
|
||||
return meshCoordinates
|
17
sequence_generation/usecases/init_parts_parse_use_case.py
Normal file
17
sequence_generation/usecases/init_parts_parse_use_case.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from models.freecad_meta_model import FreeCadMetaModel
|
||||
from repository.freecad_repository import (
|
||||
FreeCadRepository,
|
||||
)
|
||||
|
||||
|
||||
class InitPartsParseUseCase:
|
||||
"""Initialisation of parsing geometry models info"""
|
||||
|
||||
def call(self):
|
||||
product_details = []
|
||||
for part in FreeCadRepository().getAllSolids():
|
||||
if part is not None:
|
||||
model = FreeCadMetaModel(part.Label, part.Shape.Vertexes)
|
||||
if model is not None:
|
||||
product_details.append(model)
|
||||
return product_details
|
|
@ -0,0 +1,20 @@
|
|||
class IntersectionComputedUseCase:
|
||||
def call(parts):
|
||||
import FreeCAD as App
|
||||
|
||||
App.activeDocument().addObject("Part::MultiCommon", "Common")
|
||||
App.activeDocument().Common.Shapes = [parts[0], parts[1]]
|
||||
App.activeDocument().getObject("Common").ViewObject.ShapeColor = getattr(
|
||||
parts[0].getLinkedObject(True).ViewObject,
|
||||
"ShapeColor",
|
||||
App.activeDocument().getObject("Common").ViewObject.ShapeColor,
|
||||
)
|
||||
App.activeDocument().getObject("Common").ViewObject.DisplayMode = getattr(
|
||||
parts[0].getLinkedObject(True).ViewObject,
|
||||
"DisplayMode",
|
||||
App.activeDocument().getObject("Common").ViewObject.DisplayMode,
|
||||
)
|
||||
App.ActiveDocument.recompute()
|
||||
area = App.activeDocument().getObject("Common").Shape.Area
|
||||
App.ActiveDocument.removeObject("Common")
|
||||
return area
|
|
@ -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",
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
from helpers.either import Either, Left, Right
|
||||
from models.error_string_model import ErrorStringModel
|
||||
from repository import freecad_repository
|
||||
|
||||
|
||||
class IsAllObjectSolidsCheckUseCase:
|
||||
def call() -> Either:
|
||||
result = freecad_repository().isAllObjectsSolids()
|
||||
if result.__len__() == 0:
|
||||
return Left(None)
|
||||
|
||||
return Right(
|
||||
ErrorStringModel(error="Is not solid objects: " + ",".join(result))
|
||||
)
|
|
@ -0,0 +1,18 @@
|
|||
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)
|
|
@ -0,0 +1,21 @@
|
|||
from repository.file_system_repository import FileSystemRepository
|
||||
from helpers.either import Left, Right, Either
|
||||
|
||||
|
||||
class ReadFileSystemAndGetInstanceModelUseCase:
|
||||
def call(self, model, path) -> Either:
|
||||
if hasattr(model, "from_dict") is False:
|
||||
return Right(
|
||||
"ReadFileSystemAndGetInstanceModelUseCase error:"
|
||||
+ model
|
||||
+ "is not have method"
|
||||
+ "from_dict()"
|
||||
)
|
||||
try:
|
||||
return Left(model.from_dict(FileSystemRepository.readJSON(path)))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
error = str(model) + " " + "from dict error " + "path: " + path
|
||||
print("ReadFileSystemAndGetInstanceModelUseCase error" + error)
|
||||
return Right(error)
|
||||
pass
|
15
sequence_generation/usecases/render_primitive_use_case.py
Normal file
15
sequence_generation/usecases/render_primitive_use_case.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from models.mesh_geometry_coordinate_model import MeshGeometryCoordinateModel
|
||||
|
||||
|
||||
class RenderPrimitiveUseCase(object):
|
||||
"""Rendering primitives
|
||||
|
||||
Args:
|
||||
object: CAD-model
|
||||
"""
|
||||
|
||||
def call(
|
||||
self, meshModels: list[MeshGeometryCoordinateModel], detailSquares
|
||||
) -> None:
|
||||
for mesh in meshModels:
|
||||
mesh.initializePrimitivesByCoordinate(detailSquares)
|
41
sequence_generation/usecases/render_primitives_scenario.py
Normal file
41
sequence_generation/usecases/render_primitives_scenario.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
from usecases.clear_work_space_document_use_case import (
|
||||
ClearWorkSpaceDocumentUseCase,
|
||||
)
|
||||
from geometric_feasibility_predicate.usecases.get_collision_at_primitive_use_case import (
|
||||
GetCollisionAtPrimitiveUseCase,
|
||||
)
|
||||
from usecases.get_part_primitive_coordinates_use_case import (
|
||||
GetPartPrimitiveCoordinatesUseCase,
|
||||
)
|
||||
from usecases.init_parts_parse_use_case import (
|
||||
InitPartsParseUseCase,
|
||||
)
|
||||
from usecases.render_primitive_use_case import (
|
||||
RenderPrimitiveUseCase,
|
||||
)
|
||||
|
||||
|
||||
class RenderPrimitivesScenario(object):
|
||||
def __init__(
|
||||
self,
|
||||
initPartsParseUseCase: InitPartsParseUseCase,
|
||||
getPartPrimitiveCoordinatesUseCase: GetPartPrimitiveCoordinatesUseCase,
|
||||
renderPrimitiveUseCase: RenderPrimitiveUseCase,
|
||||
getCollisionAtPrimitives: GetCollisionAtPrimitiveUseCase,
|
||||
clearWorkSpaceDocument: ClearWorkSpaceDocumentUseCase,
|
||||
) -> None:
|
||||
self.initPartsParseUseCase = initPartsParseUseCase
|
||||
self.getPartPrimitiveCoordinatesUseCase = getPartPrimitiveCoordinatesUseCase
|
||||
self.renderPrimitiveUseCase = renderPrimitiveUseCase
|
||||
self.getCollisionAtPrimitives = getCollisionAtPrimitives
|
||||
self.clearWorkSpaceDocument = clearWorkSpaceDocument
|
||||
|
||||
def call(self) -> None:
|
||||
meshCoordinates = []
|
||||
detailSquares = {}
|
||||
parts = self.initPartsParseUseCase.call()
|
||||
meshCoordinates = self.getPartPrimitiveCoordinatesUseCase.call(parts)
|
||||
self.renderPrimitiveUseCase.call(meshCoordinates, detailSquares)
|
||||
matrix = self.getCollisionAtPrimitives.call(parts, detailSquares)
|
||||
self.clearWorkSpaceDocument.call(detailSquares)
|
||||
return matrix
|
|
@ -2,14 +2,12 @@ import argparse
|
|||
|
||||
from usecases.stability_check_usecase import StabilityCheckUseCase
|
||||
|
||||
#python3 main.py --aspPath /home/idontsudo/t/framework/asp/out/sdf-generation --buildNumber 3
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--aspPath', help='asp folder generation path')
|
||||
parser.add_argument('--buildNumber', help='FreeCad generation buildNumber')
|
||||
args = parser.parse_args()
|
||||
# args.aspPath
|
||||
# args.buildNumber
|
||||
|
||||
StabilityCheckUseCase().call( args.aspPath,args.buildNumber )
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue