To automate your custom stencil scripts, it is necessary to use the StencilCreationScript interface.
Here is a link to see all details for your implemention manual.
You have to set public porperties to give user options to change in the property grid, there is also a method to create the preview and the pads. You should fill the corde with all calculation you need e.g.
public bool CreatePads(IPCBIWindow parent, IStep step, IODBLayer StencilLayerOutput, InterfaceCMPObject BasicObjects, List<IPolyClass> UsedPinPads, List<IPolyClass> MaskForCheck, List<IPolyClass> Drills, double ThicknessPaste)
{
if (StencilLayerOutput == null || BasicObjects == null || UsedPinPads.Count == 0)
return false;
bool IntersectWithMask = false;
CreateRectangleElement(StencilLayerOutput, UsedPinPads, MaskForCheck, Drills, BasicObjects, out IntersectWithMask);
return true;
}
In the options area (1) you can add your custom developed scripts (2).