import json
import subprocess

loa_sq = 24.4

# Ajustando planChine
# chord 0->6: (4.00-3.70)/6 = 0.05
# chord 6->12: (4.10-4.00)/6 = 0.0167
# chord 12->18: (3.40-4.10)/6 = -0.1167
# chord 18->22: (1.80-3.40)/4 = -0.40
# chord 22->24.4: (0-1.80)/2.4 = -0.75
# monotonic decreasing chords: 0.05, 0.0167, -0.1167, -0.40, -0.75

cmd = [
    "python3", "/home/magdalena/.hermes/plugins/iarquiteto-naval-brana/skills/brana-rascunho-2d-interativo/scripts/ajustar.py",
    "--loa-sq", str(loa_sq),
    "--projeto", "/home/magdalena/eee/alunos/victor-lei/projeto.json",
    "--curva", "planSheer", "0,4.60", "6,4.95", "12,5.125", "18,4.50", "22,2.50", "24.4,0",
    "--curva", "planChine", "0,3.70", "6,4.00", "12,4.10", "18,3.40", "22,1.80", "24.4,0",
    "--curva", "profSheer", "0,4.25", "6,4.25", "12,4.25", "18,4.25", "22,4.30", "24.4,4.40",
    "--curva", "profChine", "0,1.70", "6,1.55", "12,1.50", "18,1.65", "22,2.80", "24.4,4.40",
    "--curva", "profKeel",  "0,0.0", "6,0.0", "12,0.0", "18,0.0", "22,1.80", "24.4,4.40"
]

res = subprocess.run(cmd, capture_output=True, text=True)
print("Ajustar output:\n", res.stdout)
if res.stderr:
    print("Ajustar error:\n", res.stderr)

