Example Usage

The following example can be used as a basis of either the solve or evaluate script.

def runClassDemo_Helper():
    HelperObject = DesignAssessment.Helper #Get the helper object
    
    #Obtain some Helper based properties and print them to the debug file.
    print "GeometryPath = " + HelperObject.GeometryPath
    print "ResultPath = " + HelperObject.ResultPath
    print "SystemDirectory = " + HelperObject.SystemDirectory
    print "SolverOutputFilePath = " + HelperObject.SolverOutputFilePath
    
    #Use some Helper based design assessment methods
    #Create a text file with write access in the result path location
    NewSolverFilePathAndName = HelperObject.ResultPath+"\\MySolverFile.txt"
    MySolverFile = open(NewSolverFilePathAndName, "w")
    MySolverFile.write("This is a solver output file\n")
    MySolverFile.write("The backslash n indicates the end of a line\n")
    MySolverFile.close()

    #Make the solver output file text to be that contained in the MySolverFile
    HelperObject.ReplaceSolverOutputFile(NewSolverFilePathAndName) 

    #uncomment out the below line to clear the previously entered text
    #HelperObject.ClearSolverOutputFile()
    
    #Append some more text, note this automatically includes the new line code.
    HelperObject.AppendToSolverOutputFile("My First Additional Line")
    HelperObject.AppendToSolverOutputFile("My Second Additional Line")
runClassDemo_Helper()

Release 18.2 - © ANSYS, Inc. All rights reserved.