How to start Workbench project from the command line and made modification in the geometry

Drago
Drago Member, Employee Posts: 17
First Anniversary Ansys Employee First Comment Photogenic
✭✭✭
edited November 2023 in 3D Design

Answers

  • Drago
    Drago Member, Employee Posts: 17
    First Anniversary Ansys Employee First Comment Photogenic
    ✭✭✭
    Answer ✓

    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:

  • M
    M Member, Employee Posts: 236
    50 Answers 100 Comments 100 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    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()