This question is a continuation of:
How to start workbench in batch mode and automatically execute a python script? (from a command prompt)
Workbench can be started by putting the content of:
"C:\Program Files\ANSYS Inc\v202\Framework\bin\Win64\runwb2" -F "test.wbpj" -R "test1.py" -I
in a batch file
For the second task - to do changes in the geometry one can proceed like this:
record the desired changes in SpaceClaim using the script recorder by first changing from Smart Variable to Index
using SendCommand to parse the script to SpaceClaim
An example of test1.py could look like:
s1 = GetSystem(Name = 'SYS')
g1 = s1.GetContainer(ComponentName='Geometry')
command = '''
ClearAll()
# Create Box 1 using MM units
result = BlockBody.Create(Point.Create(MM(-10),MM(-10),MM(0)),Point.Create(MM(10),MM(10),MM(20)),ExtrudeType.ForceAdd)
'''
#g1.Edit(Interactive=False)
g1.Edit(IsSpaceClaimGeometry=True)
g1.SendCommand(Language = 'Python',Command = command)
g1.Exit()
m1 = s1.GetComponent(Name='Model')
m1.Update()