From STL to CPACS file using openVSP

32 views
Skip to first unread message

nicolò perasso

unread,
Dec 4, 2025, 3:01:27 AM (13 days ago) Dec 4
to OpenVSP
Hi, I'm working to develop a tool to define a CPACS file form an STL. The problem is challenging because from a file that contains only surface/mesh information i need to find the parameters that describe a geometry in order to define a CPACS file. The problem is how to find this parameters( airfoil, lenght, ...) , my idea is to use the slicing feature inside openVSP that works very well, to have the points cloud of each slice and after re-built the geometry in a CPACS file( once i know the airfoil i can obtain obtain the other informations). I want to use the python API to automate the process but i noticed that ComputePlaneSlice accepts only openVSP native files not STL. However, inside the GUI, you can perform slicing on STL files as well. How can i resolve the problem? I'm open to suggestion or advice. Thank you.

Rob McDonald

unread,
Dec 4, 2025, 10:55:40 AM (13 days ago) Dec 4
to OpenVSP
Have you tried calling 'ImportFile' from the API to import you STL file?

/*!
Import a file into OpenVSP. Many formats are available, such as NASCART, V2, and BEM). The imported Geom, mesh, or other object is inserted
as a child of the specified parent. If no parent or an invalid parent is given, the import will be done at the top level.
\sa IMPORT_TYPE
\param [in] file_name Import file name
\param [in] file_type File type enum (i.e. IMPORT_PTS)
\param [in] parent Parent Geom ID (ignored with empty string)
*/

extern std::string ImportFile( const std::string & file_name, int file_type, const std::string & parent );

The file_type value you want is vsp::IMPORT_STL

That should read in a STL file just like you do from the GUI.  Then, you should be able to use any of the analysis tools just like from the GUI.

Instead of using the direct ComputePlaneSlice API call, I suggest you become familiar with using the Analysis Manager. In this case, you'll want to use the 'PlanarSlice' analysis.

Before the introduction of the Analysis Manager, every analysis tool had its own API call (like ComputePlaneSlice).  As more analysis tools were added (with more options and more complex options), this became chaotic.  To help this situation, the Analysis Manager was added to provide a consistent interface for analyses and their results (via the Results Manager).

Rob
Reply all
Reply to author
Forward
0 new messages