Execution of a custom command requires an instance of an OdEdBaseIO object. The OdEdBaseIO subclass must override the OdEdBaseIO::getString and OdEdBaseIO::putString pure virtual functions. These functions provide the base level input and output functionality required by the custom command object. OdEdUserIO provides a richer set of input and output functions (for reading integers, doubles, etc.).
The next step is to create an OdDbCommandContext object that will be passed to the execute method of the desired OdEdCommand, and then to invoke the command from the global command stack. For example:
// Create the command context with an OdEdBaseIO subclass, and an OdDbDatabase. OdDbCommandContextPtr pCmdCtx = OdDbCommandContext::createObject(pMyOdEdBaseIO, pDatabase); // Retrieve the global command stack. OdEdCommandStackPtr pCommands = ::odedRegCmds(); // Execute the registered command with the global name "CustomCommand" pCommands->executeCommand("CustomCommand", pCmdCtx);
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|