Python scripting for arc welding reports

ArcReportUtility methods

 

Methods

 

__init__(self):

 

Initialization.

 


 

createAuxCommandArcWeldReport(self, Operator, apppath):

 

Pass Command from AutoExecute, e.g. after Download

     

     Args:

        Operator:                the CENPyOlpProgramModifyOperator

        apppath:                the Location of the customer NLS Files

 


 

createPDFReport(self, Operator, repfilepath):

 

Main Method to create the PDF Report

     

     Args:

        Operator:                the CENPyOlpProgramModifyOperator

        repfilepath:                the Location of the where the PDF Report should be written.

 


 

techColumnSelection(self):

   

Get the desired Set of Columns and its Order.

     

     Returns:

        str:                the List of Columns

 


 

buildReportName(self, programName, controllerName):

Build Report File Name, to be inheritate if customizing desired.

     

     Args:

        programName:                the Process Program Name

        controllerName:                the Name of the Controller

     

     Returns:

        str: fileName:                the desired File Name

 


 

defineFont(self):

   

Defines the desired Font Type and size to Globals.

Note : CN & JP are only supported by one unique Font, Size can be adjusted

 


 

setLanguage(self, language):

Sets the desired Language

     

     Args:

        language :        the desired NLS Language

                               english "EN",  german "DE",  french "FR",  chinese "CN",  japanese "JP"

 


 

setReportUnit(self, unit):

Sets the desired Unit mm/inch

     

     Args:

        unit :                the desired unit mm or inch

 


 

setDownloadFolder(self, folder):

Sets the desired Report Download Folder, vary from standard DL-Folder

     

     Args:

        folder :                the desired Folder

 


 

defineColumnTitleWidth(self, columns):

Defines the Order of the desired Table Columns.

     Note: internal Column Name and its Place in the Order must be fix

     

     Args:

        columns :        the desired List of Columns in desired Order

     

     Possible Items : "Id", "Material", "SeamSize", "WeldingPosition", "WireDiameter", "GasFlowRate", "WireFeedSpeed", "WeldingSpeed", "Current", "Voltage", "WireConsumption", "GasFlow", "TotalWeldingTime"

     

     Returns:

        strList: headLine   :        the List of the Columns Header Names in desired Order

        strList: colWidth   :        the List of the Columns Width in desired Order

        intList: order     :        the List of the ordered Column Numbers

        int :    totalWidth :        the total Width of all Columns to define Portrait or Landscape Format


 

defineOpsColumnTitleWidth(self, columns):

Defines the Order of the desired Table Columns.

     Note: internal Column Name and its Place in the Order must be fix

     

     Args:

        columns :        the desired List of Columns in desired Order

     

     Possible Items : "WeldSeam", "WPSID", "SeamSize", "WeldingPosition", "SeamLength", "WeldingTime"

     

     Returns:

        strList: headLine   : the List of the Columns Header Names in desired Order

      strList: colWidth   : the List of the Columns Width in desired Order

      intList: order      : the List of the ordered Column Numbers

        int :    totalWidth : the total Width of all Columns to define Portrait or Landscape Format

 


 

  Defines the Table Header Name and Width of the Items

Each Item must have its own Method

   

  Returns:

    str:        the Header Name of the Column

    int:                the Column Width

 

  Possible Items for Technology Table: "Id", "Material", "SeamSize", "WeldingPosition", "WireDiameter", "GasFlowRate", "WireFeedSpeed", "WeldingSpeed", "Current", "Voltage", "WireConsumption", "GasFlow", "TotalWeldingTime"

   

  def defineColId(self):

     return self.__NLS.getNLS("Id","Id*"), int(self.__NLS.getNLS("IdWidth","21"))

  def defineColMaterial(self):

     return self.__NLS.getNLS("Material","Material*"),  int(self.__NLS.getNLS("MaterialWidth","21"))

  def defineColSeamSize(self):

     return self.__NLS.getNLS("SeamSize","Seam Size*") + self.__systemUnit,  int(self.__NLS.getNLS("SeamSizeWidth","21"))

  def defineColWeldingPosition(self):

     return self.__NLS.getNLS("WeldingPosition","Welding Position*"),  int(self.__NLS.getNLS("WeldingPositionWidth","21"))

  def defineColWeldingSpeed(self):

     return self.__NLS.getNLS("WeldingSpeed","Welding Speed*") + self.__systemFeedUnit,  int(self.__NLS.getNLS("WeldingSpeedWidth","21"))

  def defineColWireDiameter(self):

     return self.__NLS.getNLS("WireDiameter","Wire Diameter*") + self.__systemUnit,  int(self.__NLS.getNLS("WireDiameterWidth","21"))

  def defineColWireFeedSpeed(self):

     return self.__NLS.getNLS("WireFeedSpeed","Wire Feed Speed*") + self.__systemFeedUnit,  int(self.__NLS.getNLS("WireFeedSpeedWidth","21"))

  def defineColWireConsumption(self):

     return self.__NLS.getNLS("WireConsumption","Wire Consumption*"),  int(self.__NLS.getNLS("WireConsumptionWidth","21"))

  def defineColVoltage(self):

     return self.__NLS.getNLS("Voltage","Voltage*"),  int(self.__NLS.getNLS("VoltageWidth","21"))

  def defineColCurrent(self):

     return self.__NLS.getNLS("Current","Current*"),  int(self.__NLS.getNLS("CurrentWidth","21"))

  def defineColGasFlow(self):

     return self.__NLS.getNLS("GasFlow","Gas Flow*"),  int(self.__NLS.getNLS("GasFlowWidth","21"))

  def defineColGasFlowRate(self):

     return self.__NLS.getNLS("GasFlowRate","Gas Flow Rate*"),  int(self.__NLS.getNLS("GasFlowRateWidth","21"))

  def defineColTotalWeldingTime(self):

     return self.__NLS.getNLS("TotalWeldingTime","Total Welding Time*") + self.__systemTimeUnit,  int(self.__NLS.getNLS("TotalWeldingTimeWidth","21"))

 

 

  Possible Items for Operation Table : "WeldSeam", "WPSID", "SeamSize", "WeldingPosition", "SeamLength", "WeldingTime"

 

  def defineColOpsWeldSeam(self):

     return self.__NLS.getNLS("WeldSeamOps","Weld Seam*"), int(self.__NLS.getNLS("WeldSeamOpsWidth","35"))

  def defineColOpsWPSID(self):

     return self.__NLS.getNLS("WPSIDOps","WPS ID*"),  int(self.__NLS.getNLS("WPSIDOpsWidth","35"))

  def defineColOpsSeamSize(self):

     return self.__NLS.getNLS("SeamSizeOps","Seam Size*") + self.__systemUnit,  int(self.__NLS.getNLS("SeamSizeOpsWidth","35"))

  def defineColOpsWeldingPosition(self):

     return self.__NLS.getNLS("WeldingPositionOps","Welding Position*"),  int(self.__NLS.getNLS("WeldingPositionOpsWidth","35"))

  def defineColOpsSeamLength(self):

     return self.__NLS.getNLS("SeamLengthOps","Seam Length*") + self.__systemSizeUnit,  int(self.__NLS.getNLS("SeamLengthOpsWidth","35"))

  def defineColOpsWeldingTime(self):

     return self.__NLS.getNLS("WeldingTimeOps","Welding Time*") + self.__systemTimeUnit,  int(self.__NLS.getNLS("WeldingTimeOpsWidth","35"))

 


 

header(self):

Defines the common Header of the PDF Report, called from FPDF Base Class

 


 

cenheader(self, Operator, portrLands):

Defines the customized Header of the PDF Report, underneath common Header

     

     Args:

        Operator :        the CENPyOlpProgramModifyOperator

        portrLands :        if Report is created in Portrait or Landscape Mode

 


 

cenfooter(self, portrLands):

Defines the customized Footer of the PDF Report, underneath common Header

     

     Args:

        portrLands :        if Report is created in Portrait or Landscape Mode

 


 

footer(self):    

Defines the common Footer of the PDF Report, called from FPDF Base Class

 


 

techTable(self, Operator, headLine, colWidths, order):

Defines the customized Body of the PDF Report.

     

     Args:

        Operator:        the CENPyOlpProgramModifyOperator

        headLine :        the List of the Columns Header Names

        colWidths :        the List of the Columns Width

        order :                the List of the ordered Column Numbers

 


 

weldTable(self, Operator, headLine, colWidths, order):

Defines the customized Body of the PDF Report.

     

     Args:

        Operator:        the CENPyOlpProgramModifyOperator

        headLine :        the List of the Columns Header Names

        colWidths :        the List of the Columns Width

        order :                the List of the ordered Column Numbers

 


 

unitConvert(self, value, var=0):

Converts a Value to the set Unit.

     

     Returns:

        ret:                the converted Value

 


 

getRelatedDataSet(self, Operator, pgmnr):

Check and returns if there is a related DataSet where the Program number fits.

     

     Args:

        Operator: the CENPyOlpProgramModifyOperator

        pgmnr : the Welding Program Number

       

     Returns:

        list:                the List of the related DataSet or default

 


 

weldPosition(self, index):

Check and returns if there is a related DataSet where the Program number fits.

     

     Args:

        index :                the Integer Index for the Welding Position

       

     Returns:

        string:                the Name of the Welding Position

 


 

collectOperation(self, Operator, operation):

Looping through the requested Operation and getting the welded Length.

     

     Args:

        Operator :        the CENPyOlpProgramModifyOperator

        operation :        the Adress of the requested Operation

       

     Returns:

        length:                the welded Length of the Operation

 


 

columnOrder(self, order, unsorted):

Sorts the complete Range of Columns to the desired Order of the single Columns

     

     Args:

        order    :                the numeric List of the desired Order

        unsorted :        the complete Range of Information per TPE

     

     Returns:

        strList: sorted:        the List of the sorted and desired Columns per TPE

 


 

header_table(self, Operator):

Write a Table with common Program Information

     

     Args:

        Operator :        the CENPyOlpProgramModifyOperator

 


 

getRGBColours(self, item):

Get the RGB Colours for the Table Header Row.

     Can be set in the Report NLS File by "headerrowcolor=176.195.52" (Cenit green)

     

     Args:

        item :                the desired Item from NLS File

     Returns:

        red   :                the Portion of RED

        green :                the Portion of GREEN

        blue  :                the Portion of BLUE

 


 

colored_table(self, headings, rows, colWidths):

Write the Program TPEs Information to the Table

     

     Args:

        headings :        the List of the Table Header

        rows :                the List of the TPE Information

        colWidths :        the List of the Column Width


 

stringLF(self, thisText):

Converts an Asteriks * in a String into an Linefeed chr(10)

     

     Returns:

        string:                Asteriks replaced with Linefeed


 

getAnyEvent(self, eventHandler, opTpe, eventName):

Calculates linear tool path length

     

     Args:

        eventHandler:        the event handler

        opTpE:                the current tool path element

     

     Returns:

        bool: requestedEvent :        Bool True/False if Event found

        int:  insPos :                the InsertPosition of the req. Event before/after

 


 

calcLinLength(self, teachHandler, lastTpE, opTpe):

Calculates linear tool path length

     

     Args:

        teachHandler:                the teach handler

        lastTpE:                        the last tool path element

        opTpe:                        the current tool path element

     

     Returns:

        double: length :                the linear Length between the last and current TPE

 


 

calcCircLength(self, teachHandler, lastTpE, opTpe):

Calculates circular tool path length

     

     Args:

        teachHandler:                the teach handler

        lastTpE:                        the last tool path element

        opTpe:                        the current tool path element

     

     Returns:

        double: length :                the circular Length between the last and current TPE

 


 

getVector(self, point1, point2):

Gets vector through two points

     

     Args:

        point1:                First point

        point2:                Second point

     

     Returns:

        double:                the Vector between the two Points

 


 

getVectorLength(self, vector):

Calculates vector length

     

     Args:

        vector:                the vector to calculate the length for

     

     Returns:

        double:                the Vector Length

 


 

getVectorScalar(self, vector1, vector2):

Calculates vector scalar

     

     Args:

        vector1:                the first vector

        vector2:                the second vector

     

     Returns:

        double:                the scalar Product of the two given Vectors

 


     


Previous
Page précédente
Chapter
Page principale du chapitre
Next
Page suivante