Skip to content

Commit

Permalink
add a modification that causes all parts to be set to shade mode
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdsharpe committed Feb 13, 2024
1 parent 170f097 commit d3f9946
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions aerosandbox/geometry/openvsp_io/asb_to_openvsp/_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -33,15 +36,30 @@ 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 )
{
ErrorObj err = PopLastError();
Print( err.GetErrorString() );
}
"""
"""

if set_geom_draw_type_to_shade:
script = script + """\
{
array<string> @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"""\
Expand Down

0 comments on commit d3f9946

Please sign in to comment.