vsp.ReadVSPFile(vsp3_path)
geom_analysis = "VSPAEROComputeGeometry"
vsp.SetAnalysisInputDefaults(geom_analysis)
vsp.SetIntAnalysisInput(geom_analysis, "GeomSet", [vsp.SET_NONE])
vsp.SetIntAnalysisInput(geom_analysis, "ThinGeomSet", [vsp.SET_SHOWN])
# Control surfaces
cs_pitch_id = vsp.CreateVSPAEROControlSurfaceGroup() # Pitch
print(vsp.GetAvailableCSNameVec(cs_pitch_id))
vsp.SetVSPAEROControlGroupName("Pitch", cs_pitch_id)
vsp.AddSelectedToCSGroup([3, 4], cs_pitch_id)
cs_roll_id = vsp.CreateVSPAEROControlSurfaceGroup() # Roll
print(vsp.GetAvailableCSNameVec(cs_roll_id))
vsp.SetVSPAEROControlGroupName("Roll", cs_roll_id)
vsp.AddSelectedToCSGroup([3, 4], cs_roll_id)
vsp.Update()
group_pitch_str = f"ControlSurfaceGroup_{cs_pitch_id + 1}"
container_id = vsp.FindContainer("VSPAEROSettings", 0)
wing_id = vsp.FindGeoms()[0]
cs_id = vsp.GetSubSurfIDVec(wing_id)[0]
vsp.SetParmVal(vsp.FindParm(container_id, f"Surf_{cs_id}_0_Gain", "ControlSurfaceGroup_0"), 1.0)
vsp.SetParmVal(vsp.FindParm(container_id, f"Surf_{cs_id}_1_Gain", "ControlSurfaceGroup_0"), -1.0)
vsp.SetParmVal(vsp.FindParm(container_id, f"Surf_{cs_id}_0_Gain", "ControlSurfaceGroup_1"), 1.0)
vsp.SetParmVal(vsp.FindParm(container_id, f"Surf_{cs_id}_1_Gain", "ControlSurfaceGroup_1"), 1.0)
vsp.ExecAnalysis(geom_analysis)