- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
HFSS15: Data Types Used in Python Script
There are several types that you must use while authoring the python script. Some of them are used to pass data from UI to python script and to provide interface for working with this data. Some are used to pass data from python script to UI.
To pass data from python script to UI the objects of the C# class must be created in python script using their C# constructors. Then they can be set as functions return values or set to the output parameters using their API.
Constants class
kTraceTypeStr : string constant used to specify an input of trace type
kSolutionTypeStr : string constant used to specify an input of solution type
kNumberTypeStr : string constant used to specify an input of number type
kTextTypeStr : string constant used to specify an input of text type
kBoolTypeStr : string constant used to specify an input of boolean type
kStandardReportStr : string constant to specify a standard report
kEyeDiagramReportStr : string constant to specify an eye diagram report
kUserDefinedReportStr : string constant to specify a user defined report
kSweepDomainStr : string constant to specify the sweep domain
kTimeDomainStr : string constant to specify the time domain
UDDInputParams class
The objects of this class must be created in python script in the GetUDDInputParams() function and the SetUDDInputParams() function.
Attributes :
Input Name (string)
Input Description (string)
Input Type ( Can be Boolean, Number, Text, Trace or Solution) (string)
BoolData (boolean)
DoubleData (double)
TextData (string)
ReportType (string)
SolutionName (string)
DomainName (string)
Constructors:
UDDInputParams(string name, string description, string type)
UDDInputParams(string name, string description, string type, bool data)
UDDInputParams(string name, string description, string type, double data)
UDDInputParams(string name, string description, string type, string data)
UDDInputParams(string name, string description, string type, string reportType, string solutionName, string domainName)
Property Accessors :
Name : Get/Set the name of an input
Description : Get/Set the desccription of an input
Type : Get/Set the type of an input
BoolData : Get/Set the data of a boolean input
DoubleData : Get/Set the data of a number input
TextData : Get/Set the data of a text input
ReportType : Get/Set the report type
SolutionName : Get/Set the name of the solution
DomainName : Get/Set the name of the domain
IProgressMonitor Abstract Class
The object of this class is a progress monitor. It is used to display calculations progress in UI and check is the user has requested an abort of the computation.
When displayed in the application, each progress message has four items:
A task name
A sub-task name
The progress amount
A button to abort the task in progress.
All of this functionality and abort interaction is achieved using the following functions.
SetTaskName (string taskName):
SetSubTaskName (string subTaskName)
BeginTask (string name)
SetTaskProgressPercentage(int progressPercent)
CheckForAbort(): If the quantities being generated are computationally expensive, the UDO author can periodically call this method and then call EndTask with Fail and return False.
EndTask (bool passFail)
Example:
progMon.BeginTask("Process DQS")
progMon.SetSubTaskName("Compute UI segments")
progMon.SetTaskProgressPercentage(33)
progMon.SetSubTaskName("Compute the rest")
progMon.SetTaskProgressPercentage(100)
progMon.EndTask(True)