Create or Open a Sheet Set Database

To use Sheet Set Manager objects, you must use an AcSmSheetSetMgr object and one or more AcSmDatabase objects (DST files).

After you create an AcSmSheetSetMgr object, you can use the CreateDatabase method to create an AcSmDatabase object. Specify a file name with a DST extension. Alternatively, you can use the OpenDatabase method to open an existing database. You can also access databases that are currently open. Use the GetDatabaseEnumerator method to obtain an enumerator that provides access to the list of open databases. You can retrieve a specific open database using the FindOpenDatabase method.

In order to make changes to a database, it must be locked using the LockDb method. Any changes you make can be saved or rolled back using the UnlockDb method. UnLockDb has a Boolean commit parameter that controls this behavior. If the value of the commit parameter is true, then the changes will be written to the file. If you pass in false for the commit parameter, the changes will be rolled back or undone by reloading the database from disk.

Warning: When you unlock without commiting changes, the database is reloaded, all object instances in the database are cleared, and new objects are created as the database is read in. This means that any pointers to database-resident objects are invalid after the database has been reloaded. If you need to access database-resident objects across lock and unlock boundaries, you should store the object ID instead of a direct pointer to the object. The object ID (IAcSmObjectId) provides a means of safely referencing an object within the sheet set database. You can retrieve the object ID of any database resident object by calling the GetObjectId method on the object. Conversely, you can get the associated object instance from an ID by calling the GetPeristentObject method.