Use the ConvertLuaScript utility to migrate legacy CADFEKO Lua scripts to the latest CADFEKO API format.
Migration is only applicable to CADFEKO Lua scripts created prior to version 2022.1 (it is not applicable to POSTFEKO scripts).
Command line options:
ConvertLuaScript.exe [-h] [--directory DIRECTORY] [--filename FILENAME]
Options:
--directory DIRECTORY
Directory or path containing the Lua files which use legacy CADFEKO syntax that should be converted. All files with a '*.lua' extension will be converted in the selected path and all subdirectories below this path will be processed. Files with a *.lua_backup extension will be ignored and not overwritten.
--filename FILENAME
Filename (absolute or relative path) of a Lua file using legacy CADFEKO syntax that is to be converted.
The following is a list of the CADFEKO API changes (but not limited to):
For the CADFEKO namespace, changed the function .GetApplication() to .getInstance().
For example, change the legacy API from:
app = cf.GetApplication()
to
app = cf.Application.getInstance()
When simplifying geometry, geometry parts are now added as a ChildReferences list to the properties table.
For example, change the legacy API from:
geomCollection = {geometryObject[1], geometryObject[xx]}
for xx = 1, #geomCollection do
project.Geometry:Simplify(geomCollection[xx],properties)
end
to
properties.ChildReferences[1] = geometryObject[1]
properties.ChildReferences[xx] = geometryObject[xx]
arraySimplified = project.Contents.Geometry:Simplify(properties)
For sources (current source, FEM modal source, voltage source and waveguide source), and loads (complex, series, Touchstone and SPICE circuit), the property Terminal changed to Port.
For example, change the legacy API from:
properties.Terminal = project.Contents.Ports[portLabel]
to
properties.Port = project.Contents.Ports[portLabel]
The SParameter object now has the property PortProperties. As a result, the following properties of PortProperties:
must migrate to the new CADFEKO API.
For example, change the legacy API from:
properties = cf.SParameterConfiguration.GetDefaultProperties()
properties.PortProperties[portElement].Impedance = "50"
properties.PortProperties[portElement].Terminal = project.Ports[portLabel].Terminal
to
properties = cf.SParameterConfiguration.GetDefaultProperties()
properties.SParameter.PortProperties[portElement].Impedance = "50"
properties.SParameter.PortProperties[portElement].Terminal =
project.Contents.Ports[portLabel]
Added a global collection for frequency, sources, loads and power specified globally. For example, GlobalFrequency, GlobalSources, GlobalLoads and GlobalPower.
For example:
properties = cf.VoltageSource.GetDefaultProperties()
properties.Terminal = project.Ports["Port1"].Terminal
properties.Label = "VoltageSource1"
voltageSource1 =
application.Project.Contents.SolutionConfigurations.GlobalSources:AddVoltageSource(properties)
If you have any questions, please contact Altair support.