From d3f994638ae4adda0c64384f504fda9d742ac27a Mon Sep 17 00:00:00 2001 From: Peter Sharpe Date: Tue, 13 Feb 2024 18:59:20 -0500 Subject: [PATCH] add a modification that causes all parts to be set to shade mode --- .../openvsp_io/asb_to_openvsp/_utilities.py | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/aerosandbox/geometry/openvsp_io/asb_to_openvsp/_utilities.py b/aerosandbox/geometry/openvsp_io/asb_to_openvsp/_utilities.py index d1b11624..3500f5b0 100644 --- a/aerosandbox/geometry/openvsp_io/asb_to_openvsp/_utilities.py +++ b/aerosandbox/geometry/openvsp_io/asb_to_openvsp/_utilities.py @@ -12,7 +12,10 @@ _openvsp_version = "3.36.0" -def wrap_script(script: str) -> str: +def wrap_script( + script: str, + set_geom_draw_type_to_shade: bool = True, +) -> str: """ Wraps the internal parts of a VSPScript file with a main() function. @@ -33,7 +36,7 @@ def wrap_script(script: str) -> str: Returns: The script, wrapped with a main() function. """ - script = script + """ + script = script + """\ //==== Check For API Errors ====// while ( GetNumTotalErrors() > 0 ) @@ -41,7 +44,22 @@ def wrap_script(script: str) -> str: ErrorObj err = PopLastError(); Print( err.GetErrorString() ); } - """ +""" + + if set_geom_draw_type_to_shade: + script = script + """\ + +{ + array @geomids = FindGeoms(); + + for (int i = 0; i < geomids.size(); i++) + { + Print(geomids[i]); + SetGeomDrawType( geomids[i], GEOM_DRAW_SHADE ); + } +} + +""" import aerosandbox as asb return f"""\