#include <AlCommand.h>
class AlCommand : public AlObject
AlCommand();
virtual ~AlCommand();
AlCommand* asCommandPtr();
virtual statusCode deleteObject();
virtual AlObjectType type() const;
statusCode create( const char *name );
statusCode install();
statusCode uninstall();
statusCode modified();
int execute( boolean freeIfInvalid = TRUE );
int undo( boolean freeIfInvalid = TRUE );
AlSurfaceType surfaceType() const;
statusCode setSurfaceType( AlSurfaceType );
AlUserCommand* userCommand();
int status() const;
static statusCode setDebug( boolean on );
static statusCode add( AlUserCommandAlloc *, const char *name );
static statusCode remove( const char *name );
The command layer in Alias is a software layer that is between the user interface and the main application. A command is an object that represents actions such as: fillet, square, patch or boundary.
The user interface code builds commands that are sent through the layer to be executed. The user interface does not create geometry itself, it creates commands that do it.
Commands can be saved somewhere and re-executed whenever the system feels it is necessary. As long as the data the command depends upon is valid, the command remains valid.
The most practical application of re-executing a command is the generation of data from a piece of source geometry. When the original geometry changes, the new model can be 'automatically' created by re-executing the command history on the new data.
Command functions: These are outlined in the AlUserCommand class.
A `constructor' DAG node is considered to be a DAG node which creates the result. An example of a constructor is one of the original curves in a fillet operation.
A `target' DAG node is considered to be the result of a command operation. An example is the fillet created by the fillet command.
The 'AlCommand' class is used to maintain a list of the current plug-in defined command history commands. New commands are installed using the 'AlCommand::add' method. This associates a string with a function that allocates a new copy of a command. The first parameter of the add command is a AlUserCommandAlloc. An AlUserCommandAlloc is a pointer to a function returning an AlUserCommand class as defined below.
typedef AlUserCommand *AlUserCommandAlloc();
AlCommand::create is used to create an new copy of the command. After a command has been created, its data fields can be accessed using the 'AlCommand->userCommand' method.
A command has two components, the UI driver and the underlying geometry manipulation code. The UI creates a new command using AlCommand::create. The private data is accessed using the AlCommand->userCommand method (which is typecast to the plug-in's derived command). From this, the command data structure's fields can be filled in. The UI uses the execute method to call the userCommand's execute command. This performs the actual command. Finally the result is added to the Alias system using the 'install' method.
The Alias messaging system will automatically call the various functions in the command to maintain the dependencies and re-execute the command if necessary.
sInvalidArgument - name was NULL
sObjectNotFound - the command name was not found (undefined)
sFailure - not enough memory or user constructor failure
sInvalidObject - the command was invalid
sSuccess - the command was marked as being modified
sSuccess - the command was installed
sFailure - the command was already installed
sSuccess - the command was uninstalled
sFailure - the command was not installed
Negative number if the command is no longer valid.
Positive number if the command didn't succeed, the number is then the error return value.
Negative number if the command is no longer valid.
Positive number if the command didn't succeed, the number is then the error return value.
name - string name of the function
sInvalidArgument - func is NULL or name is NULL
sInsufficientMemory - could not allocate memory for new function
sSuccess - the add was successful
sInvalidArgument - name is NULL
sSuccess - command was removed