IUDMExtension Methods
All methods are the same as the methods in the C UDM implementation. The changes to the methods signatures are just to conform to the Python style.
Mandatory Methods
These methods must be implemented in the UDM Python script as methods of UDMExtension class.
GetInfo()
- returns UDMInfo object populated with appropriate UDM information.
IsAttachedToExternalEditor()
- returns True if UDM dll is attached to external editor.
- In case of python UDMs, this should typically return False
CreateInstance(funcLib)
- funcLib is UDMFunctionLibrary
- returns UDMParameters.
GetUnits(instanceId)
- instanceId is an integer.
- returns string containing units for the instance.
Refresh(funcLib, udmInParams, updatedParams, refreshModifiedPartsOnly, nonEditedPartRefIds )
This method is called every time a UDM is refreshed. Geometry creation/refresh should happen in this method.
- funcLib is UDMFunctionLibrary
- udmInParams is a list of UDMParameters that comes from desktop
- updatedParams: UDM script can change the UDM parameters it receives. Updated parameters need to be sent back to desktop. If the UDM script is not going to change any of the parameters that it received, it needs to copy udmInParams to updatedParams.
- refreshModifiedPartsOnly is a Boolean
Supporting this flag is optional. For UDMs where the refresh performance is not an issue, it is recommended to ignore this flag and update all parts every time.
This flag can be used to optimize performance of Refresh method when the model created by UDM is large. If the UDM consists of multiple parts, and new parameters change only a few parts amongst them, UDM script can only modify parts that are changed by the new parameters.
- nonEditedPartRefIds: If RefreshModifiedPartsOnly is true and the UDM script supports partial update, Refresh method needs to return ids of parts that are unchanged.
returns True on success, False on failure.
ReleaseInstance(instanceId)
- instanceId is an integer.
- This should release any resources assigned to this particular instance of UDM.
- returns True on success, False on failure.
GetAttribNameForEntityId()
- Returns string that acts as a the name of the attribute containing entity IDs.
- For example, it can return a unique string such as "ATTRIB_XACIS_ID"
- Python UDMs should implement this method.
GetAttribNameForPartId()
- Returns a string that acts as a the name of the attribute containing entity IDs.
- For example, it can return a unique string such as "ATTRIB_XACIS_ID" (Can be same as GetAttribNameForEntityId())
- Python UDMs should implement this method.
Optional Methods
These methods have default implementations (default is to return NULL or FALSE depending on the return type) but can be overridden by the user as needed as methods of UDMExtension class.
DialogForDefinitionOptionsAndParams(self, defData, optData, params):
Replaces the old UDMDialogForDefinitionAndOptions method, which is still supported, but users are urged to use UDMDialogForDefinitionOptionsAndParams. If both methods are present, application will use UDMDialogForDefinitionOptionsAndParams.
- UDM can open a dialog box for UDM definition, options, parameters in this method. Definition, options, and parameters are set/modified by user and returned to application. Dll can also just give default definition, options and parameters.
- Returns two Booleans and a string
- First Boolean returns whether the method was successful or not.
- Second Boolean returns whether the application should open a dialog box. If it is True, application will populate a dialog box with definition, options, parameters that are returned.
- String returned contains length units for parameters.
DialogForDefinitionAndOptions(self, defData, optData) [Deprecated]
UDM can open a dialog box for UDM definition and options in this method. Definition, and options are set/modified by user and returned to application. Dll can also just give default definition and options.
- Returns two Booleans.
- First Boolean provides whether the call to this method was successful or not.
- Second Boolean determines whether the application should pop up a dialog box. If this is true, application will populate the dialog box with the definitions and options that are returned. As no parameters are returned, no parameters are shown in this dialog box.
GetInstanceSourceInfo(instanceId)
- instanceId is an integer.
- returns string containing source information of UDM instance. It is used to create initial name for UDM instance.
ShouldAttachDefinitionFilesToProject()
- returns True if any of definition files needs to be attached to project
- returns a Python list of strings containing definition names of files or NULL