FEA Property Functionality in OpenVSP

45 views
Skip to first unread message

Zachary Law

unread,
Sep 24, 2025, 3:33:58 AM (6 days ago) Sep 24
to OpenVSP
Hi all,

I've been using the Python API to use FEA Mesh in 3.45.4, and found after calling the AddFeaProperty(FEA_SHELL) function, the actual .vsp3 file did not include the new FEA Property in under the Property Tab in FEA Structures. Additionally, I could not find a function to change the FEA Property name.

I've attached a screenshot of my code below. Has anyone else encountered this issue?
image_2025-09-24_003218600.png

Rob McDonald

unread,
Sep 24, 2025, 12:30:25 PM (6 days ago) Sep 24
to OpenVSP
You'll need to post more of your script for anyone to actually be able to help.

Have you looked at the example FEAMesh.vspscript?



Zachary Law

unread,
Sep 26, 2025, 5:11:17 PM (4 days ago) Sep 26
to OpenVSP
Here's the .py script I've used, and the resulting .vsp3 file; it's a bit updated from the screenshot above, as I started referencing FEAMesh.vspscript. Under the spar definition section, I called the AddFeaProperty() twice, resulting in the creation of PROPERTY_0 and PROPERTY_1 (FindContainer() is able to print the ID for PROPERTY_1). However, the GUI does not show PROPERTY_1 (see screenshot below). Is this a common issue? I haven't seen anything similar in this Group.
image_2025-09-26_141056595.png
feaMeshTest.py
testwing2.vsp3

Rob McDonald

unread,
Sep 26, 2025, 5:56:48 PM (4 days ago) Sep 26
to OpenVSP
Some time ago, we switched FEAProperties from being handled by index to being handled by ID.

However, matching changes to the API were not made.

To handle the transition, some games are played under the hood.  When an ID is set for a Property, the index is set to -1 and the ID is used.

If an index that is != -1 is ever detected during an Update(), that index is used to look up the corresponding ID, the ID is set, and the index is set to -1.  So, setting the property by index from the API should still work.  However, after an Update(), if you were to GetParm() the index, it should be changed to -1.

If, during an Update(), any Part has an invalid Property ID, VSP will replace that ID with the Default property ID -- if the default is missing for some reason, a new default will be created.

I modified your script to add in a 3rd spar.  When I did that, the 2nd spar (with your desired properties) worked correctly, but the 3rd spar still had default properties.

I believe the structure is not getting fully Update()'d under the hood.  I think this is because 'just' updating the Geom doesn't fully recurse into the Structures inside it (for $reasons$).  However, adding the new Part does trigger a more complete Update.

So, I modified the script to add and then delete a 3rd spar -- and that seemed to make it so your script behaves the way you want.  This is obviously ugly, but it hopefully will get you making progress again.

Some suggestions...

I recommend you use the openvsp package.  It has a bunch of helper stuff that should improve life in general.  Just install the package and then:

import openvsp as vsp   (instead of 'import vsp as vsp').

Also, I recommend you don't start from a blank slate every time in your script.  While we try to make the scripting as capable as possible, the GUI gets tested and developed a lot more than the API.

You can probably set up a baseline file in the GUI -- with your wing, structure, and properties all set up.

Then, if you want to make automated changes from the API, just load that *.vsp3 file, change the Parms that you need to change, and work from there.  This will probably make for a shorter / easier to work with script.

It also has the advantage that you can version control the *.vsp3 files -- since they are modifications of a baseline file, the Parm and Geom ID's will be the same -- vs. starting from scratch every run means all ID's will be random every time.

Rob
feaMeshTest.py

Zachary Law

unread,
Sep 27, 2025, 5:28:52 AM (3 days ago) Sep 27
to OpenVSP
Thank you for clarifying how the FEA Properties were working behind the scenes, I couldn't find any documentation; looks like adding and deleting that third spar worked on my end.

I was originally using 'import vsp as vsp' because I was having issues importing the openvsp module after downloading; a reinstall fixed this error.

I'll take your suggestion with setting up a baseline file in the GUI, I imagine this is more efficient for conducting studies too - thanks!

Reply all
Reply to author
Forward
0 new messages