A selection type is defined by a few methods:

  • Size This returns the packet size in bytes. The selection system itself will handle memory management. In general the packet should be as small as possible.

  • Flags The flags give information about the selection type. If UNDOABLE is set then the selection will be managed as part of the undoable model state.


class ILxSelectionType

The types of entities that can be selected are determined by the extensible ILxSelectionType interface. Individual selections themselves are defined as opaque packets which are allocated and managed by the selection system. For extracting specific information about the selection, the selection type can provide an alternate packet translation interface.

Public Functions

unsigned int Size(LXtObjectID self)

  • MessageTable This returns the name of the message table for the selection type. The message table will be used to find user messages for the selection type.

  • Compare This method compares two packets and returns a ranking using the same sign logic as strcmp(). This is used to sort packets and to search on packets.

  • SubType This returns the subtype of the packet. For selections that can contain heterogenous elements this should be non-zero, while for selections where all the elements are the same this should be zero.

unsigned int Flags(LXtObjectID self)
const char *MessageTable(LXtObjectID self)
int Compare(LXtObjectID self, void *pkey, void *pelt)
unsigned int SubType(LXtObjectID self, void *pkt)
bool fromType(const char *name)

User Class Only: User methods allow the selection type wrapper to be initialized given the name or type code for a selection type.

bool fromType(LXtID4 type)


class ILxSelectionListener

Public Functions

void Current(LXtObjectID self, LXtID4 type)

  • ADD when elements are added to a selection list.

  • REMOVE when elements are removed from a selection list.

  • CURRENT when a new list is put on top of the stack making it current. The subType for this event is always zero.

  • IMPLICIT when a new type is put on top of the implicit stack. The subType for this event is always zero.

  • TIME_PRE Sent before the internal time is checked and updated, this allows clients to prepare for possible time changes if needed.

  • TIME when the current time is altered.

  • TIMERANGE when any of the specific time ranges is altered. The type is included in the notification data. The ILxSelectionListener interface allows SDK clients to listen to the global selection events. These are just methods that the client defines that we will call to signal change events.

void Add(LXtObjectID self, LXtID4 type, unsigned int subtType)
void Remove(LXtObjectID self, LXtID4 type, unsigned int subtType)
void Time(LXtObjectID self, double time)
void TimeRange(LXtObjectID self, LXtID4 type)


class ILxSelectionService

This service has the same GUID as the old SelectionStack interface. They have the same second and third methods, which are all that were ever used in plug-ins, so we should be good for backwards compatibility.

Public Functions

LxResult ScriptQuery(LXtObjectID self, void **ppvObj)

The selection system is wrapped by a selection service interface for reading and altering the selection state. The ILxSelectionService interface has the obligatory SQ method, and some basic methods to read the current state of the selection by type.

int Count(LXtObjectID self, LXtID4 type)
void *ByIndex(LXtObjectID self, LXtID4 type, unsigned int idx)
void *Recent(LXtObjectID self, LXtID4 type)
LxResult Test(LXtObjectID self, LXtID4 type, void *packet)
LXtScanInfoID ScanLoop(LXtObjectID self, LXtScanInfoID scan, LXtID4 type, void **packet)
LXtScanInfoID ScanLoopCurrent(LXtObjectID self, LXtScanInfoID scan, LXtID4 type, void **packet)
LxResult Select(LXtObjectID self, LXtID4 type, void *packet)

Editing the selection can be done selecting or deselecting, removing packets from all selections, and manipulating the batch state.

LxResult Deselect(LXtObjectID self, LXtID4 type, void *packet)
LxResult Remove(LXtObjectID self, LXtID4 type, void *packet)
LxResult Toggle(LXtObjectID self, LXtID4 type, void *packet)
LxResult Drop(LXtObjectID self, LXtID4 type)
LxResult StartBatch(LXtObjectID self)
LxResult EndBatch(LXtObjectID self)
LxResult AbortBatch(LXtObjectID self)
const char *LookupName(LXtObjectID self, LXtID4 type)

These methods allow clients to look up name-type associations and to allocate our own instances of the packet interface.

LXtID4 LookupType(LXtObjectID self, const char *name)
LxResult Allocate(LXtObjectID self, const char *name, void **ppvObj)
double GetTime(LXtObjectID self)

These methods allow clients to read and set the current time.

LxResult SetTime(LXtObjectID self, double time)
LxResult Clear(LXtObjectID self, LXtID4 type)

This is like Drop() but doesn’t change the current selection mode.

int State(LXtObjectID self, LXtID4 type, void *packet)

This is similar to Test(), but returns the actual selection state for the element. State can have one or more of the LXf_SELECTION_* bits set, or be LXf_SELECTION_NONE.

LXtID4 CurrentType(LXtObjectID self, const LXtID4 *types)

This returns the most recent selection type the one the user acted on last. If ‘types’ is non-null, it will be an array of types terminated with zero, and the type returned will be one of the ones in the list.

LxResult CurrentSubTypes(LXtObjectID self, LXtID4 type, unsigned *sub, unsigned len, unsigned *num)

This returns the list of current subtypes into the client’s array. If the number of current subtypes is laarger than the length of the buffer then SHORTBUFFER is returned.

bool GetImplementation(const char *name, CLxLoc_SelectionType &sel)

User Class Only: Nicer ways to get a selection type implementation in C++.

bool GetImplementation(LXtID4 type, CLxLoc_SelectionType &sel)
LxResult GetSubtypeList(LXtID4 type, std::vector<unsigned> &subTypes)

User Class Only: User class gives a nice wrapper method for getting the array.

typedef void *LXtScanInfoID

Clients can also enumerate packets in sequence, which may be more efficient than accessing them by index for loops that want to hit everything. ScanLoop() gets all elements of the given type, while ScanLoopCurrent() gets only those that match the current subtypes.








class ILxSelectionPacket1Service

Public Functions

LxResult ScriptQuery(LXtObjectID self, void **ppvObj)

This is a legacy service global that implements a subset of the monolithic service. Since we used it in the old wrappers we need to allow queries to succeed.

const char *LookupName(LXtObjectID self, LXtID4 type)
LXtID4 LookupType(LXtObjectID self, const char *name)
LxResult Allocate(LXtObjectID self, const char *name, void **ppvObj)