Jump to content

Export reports using multiple alignment methods


---
 Share

Recommended Posts

I have a code here that automatically exports reports, but when encountering multiple alignment methods in the measurement program, the exported report will have an error message on the report page for one alignment method. Is there any way to solve this problem? I will share the code below

 -*- coding: utf-8 -*-

import gom
import os

RESULT=gom.script.sys.execute_user_defined_dialog (content='<dialog>' \
' <title>Export PDF</title>' \
' <style></style>' \
' <control id="OkCancel"/>' \
' <position></position>' \
' <embedding></embedding>' \
' <sizemode></sizemode>' \
' <size width="414" height="133"/>' \
' <content columns="2" rows="1">' \
'  <widget type="label" column="0" row="0" columnspan="1" rowspan="1">' \
'   <name>label</name>' \
'   <tooltip></tooltip>' \
'   <text>Savepath:</text>' \
'   <word_wrap>false</word_wrap>' \
'  </widget>' \
'  <widget type="input::file" column="1" row="0" columnspan="1" rowspan="1">' \
'   <name>file_report</name>' \
'   <tooltip></tooltip>' \
'   <type>directory</type>' \
'   <title>Choose File</title>' \
'   <default></default>' \
'   <limited>false</limited>' \
'   <file_types/>' \
'   <file_types_default></file_types_default>' \
'  </widget>' \
' </content>' \
'</dialog>')


path = RESULT.file_report

stages = gom.app.project.stages
gom.script.report.update_report_page(
    pages=gom.app.project.reports, 
    used_alignments='report', 
    used_digits='report', 
    used_legends='report', 
    used_stages='current', 
    used_units='report')
reportpages = gom.app.project.reports


for j in range(len(stages)):
    
    gom.script.sys.show_stage (stage = stages[j])
    name = str(stages[j].name)
    savepath = os.path.join(path, name)

        
    gom.script.report.update_report_page (
        pages=reportpages, 
        used_alignments='report', 
        used_digits='report', 
        used_legends='report', 
        used_stages='current', 
        used_units='report')

            

    gom.script.report.export_pdf (
        export_all_reports=True, 
        file=str(savepath) + '.pdf', 
        jpeg_quality_in_percent=90, 
        max_dpi=150)    

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...