Encapsulates the user defined interface to command history.
#include <AlCommand.h> class AlCommand : public AlObject AlCommand(); virtual ~AlCommand(); 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 );
This file contains the definitions required to define an user command history command.
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, or patch.
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::remove is used to remove a command type from the database.
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 does the actual command. Finally the result is added to the Alias system using the ’install’ method.
The Alias messaging system will call the various functions in the command to maintain the dependencies and re-execute the command if necessary.
Turns command history debugging on (TRUE) or off (FALSE). Alias will write information into the errlog as the construction history plug-in runs if this boolean is set.
< on - the new value of command history debugging
sSuccess - setting worked
Constructor for a command wrapper.
Destructor for a command wrapper.
Returns kCommandType.
Safe downcast to AlCommand.
Returns a pointer to the user command.
Returns the value of the result from the last execution of the command. Returns -1 if this command is invalid.
Allocates a new user defined command history command.
< name - the name of the command to create
sSuccess - method was successful
sInvalidArgument - name was NULL
sObjectNotFound - the command name was not found (undefined)
sFailure - not enough memory or user constructor failure
Deletes the command (also calls the user command destructor)
sSuccess - the command was deleted
sInvalidObject - the command was invalid
Gets the type of surface produced by the given command.
Marks this command as being modified.
sInvalidObject - the command was invalid
sSuccess - the command was marked as being modified
Sets the type of surface produced by the given command.
< type - type of surface to be produced by the given command
sSuccess - setting was successful
sInvalidArgument - type was neither kSurfaceSpline nor kSurfacePolyset
sInvalidObject - the command was invalid
Installs a command in the construction history list.
sInvalidObject - the command was invalid
sSuccess - the command was installed
sFailure - the command was already installed
Remove a command from the construction history list.
sInvalidObject - the command was invalid
sSuccess - the command was uninstalled
sFailure - the command was not installed
Executes the command after it has been created. Do not directly call the execute command in the user command, but use this function instead.
< freeIfInvalid - the command is freed if it is found to be invalid
zero - command was successful
negative number - the command is no longer valid
positive number - the command did not succeed (the number returned is the error return value)
Undoes the command after it has been created. Do not directly call the undo command in the user command, but use this function instead.
< freeIfInvalid - the command is freed if it is found to be invalid
zero - command was successful
negative number - the command is no longer valid
positive number - the command did not succeed (the number returned is the error return value)
Adds the construction history command to the list of available commands.
func - name of the function that will allocate the new AlUserCommand
name - string name of the function
sFailure - another command with the same name already exists
sInvalidArgument - func is NULL or name is NULL
sInsufficientMemory - could not allocate memory for new function
sSuccess - the add was successful
Deletes the construction history command.
name - string name of the function
sFailure - command not found
sInvalidArgument - name is NULL
sSuccess - command was removed