import os 
# Variables 
path = os.getcwd()
filename = "Start.scdocx"
filepath = os.path.join(path, filename)

try: 
    print("# Starting Process")
   
    # Import project
    importOptions = ImportOptions.Create()
    DocumentOpen.Execute(filepath, importOptions)

    # Update Reflector
    Reflector = SpeosDes.RectangularSurface.Find("Optical Surface Rectangular.1")
    Reflector.Groups[0].XRadius = 5
    Reflector.Groups[0].YRadius = 5
    Reflector.Compute()
    
    # Update Simulation 
    dummySimu = SpeosSim.SimulationDirect.Find("Dummy_Simulation")
    dummySimu.Compute()
    
    # Save File
    options = ExportOptions.Create()
    DocumentSave.Execute(os.path.join(path, "End.scdocx"), options)
    
except Exception as err:
    print("Unexpected "+str(err)+", "+str(type(err)))
finally:
    print("DONE")