Templates
Description
Templates are generated by using the "Templates" option. The templates option is added after the
action. The server-side path to the template is specified after "Templates".
Template parameters are added after a ? character which is appended to Templates.
Templates within Templates
See Template Compounds
Format
Templates/[path]?[parameters]
Example: Templates/MySubdirectory/MyDesign.PXF?Personalizations[0].Name=DESIGN1:Vollyball&Personalizations[0].Design=Football1.PXF
Where the [path] is specified with /MySubdirectory/MyDesign.PXF
Example: Templates/MyDesign.pxf?Personalizations[0].Name=DESIGN1:Vollyball&Personalizations[0].IsHidden=true
Will hide the element named DESIGN1:Vollyball
Example: Templates/MyDesign.pxf?ColourMatchField=Name&Personalizations[15].Name=Satin&Personalizations[15].ElementColour=Tomato Red
Will set the needle in the palette for the element named Satin based on the thread Name
Parameters
- ColourMatchField - Name/Code value specifying what to look up in the palette when assigning a colour for the Element when colourizing and Element. Default is Name.
- Personalizations - Array of personalization values.
- Personalizations have 4 parameters that can be specified:
- Name - The name of the element to be replaced in the template. This was the value used to name the element during creation of the template
- Example: A design placeholder could have a value of DESIGN1:Ball
- Example: A text placeholder could have a value of TEXT1:Bears
- Design - The placeholder value for the design being replaced in the design placeholder. Example: NewDesign.PXF
- ScaleDesign - True/False value which will determine if the replaced design is scaled to fit within the original placeholder. Default is true.
- DesignPalette[] - Array of palette colours of the design being replaced. Values are RGB sextuplets (eg. ff0000 is red). See arrays for more information about specifying array values.
- The DesignPalette[] is the palette of the design being replaced. Not the palette of the design the replaced is being set in.
- Text - The placeholder for the text element
- TextColour - The value that will be used for the text in the template
- FontOverride - The font that will override the default used in the template for text. Units are embroidery points.
- HeightOverride - The text height value that will override the default used in the template for text.
- ElementColour - The value that will be used for the element in the template. Requires Name parameter.
- TranslateX - X directional offset to move the component. Positive values are to the right. Default is 0.
- TranslateY - Y directional offset to move the component. Positive values are down. Default is 0.
- IsHidden - True/False value specifying if the named element will be removed from the final template render or generation. Default is false. Requires Name parameter.
- ScaleInserts - True/False value which will control whether a Template inserted into a Template will scale to fit within a placeholder for the design to be inserted
- ScaleInserts Note: This feature is currently only support for Template Compounds. See Template Compounds
- DesignElementName - The name of the element to be colourized in the design. This was the value used to name the element during creation of the design
- DesignElementColour - The value that will be used for the element in the design. Requires DesignElementName parameter.
- DesignElementTranslateX - X directional offset to move the design component during insert. Positive values are to the right. Default is 0.
- DesignElementTranslateY - Y directional offset to move the design component during insert. Positive values are down. Default is 0.
- ScaleText - The scale value that will be applied to the text element within the final design. Default is 0.
- ScaleText Note: Global value for ScaleAllText will override this value set on a single text element
- IsRainbowText
- true or false. Default is false
- The Rainbow text feature is a way to instantly create multi-colored text in a design. The Rainbow text inserts a color change at the end of each letter in the selected text, and the next color is chosen randomly from the threads in the active palette
- RainbowColors - Array of rainbow color values.
- RainbowColors can only be set if the parameter IsRainbowText is set to true
- For each of the RainbowColors, there are 2 parameters that have be specified and 2 parameters that are required but conditional on each other:
- Name - The Name of the Thread Color to be set for the first color of the text
- Code - The Code of the Thread Color to be set for the first color of the text
- RGB - The Red, Green and Blue value of the Thread Color. Format is: 000,111,222. This is required only if the Hex parameter is not set
- Hex - The Hex value of the color that will be converted to an RGB value. Format is below. 6 characters in length. This is required only if the RGB parameter is not set
- Hexadecimal uses sixteen distinct symbols, in the case of css color the symbols 0–9 to represent values zero to nine (obviously), and A, B, C, D, E, F to represent values ten to fifteen. So, using one Hexadecimal character you can represent 16 values. With two Hexadecimal you can represent 256 (16*16) values.
- In RGB you have colours represented by Red Green Blue (R=0-255, G=0-255, B=0-255), so we use 3 pairs of Hexadecimal symbols! So when you see an RGB color, you can make the calculation below.
- Example:
- Hex: #4C8ED5 is RGB: 76, 142, 213.
- Because 4C = 76(Red), 8E = 142(Green), D5 = 213(Blue)
- If you wanted to specify 2 personaliztion items, one for the design element and one for a text item, then you would use:
- Personalizations[0].Name=DESIGN1:Vollyball&Personalizations[0].Design=Football1.PXF&Personalizations[1].Name=TEXT1:Bears&Personalizations[1].Text=TEXT1&Personalizations[1].TextColour=Black
- StandardPalette - Allow color choices to reference externalized color palette. The final design will contain the entire external palette with the sequence updated to reflect the replaced standard palette
- ScaleAllText - The scale value that will be applied to all text elements within the final design. Default is no scale.
- UseConsistentCompression - True/False value that will consistently compress all lines of text to the return the MaxCompression of the longest text. Default is false.
- Threads - Array of Thread Color values in the template. See arrays for more information about specifying array values.
- Threads Note: Threads specified will be replaced anywhere they are referenced in the template.
- Threads have 7 parameters that can be specified:
- Name - The name of the Thread Color to be replaced in the template.
- Code - The code of the Thread Color to be replaced in the template.
- Manufacturer - The manufacturer of the Thread Color to be replaced in the template.
- Thickness - The thickness of the Thread Color to be replaced in the template. Default is 3.
- Red - The Red value of the Thread Color to be replaced in the template. Number from 0-255. Default is 0.
- Green - The Green value of the Thread Color to be replaced in the template. Number from 0-255. Default is 0.
- Blue - The Blue value of the Thread Color to be replaced in the template. Number from 0-255. Default is 0.
- UpdateThreadsOnStart - True/False value that will replace the Thread Color values on processing start if set to true, before the personalizations, or on processing end, after the personalizations, if set to false. Default is false.
- UpdateThreadsOnStart Note: Only active when specified along with Threads parameters. Useful when a personalization will reference a replaced Thread Color, otherwise it may not be available on processing start.
-
Needles[] - Array of needle indices. Values are 0-based indexes into the final palette, on processing end, after the personalizations.
See arrays for more information about specifying array values.
Example
The following loads the server-side design "EmojiBubble.PXF", replaces the design element Mascot with a new design
and updates the text values for Text1 and Text2 as well as the colour for both.
/Render/Templates/EmojiBubble.PXF?Personalizations[0].Name=Mascot&Personalizations[0].Design=Emoji.PXF&Personalizations[1].Name=Text1&Personalizations[1].Text=PULSE&Personalizations[1].TextColour=1146+-+Flame+Red&Personalizations[1].IsRainbowText=False&Personalizations[2].Name=Text2&Personalizations[2].Text=MICRO&Personalizations[2].TextColour=1460+-+Ecru&Personalizations[2].IsRainbowText=False