framework/cg/freecad/Frames/freecad2pddl.py

60 lines
No EOL
1.6 KiB
Python

# 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))))