SpaceClaim Headless mode in python code

Options
sombodyfromtheworld
sombodyfromtheworld Member Posts: 29
First Comment Name Dropper
edited December 2023 in General Language Questions

I have this code that I run thought the command in workbech"Run Script File...":

# open main system
SetScriptVersion(Version='23.1.153')
Save(FilePath='path_to.wbpj', Overwrite=True)
SetScriptVersion(Version='23.1.153')
template1 = GetTemplate(TemplateName="Static Structural", Solver='ANSYS')
system1 = template1.CreateSystem()

# open spaceclaim and create geometry
geometry1 = system1.GetContainer(ComponentName='Geometry') # here I dont need to open GUI
geometry1.Edit(IsSpaceClaimGeometry=True)
geometry_beam_script = open('path_of_the_geometry_script.py', 'r')
run_geometry_beam_script = geometry_beam_script.read()
geometry_beam_script.close()
geometry1.SendCommand(Command=run_geometry_beam_script, Language='Python')
Save(Overwrite=True)
geometry1.Exit()

How to set SpaceClaim in headless mode in that code above in the line 9 or anywhere else (headless=True)?

Answers

  • M
    M Member, Employee Posts: 230
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Options

    Unfortunately SpaceClaim and Discovery require being open to create/manipulate geometry. There are some ideas being worked on in pyansys geometry (https://geometry.docs.pyansys.com/version/stable/) where you can create geometry, but if you use spaceclaim, it will open.