Generate

This is the main method which accesses the data from the uddInputs and generates the document.

UI Access NA
Parameters
Name Type Description
<uddInputs> List<UDDInputData> The list of inputs that the user setup in the dialog box. They are now available to query for data.
<generator> IUDDGenerator This is the document generator object which used to create different elements of the document like titles, sections, tables, images and write the data too. See the Document Generator Interfaces.
<progressMonitor> IProgressMonitor This can be used to set progress for long running calculations and check for any user-initiated aborts.
Return Value Boolean. If true, the method was successful. If false, it was not.

 

Python Syntax Generate(<uddInputs>, <generator>, <progressMonitor>)
Python Example
def Generate(self, input, docgen, progMon):
 
    # Gather data from inputs
    boolinput = input[0].Data()
    textinput = input[1].Data()
    dblinput = input[2].Data()
     
    # Get document root
    docroot = docgen.GetDocumentRoot()
     
    # Add Section
    section1 = docroot.AddSection("Summary", "Overall Results ")
     
    # Add a table
    table1 = section1.AddTable("Test Summary")
     
    #Add a table group with 2 columns
    tgroup1 = table1.AddTableGroup(2)
     
    # get desktop application
    oApp = self.GetUDDAppContext()
    if oApp != None:
        oDesktop = oApp.GetAppDesktop()
    if oDesktop != None:
        # version number
        version = oDesktop.GetVersion()
        text1 = tgroup1.AddContent()
        text1 .Add(0, "Product Version")
        text1 .Add(1, version)
     
    oProject = oDesktop.GetActiveProject()
    if oProject != None:
        projectname= oProject.GetName()
        text1 = tgroup1.AddContent()
        text1 .Add(0, "Project")
        text1 1.Add(1, projectname)
     
    oDesign = self.GetUDDDesignContext()
    if oDesign != None:
        designname = oDesign.GetName()
        text1 = tgroup1.AddContent()
        text1 .Add(0, "Design")
        text1 .Add(1, designname)
     
    # Provides a script path
    scriptpath = docgen.GetScriptPath()
    text1 = tgroup1.AddContent()
    text1 .Add(0, "Script Path")
    text1 .Add(1, scriptpath)
     
    #Provides the script version
    text1 = tgroup1.AddContent()
    text1 .Add(0, "Script Version")
    text1 .Add(1, str(dblinput))
     
    #Provides the output xml path
    outputpath = docgen.GetOutputFilePath()
    text1 = tgroup1.AddContent()
    text1.Add(0, "Output Path")
    text1.Add(1, outputpath)
     
    #Provides the user information
    text1 = tgroup1.AddContent()
    text1 .Add(0, "User")
    text1 .Add(1, textinput)
     
    # Generate Xml output
    docgen.Write(False)
     
    # Generate Html output
    docgen.WriteHTML()
     
    # Generate PDF output
    docgen.WritePDF()
     
    return True