Engine Customization
Custom FEFCO Types
While PackCPQ supports standard FEFCO styles (like 0201 shippers or 0427 mailers) out-of-the-box, you can easily register custom parametric boxes, carton folders, or custom creasing layouts directly in the self-hosted engine.
1. The Template Interface
To register a custom design, create a struct implementing the CalculateFlatArea and GetScoringLines interfaces:
// fefco_custom_mailer.go
package templates
import "github.com/alanvihan/packcpq/engine/types"
type CustomMailer struct {
Length float64 `json:"length"`
Width float64 `json:"width"`
Depth float64 `json:"depth"`
Flute float64 `json:"flute_caliper"`
}
func (c *CustomMailer) CalculateFlatArea() float64 {
// Length-way flat layout sizing sheet
flatLength := (2.0 * c.Length) + (4.0 * c.Depth) + (6.0 * c.Flute)
// Width-way flat layout sizing sheet
flatWidth := c.Width + (2.0 * c.Depth) + (4.0 * c.Flute)
return flatLength * flatWidth
}
func (c *CustomMailer) GetScoringLines() []types.ScoreLine {
return []types.ScoreLine{
{Position: c.Depth + (2.0 * c.Flute), Type: "Crease"},
{Position: c.Depth + c.Length + (4.0 * c.Flute), Type: "Crease"},
}
}2. Compiling the Engine Core
Place your custom stubs inside the /custom/templates/ directory of your local repository and run compilation diagnostics:
$ make compile-custom-templatesCAD Integration Notice
Enterprise license holders can upload DXF or CF2 raw CAD blueprints directly. The calculation engine will auto-extract perimeter score lines and board area mappings, bypassing the need to code custom calculations.