Difference between XSECSURF and XSEC?

93 views
Skip to first unread message

José Alfredo Rosas

unread,
Apr 15, 2021, 11:38:15 PM4/15/21
to OpenVSP
Hello everyone.

I am currently trying to use the VSP API to build a fuselage. As I'd like to have a simpler crosssection I am trying to change the shape from the default elipse to a rounded rectangle. Following the tests that comes within the vsp folder I should first get a xsecsurf ID using  and then chage the shape using the index, however, there are other functions in the docs that instead ask for a xsec_id, I'd like to know what is the difference between these two?

Thanks in advanced for your time, best regards
José Rosas

Rob McDonald

unread,
Apr 16, 2021, 2:12:15 PM4/16/21
to OpenVSP
That is a bit of how the sausage is made.  Unfortunately, the implementation of things within OpenVSP is leaking out to the API a bit here.

In the C++ code, a Geom is an OpenVSP shape that can be added / deleted / copy / pasted, tracked in the Geom Browser, etc.  Overall position, rotation, shading, etc. are handled at this level.

A VspSurf is a piecewise Bezier surface that is the starting point for most things in OpenVSP - creating wireframes or meshes, etc.  A specific Geom's job is to calculate a VspSurf from a set of parameters.

XSecSurf is a data structure that helps us work with XSecs.  Some (but not all) Geom's use XSecSurf to help organize things.  Basically an XSecSurf is a group of XSecs -- it provides the ability to cut / copy / paste XSecs and to iterate through them front to back and a few other things.

An XSec contains information about positioning a curve (but not the shape of the curve itself) -- think about how stack, fuselage, and wing are different in how they place XSecs relative to each other -- these are really differences at the XSec level.  Each XSec actually also has an XSecCurve.

The XSecCurve implements the 2D curve shape itself -- airfoils, circle, rounded rectangle, etc.


So, when you're using the API to edit a Stack, Fuse, or Wing (maybe some others), and you want to get at a Parm for the Nth 2D section of a body -- you need to work with the Geom to get at the XSecSurf.  You need to work with the XSecSurf to get at the XSec.  You need to work with the XSec to get at the XSecCurve...

Rob

José Alfredo Rosas

unread,
Apr 16, 2021, 2:23:29 PM4/16/21
to OpenVSP
Ok...

Is it correct to say that a given geom (say a fuselage) will only have one XSECSURF that contains all of its XSECS?

Rob McDonald

unread,
Apr 16, 2021, 2:32:45 PM4/16/21
to ope...@googlegroups.com
For all of the built-in Geom types, yes.  It might not always be that way though.

The Custom Component capability in OpenVSP is also built on the XSecGeom framework.  Some of those have been known to have multiple XSecSurfs.

What are you trying to accomplish?

Rob


--
You received this message because you are subscribed to the Google Groups "OpenVSP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openvsp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openvsp/25ac516a-6ce3-46b2-908f-bf6ec21b4c66n%40googlegroups.com.

José Alfredo Rosas

unread,
Apr 16, 2021, 2:46:32 PM4/16/21
to OpenVSP
I am trying to generate a fuselage around some internal componets. I started yesterday and was trying to change the cross-section type from ellipse to rectangle and was having some trouble with deciding wether to use the xsec or the xsecsurf. I will give it another try today with this new knowledge :-)

Rob McDonald

unread,
Apr 16, 2021, 2:49:47 PM4/16/21
to ope...@googlegroups.com
Yes, a fuselage only has one XSecSurf.  In general, I strongly recommend you use a Stack instead of a fuselage.  A Stack also only has one XSecSurf.

If you were trying to develop an API tool that could do anything for all uses -- and be future-proof, then that assumption isn't valid.

If you're looking at wrapping a body around other bodies - you might check out conformal components and SnapTo.

Rob


José Alfredo Rosas

unread,
Apr 16, 2021, 2:53:57 PM4/16/21
to OpenVSP
I actually had no idea of the conformal component and it pretty much solves my problem, thanks!

 Just out of curiosity, why the recommendation of using a stack instead of a fuselage, what would be the difference?

Rob McDonald

unread,
Apr 16, 2021, 3:08:02 PM4/16/21
to ope...@googlegroups.com
Glad conformal will do the trick for you.

Fuselage is built with an overall length and with XSecs at fractions along the length.  This is great when you're matching an existing airplane and not changing things.  However, when you want to adjust the overall length, everything slides along -- and if you liked things where they were, you won't like that.

Stack lets the space between XSecs be totally independent.  So, if you set up a nose that you like -- and an aft fuselage that you like -- you can still come along and adjust the mid-fuse and not mess up both ends.  This ends up being a more realistic way of handling many design problems.  

In particular, think about a family of aircraft like a 737-7,8,9 where the difference in the fuselages is inserting a straight barrel section.  Difficult to do in fuselage -- trivial to do in Stack.

Rob


José Alfredo Rosas

unread,
Apr 16, 2021, 9:59:44 PM4/16/21
to OpenVSP
Ok. That nakes a lot of sense, I was actually having some trouble with the fuelage sections not getting into place because of that. Another question, is there a way to deactivate T/B symmetry for a stack xsec in the skinning menu using the API. I am currently only able to set the Top and Right sides, the latter is not a problem because the aircraft has R/L symmetry but I'd like to assign different angles for the top and bottom and haven't found any API function that deactivates the default T/B symmetry. I also tried directly setting a value to the bottom angle but predictavley it did not work.

Rob McDonald

unread,
Apr 17, 2021, 1:37:16 AM4/17/21
to OpenVSP
There are Parms for that...

Discovering the Parm name and group for things can be a challenge.  There are a couple of tricks that help with this.

First, in the GUI, the label for most Parm controls (like a slider or a box) is actually a button.  If you click the button, a window will pop up that gives you some details about the Parm.  This includes the name and group.

However, this only works for Parms that have that kind of button -- some (like T/B Sym) are toggled by a button themselves, so that doesn't always work.  Also, some are sometimes more subtle, like all the checkboxes in Skinning.

So, for those, I recommend a slightly roundabout discovery process.  First, open the 'Design Variables' GUI from the Model menu.  This lets you pick certain variables to control from a simplified file.  It also provides a lightweight way to play with variables.  There is a Parm chooser GUI where you have pull-down menus for the Container, Group, and Parm name.  You can explore through this to find what you need.  However, there is an even easier way.

If you go back and find a Parm 'near' to what you think you need -- say the skinning Angle.  Click on the label button -- but this time, click and drag to the Design Variables GUI.  When you drop it in that GUI, it will add it as a design variable - without the hassle of navigating through all the menus.  Then, click on the recently added variable.  It will set the pull-downs to match.  Now you can click the Parm list and you will immediately see a list of Parms in the same group as the one you chose.  For skinning, that group looks like the attached image.

The Symmetry controlling Parms are AllSym, RLSym, TBSym - they correspond predictably to the buttons in the GUI.  You can turn them all to off (0) to have full control of all four curves.  Or, turn them all on to only need to set one curve.

TopLAngleSet, TopRAngleSet and TopLRAngleEq have obvious purposes once you know they're there.  In general, things should make sense once you get to this level of discovery.

In general, setting skinning from the API is a real pain -- I suggest you do this sort of thing from the GUI and then simply pick out which Parms you want to adjust, but always work from a baseline file that was set up interactively the easy way.

Rob
Screen Shot 2021-04-16 at 10.33.00 PM.png

Omer Kandemir

unread,
Jan 26, 2026, 8:32:07 AM (2 days ago) Jan 26
to OpenVSP
Hi Rob,

I'm trying to turn off TBSym, RLSym, AllSym for a stack XSEC with the following code. However when I open the file I see that the AllSym button is active. I'm using version 3.46.x. 
""""
import openvsp as vsp
vsp.ClearVSPModel()
sid = vsp.AddGeom( "STACK", "" )
vsp.SetParmVal( sid, "Tess_W", "Shape", 41 )
xsec_surf = vsp.GetXSecSurf( sid, 0 )
vsp.ChangeXSecShape( xsec_surf, 1, vsp.XS_ROUNDED_RECTANGLE )
vsp.ChangeXSecShape( xsec_surf, 2, vsp.XS_ROUNDED_RECTANGLE )
vsp.Update()
vsp.SetParmVal(sid, "AllSym", "XSec_2", 0.)
vsp.SetParmVal(sid, "TBSym", "XSec_2", 0.)
vsp.SetParmVal(sid, "RLSym", "XSec_2", 0.)
vsp.Update()
vsp.WriteVSPFile("test.vsp3")
"""""

Rob McDonald

unread,
Jan 27, 2026, 12:59:45 AM (yesterday) Jan 27
to OpenVSP
You should start a new thread rather than posting on a 5 year old one.

The XSec Parms are available under an additional layer.  It is a bit of a hassle, but you'll want to use

string xsec_1 = GetXSec( xsec_surf, 1 );

To
to get at them.

Rob
Reply all
Reply to author
Forward
0 new messages