Oasys.PRIMER.Utils class¶
Static methods¶
- classmethod Utils.Build()¶
Returns the build number
- Returns:
integer
- Return type:
int
Example
To get the current build number
build = Oasys.PRIMER.Utils.Build()
- classmethod Utils.CallPromiseHandlers()¶
Manually call any promise handlers/callbacks in the job queue
- Returns:
no return value
- Return type:
None
Example
To run any queued promise handlers/callbacks:
Oasys.PRIMER.Utils.CallPromiseHandlers()
- classmethod Utils.CheckinLicense(feature)¶
Checks a license for a feature back in
- Parameters:
feature (string) – feature to check license back in for
- Returns:
no return value
- Return type:
None
Example
To check in a license for “EXAMPLE”:
Oasys.PRIMER.Utils.CheckinLicense("EXAMPLE")
- classmethod Utils.CheckoutLicense(feature)¶
Checks out a license for a feature
- Parameters:
feature (string) – feature to check license for
- Returns:
True if license available, False if not
- Return type:
bool
Example
To checkout a license for “EXAMPLE”:
got = Oasys.PRIMER.Utils.CheckoutLicense("EXAMPLE") if got == False: Oasys.PRIMER.Exit()
- classmethod Utils.GarbageCollect()¶
Forces garbage collection to be done. This should not normally need to be called but in exceptional circumstances it can be called to ensure that garbage collection is done to return memory
- Returns:
no return value
- Return type:
None
Example
To force garbage collection to be done:
Oasys.PRIMER.Utils.GarbageCollect()
- classmethod Utils.GetLSDYNAVersions()¶
Returns a list of all LS-DYNA output version names available in PRIMER
- Returns:
A list of LS-DYNA version names
- Return type:
list
Example
To get all LS-DYNA version names in PRIMER and set the output version to the latest version:
versions = Oasys.PRIMER.Utils.GetLSDYNAVersions() latest = len(versions)-1 Oasys.PRIMER.Options.dyna_version = versions[latest]
- classmethod Utils.HTMLBrowser()¶
Returns the path to the default HTML browser
- Returns:
string of the path
- Return type:
str
Example
To get path to the default HTML browser
path = Oasys.PRIMER.Utils.HTMLBrowser()
- classmethod Utils.HiResTimer()¶
A high resolution timer that can be used to time how long things take. The first time this is called the timer will start and return 0. Subsequent calls will return the time in nanoseconds since the first call. Note that the timer will almost certainly not have 1 nanosecond precision but, depending on the platform, should should have a resolution of at least 1 microsecond. The resolution can be found by using
Utils.TimerResolution()
Example
To time how long something takes to nanosecond precision:
start = Oasys.PRIMER.Utils.HiResTimer() #do something that takes some time... end = Oasys.PRIMER.Utils.HiResTimer()
- classmethod Utils.PdfReader()¶
Returns the path to the executable of the default pdf reader
- Returns:
string of the path
- Return type:
str
Example
To get path to the default pdf reader
path = Oasys.PRIMER.Utils.PdfReader()
- classmethod Utils.TimerResolution()¶
Returns the resolution (precision) of the
Utils.HiResTimer()
timer in nanosecondsExample
To find the resolution of the timer in nanoseconds:
resolution = Oasys.PRIMER.Utils.TimerResolution()
- classmethod Utils.Version()¶
Returns the version number
- Returns:
real
- Return type:
float
Example
To get the current version number
version = Oasys.PRIMER.Utils.Version()