Thank you for your help. I do already have a rough geometry that I set up in the GUI that now I'm trying to optimise. To start off with I thought I'd just try and practice by changing the overall span and chord values for the wing, but these aren't doing what I would expect. I found the Parms from the boxes on the GUI's so tried changing them, however this happens:
vsp.ReadVSPFile((path+fname))
geoms = vsp.FindGeoms()
span_id = vsp.GetParm(geoms[2], "TotalSpan",'WingGeom')
chord_id = vsp.GetParm(geoms[2], "TotalChord",'WingGeom')
print('Span:',vsp.GetParmVal(span_id), 'Chord:',vsp.GetParmVal(chord_id))
Span: 1.5271752771667715 Chord: 0.2832616732426238
So that gives me the existing values that match the values in the box on the GUI. So I try changing the span for example:
vsp.SetParmVal(span_id, 2)
print('Span:',vsp.GetParmVal(span_id), 'Chord:',vsp.GetParmVal(chord_id))
Span: 2.0 Chord: 0.2832616732426238
This appears to work, the span is now set to 2m. HOWEVER:
vsp.WriteVSPFile(path+fnamenew)
vsp.VSPRenew()
vsp.ReadVSPFile((path+fnamenew))
print('Span:',vsp.GetParmVal(span_id), 'Chord:',vsp.GetParmVal(chord_id))
Span: 1.5271752771667715 Chord: 0.2832616732426238
When I save and reload the file then my change is gone, it's back to the original value. Even stranger:
vsp.SetParmVal(chord_id, 0.2)
print('Span:',vsp.GetParmVal(span_id), 'Chord:',vsp.GetParmVal(chord_id))
Span: 1.5271752771667715 Chord: 0.2
I change the Chord and it seems to change. BUT when I save the file and reopen it:
vsp.WriteVSPFile(path+fnamenew)
vsp.VSPRenew()
vsp.ReadVSPFile((path+fnamenew))
print('Span:',vsp.GetParmVal(span_id), 'Chord:',vsp.GetParmVal(chord_id))
Span: 1.8174722773178038 Chord: 0.23801750912175504
The chord has changed, but to a value about halfway between what it was initially and what I had changed it to and now the span has changed to a new value also!
What on earth is going on here? Why aren't the values I'm setting staying set?
Tim