In this topic:
Schematic template scripts are a method of performing advanced netlist processing. The TEMPLATE property can be used to customise the netlist entry for a device and it has a number of features that allow quite complex devices to be created. However, the template syntax is not as powerful as a full featured programming language and this makes more complex devices very difficult to implement.
To overcome this the template script feature was developed. With this method a script is called during the netlist generation phase for every instance that possesses a TEMPLATESCRIPT property. A script can then generate the netlist entry for that instance. With this method there is no limit to the complexity of generated devices.
To use the template script feature, the schematic symbol must specify the script to be called. This can be done in one of two ways:
If both TEMPLATESCRIPT_TEXT and TEMPLATESCRIPT are defined, TEMPLATESCRIPT_TEXT takes precedence.
The template script is called for each instance just before its netlist entry is generated. The REF property of the instance is passed to the script as an argument along with the name of the property used for the template. The script controls the netlist output by calling the TemplateSetValue command.
The most important command is TemplateSetValue. This is what you must use to define the netlist entry. The value supplied to this command defines the template that will be used to create the netlist entry. It can of course provide a completely literal netlist line, but more usually some template keywords would be used.
This a brief summary. See the entries in the reference pages for more details.
Performs the same process that is usually done on a template property except that is uses the template that you supply as an argument not the device's template. ref is the REF property of device being processed.
Returns the value of the property prop. You should use this function not PropValues to get at property values. It is faster than PropValues() but won't work in regular scripts.
Edits a property's value. Like TemplateGetPropValue it is much faster than the regular commands but only works in a template script. Note that this command records an instruction to edit a property's value but the instruction will not be actioned until the netlist operation has completed.
Changes the value of the template used to create the netlist line currently being compiled. Does not change the template property itself.
◄ Non-interactive and Customised Printing | Creating and Modifying Toolbars ▶ |