AssemblySelection Object
- Last UpdatedJan 03, 2024
- 1 minute read
The purpose of this object is to expose element selections made in the Assembly Planning GUI back to PML. The object is defined as a PMLNet object and thereby requires the following to be used in PML.
import 'Aveva.Marine.AssemblyPlanning.Utilities'
using namespace 'Aveva.Marine.AssemblyPlanning.Utilities'
The methods ‘Assemblies’ and ‘Parts’ reflects current selections made in Assembly Planning by returning database references for elements selected. The object also provides an event mechanism to announce when the current selection has changed.
|
ASSEMBLYSELECTION |
|
|
ASSEMBLYSELECTION |
Default constructor. |
|
ASSEMBLYSELECTION(STRING) |
Constructor to name the object (required for the event mechanism to operate properly). |
|
PARTS |
Array of parts elements currently selected. |
|
ASSEMBLIES |
Array of assemblies currently selected. |
|
ADDEVENTHANDLER(STRING eventName, ANY object, STRING methodName) |
Adds an event handler that will invoke at changed selections in Assembly Planning GUI. |
|
REMOVEEVENTHANDLER(STRING eventName, REAL handle) |
Remove an event handler. |
|
REMOVE |
Unregister a named object as target for event handling. Recommended when no longer needed to ensure unnecessary invocation of event handlers. |
Example
Suppose "!this" is represented by a PML form in which we need to know current selections as they are changed in Assembly Planning GUI.
!o = object AssemblySelection('MyObjectName')
!h = !a.addeventhandler('AssemblySelectionEvent', !this, 'myHandler')
Where
define method .myHandler(!array is ARRAY)
!a = !o.assemblies() (well "!o" not global, but…)
!p = !o.parts()
if (!a.empty().not()) then
!assembly = !a[1].dbref()
endif
if (!p.empty().not()) then
!part = !p[1].dbref()
endif
endmethod
Then later before closing "!this" form.
!o.removeeventhandler('AssemblySelectionEvent', !h)
!o.remove()