CFL has several functions that are not general purpose (as those above) but specific to layout of pages and signs on a roll or sheet. Though the calculation can be (and has been) done using the general formulas, these occur so often that CFL has special functions to manage them.

See Also cfl_function_-_calculatelayoutonroll and cfl_function_-_calculatelayoutonsheet.

In order to determine the optimal layout, Control must calculate the layout with both a portrait and landscape orientation. Each of these orientations is tiledTiling refers to putting multiple copies next to each other across the width. (to fill the width of the roll) or paneledPaneling refers to splitting a copy across multiple rolls. if the item width is larger than the roll width. The total amount of material used for the required number of copies is calculated and the orientation with the minimum material usage (that also satisfies other requirements passed in) is chosen.

This concept, though simple, involves complex calculations that formerly took over 30 independent variables to compute and record. Hence, this function has been well received!

I would recommend experimenting on a new product while you are learning and avoid changing anything on your existing products until you are satisfied with your results.

One common mistake is also to forget the distinction between GetVariablePropertyValue and GetVariablePropertyText. The former must be used to pull number and yes/no values, while the latter must be used to pull text values.

We are going to create a basic layout here. There are some additional options to this function we won't explore in this How-To, but the names of the parameters and documentation at cfl_function_-_calculatelayoutonrollshould be sufficient to help you refine it to your needs.

  1. Create the following number input variables. (In some cases, you can pull the information from other places as noted below, but I'm going to use the variables in this example.)
    • Quantity (Entered by user)
    • ImageHeight (Entered by user)
    • ImageWidth (Entered by user)
    • ImageGap (The space between prints, needed for cut or bleed. Often ignored (0) or entered by the user.)
    • RollWidth (Commonly pulled from a Part UDF or selection list property.)
    • PrintMargin (The non-printable border/space around each print. Zero if not used.)
  2. Create the following text variable to store the results of the calculation.
    • RollLayout (Used to store the results of the layout calculations.) Enter the following formula in the Default value formula.

Notes:

  • Everything after the double-slashes is a comment. It isn't required but you'll thank yourself later if you record what you are doing today.
  • Although we aren't doing so in this simple example, you can use any valid CFL statement for each of these parameters. You don't have to create variables for each value that is passed in unless it makes sense to (usually because the user can override it).
CalculateLayoutOnRoll(
    RollLayout,     // Variable to store the results in
    ImageHeight,    // Image Height
    ImageWidth,     // Image Width
    Quantity,       // Quantity
    RollWidth,      // Roll Width
    ImageGap,       // Gap across the height (length) of the roll
    ImageGap,       // Gap across the width of the roll
    PrintMargin,    // Margin at the top of each print
    PrintMargin,    // Margin at the bottom of each print
    PrintMargin,    // Margin at the left side of each print
    PrintMargin,    // Margin at the right side of each print
    0,      // Roll Leader - Amount of material wasted loading/starting the job
    0,      // Roll Trailer - Amount of material wasted ending/unloading the job
    0,      // Roll Margin Left - Amount of non-printable space on left side of Roll
    0,      // Roll Margin Right - Amount of non-printable space on right side of Roll
    0,      // Overlap Amount - Amount of material to overlap when paneling
    True,   // Can Rotate - If true, calculate rotated and non-rotated to find optimal
    True,   // Can Tile - If true, calculate multiple across if they fit
    True    // Avoid Paneling - If true, always choose a non-paneled solution if possible
)
  1. Create the following calculated number variables and set the formulas as indicated. Set the units to the appropriate units for the variable.
    • PrintedScrapArea = GetVariablePropertyValue(RollLayout,“TotalScrapArea”,0)
    • PrintedTotalArea = GetVariablePropertyValue(RollLayout,“TotalProducedArea”,0)
    • PrintedRollLength = GetVariablePropertyValue(RollLayout,“TotalRollLength”,0)
  2. Create the following text variable to provide information to display to the user.
    • RollPrintLayoutNotes. The formula for this variable should read:

code format="vb"

“Printing Material Layout”

+CHAR(13) + CHAR(10)

+CHAR(13) + CHAR(10)

+CHAR(13) + CHAR(10)+ “Is Rotated : ” + IF GetVariablePropertyValue(RollLayout,“IsRotated”, False) THEN “Yes” ELSE “No” ENDIF

+CHAR(13) + CHAR(10)+ “Is Paneled : ” + IF GetVariablePropertyValue(RollLayout,“IsPaneled”, False) THEN “Yes” ELSE “No” ENDIF

+CHAR(13) + CHAR(10)+ “Number Across Panel : ” + GetVariablePropertyText(RollLayout,“PrintsWide”,“0”)

+CHAR(13) + CHAR(10)+ “Number Along Roll : ” + GetVariablePropertyText(RollLayout,“PrintsHighPerPanel”,“0”)

+CHAR(13) + CHAR(10)

+CHAR(13) + CHAR(10)+ “ Printed Area = ” + DisplayVariableValue(PrintedTotalArea, -2)

+CHAR(13) + CHAR(10)+ “+ Scrap Area = ” + DisplayVariableValue(PrintedScrapArea, -2)

+CHAR(13) + CHAR(10)+ “= Total Area = ” + ToString( (PrintedTotalArea+PrintedScrapArea) In UnitArea, 2) + “ ” + UnitAreaName

+CHAR(13) + CHAR(10)+ “/ Roll Width = ” + DisplayVariableValue(RollWidth, -2)

+CHAR(13) + CHAR(10)+ “= Length Off Roll = ” + DisplayVariableValue(PrintedRollLength, -2)

+CHAR(13) + CHAR(10)

==== Create Product ====
  - Create a product that uses these variables
  - Set the price formula to charge a certain rate for printed area and a certain rate for the scrap.
 Example: PreDiscountPrice = (10 * PrintedTotalArea in SqFeet) + (2 * PrintedScrapArea in SqFeet)
  - Create a product layout if desired.
  - Create a pricing form that uses these variables (requires Control Customizable) and set the product to use this Pricing Form. Make sure the RollPrintLayoutNotes variable is displayed in a memo large enough to see the results as you work.
 **Hint**: If you are just creating this for testing and don't want to bother with a polished Pricing form, or if you don't have Control Customizable, you can use the "Variable Grid" pricing form. This pricing form creates a grid of all of the variables in a product (arranged alphabetically) that you can use while you are testing and debugging.
 A sample pricing form text is below (you can copy the text below and paste it into the "Advanced" tab in pricing form entry and then click the lightning button to generate it.
{{::http:www.ecyrious.comcontrolimageshowto_on_calculaterolllayout_samplepricingform.jpg?nolink&|}}

object RzPanel1: TRzPanel

  Left = 0
  Top = 0
  Width = 470
  Height = 336
  TabOrder = 0
  object DesignerLabel1: TDesignerLabel
    Left = 100
    Top = 35
    Width = 39
    Height = 13
    Caption = 'Quantity'
  end
  object DesignerLabel2: TDesignerLabel
    Left = 100
    Top = 69
    Width = 63
    Height = 13
    Caption = 'Image Height'
  end
  object DesignerLabel3: TDesignerLabel
    Left = 100
    Top = 105
    Width = 60
    Height = 13
    Caption = 'Image Width'
  end
  object DesignerLabel4: TDesignerLabel
    Left = 100
    Top = 147
    Width = 56
    Height = 13
    Caption = 'Print Margin'
  end
  object DesignerLabel5: TDesignerLabel
    Left = 100
    Top = 193
    Width = 68
    Height = 13
    Caption = 'Material Width'
  end
  object DesignerLabel6: TDesignerLabel
    Left = 100
    Top = 245
    Width = 52
    Height = 13
    Caption = 'Image Gap'
  end
  object DesignerLabel7: TDesignerLabel
    Left = 197
    Top = 32
    Width = 63
    Height = 13
    Caption = 'Layout Notes'
  end
  object DesignerSpinEdit1: TDesignerSpinEdit
    Left = 40
    Top = 33
    Width = 47
    Height = 21
    AllowKeyEdit = True
    TabOrder = 0
    DisplayedInfo = pmdValue
    DisplayedPrice = pmpPrice
    ParameterName = 'Quantity'
    VariableName = 'Quantity'
  end
  object DesignerSpinEdit2: TDesignerSpinEdit
    Left = 40
    Top = 70
    Width = 47
    Height = 21
    AllowKeyEdit = True
    TabOrder = 1
    DisplayedInfo = pmdValue
    DisplayedPrice = pmpPrice
    ParameterName = 'ImageHeight'
    VariableName = 'ImageHeight'
  end
  object DesignerSpinEdit3: TDesignerSpinEdit
    Left = 40
    Top = 105
    Width = 47
    Height = 21
    AllowKeyEdit = True
    TabOrder = 2
    DisplayedInfo = pmdValue
    DisplayedPrice = pmpPrice
    ParameterName = 'ImageWidth'
    VariableName = 'ImageWidth'
  end
  object DesignerSpinEdit4: TDesignerSpinEdit
    Left = 40
    Top = 147
    Width = 47
    Height = 21
    AllowKeyEdit = True
    TabOrder = 3
    DisplayedInfo = pmdValue
    DisplayedPrice = pmpPrice
    ParameterName = 'PrintMargin'
    VariableName = 'PrintMargin'
  end
  object DesignerSpinEdit5: TDesignerSpinEdit
    Left = 40
    Top = 193
    Width = 47
    Height = 21
    AllowKeyEdit = True
    TabOrder = 4
    DisplayedInfo = pmdValue
    DisplayedPrice = pmpPrice
    ParameterName = 'RollWidth'
    VariableName = 'RollWidth'
  end
  object DesignerSpinEdit6: TDesignerSpinEdit
    Left = 40
    Top = 244
    Width = 47
    Height = 21
    AllowKeyEdit = True
    TabOrder = 5
    DisplayedInfo = pmdValue
    DisplayedPrice = pmpPrice
    ParameterName = 'ImageGap'
    VariableName = 'ImageGap'
  end
  object DesignerMemo1: TDesignerMemo
    Left = 195
    Top = 53
    Width = 253
    Height = 258
    Color = clInfoBk
    ReadOnly = True
    TabOrder = 6
    FocusColor = clBtnFace
    AutoCalculateOnExit = False
    DisplayedInfo = pmdValue
    ParameterName = 'RollPrintLayoutNotes'
    VariableName = 'RollPrintLayoutNotes'
  end
end

end

  1. Create an order.
  2. Add the product you created above to the order.
  3. Enter different sizes. Confirm that the rotation, tiling, and paneling property all work as you expect.
    • Example 1

ImageHeight = 24, ImageWidth = 12, PrintMargin = 0 MaterialWidth = 48, ImageGap = 0 Quantity = 100 Result: In this case, whether rotated or not, the image fits optimally with no wasted space. * Example 2 Change ImageGap = 1 so that now we have spacing between the images. Result: Because of the additional spacing between prints, we can only fit three across or one across (based on the rotation). Three across uses 36 inches of the roll, so this will be the optimal layout. * Example 3 ImageHeight = 22, ImageWidth = 28, PrintMargin = 0 MaterialWidth = 60, ImageGap = 0 Quantity = 100 Result: ===== Additional Thoughts ===== Some additional ways to expand the Layout functions include: * Add an option to prevent rotation. * Add additional Roll Margins to handle the fact that usually you can't print the full width of the material. * Consider Two Sided Printing. * Use the calculations to tie into the Material, Ink (for digital), Labor, etc. * Add error checking to the product. * Add the material as a Dynamic Part selection list and pull the paper width from selection list properties. * Add the material as a Dynamic Part selection list and pull the paper width from Part UDFs. * Add the machine as a Dynamic Part selection list and pull the margins from Part UDFs. ===== Source ===== Contributor: Kyle King, Cyrious Software Date: 8/10/2009 Version: Control 4.2+ ''

You could leave a comment if you were logged in.