Modules | Classes
Design History

Design history is a mechanism for recording changes to a design file. More...

Modules

 Design History C Api
 

Classes

class  DesignHistory
 Provides access to the design history of a specified file. More...
 
class  DesignHistoryRestore
 

Detailed Description

Design history is a mechanism for recording changes to a design file.

Replicates historical changes.

To create and query history, use the Design History C Api class.

To replicate historical changes, use the DesignHistoryRestore class.

For code samples, see DesignHistory Code Samples.

DesignHistoryRestore modifies a file in order to make the elements in that file match a selected historical state. To do this, DesignHistoryRestore reads the information stored in history revisions and uses this information to decide with elements in the file must be deleted, modified, or recreated. To modify or recreate an element, DesignHistoryRestore copies a saved image of the element from a revision into the file that is to be restored.

DesignHistoryRestore actually produces a new state in the target file. That contents of the new state just happen to match the contents of the selected historical state. So, if you were to call DesignHistory::Commit after restoring a revision, you would create a new revision in the file.

Selective vs. Non-Selective Restore

The #Restore function can either restore all affected elements in the file or just selected elements. Selective restore uses mdlElmdscr_copy to copy selected elements from a restored copy of the file to the target file. Non-selective restore applies the restore logic directly to the target file and does not call mdlElmdscr_copy.

Restoring Reference Attachments

A Reference Attachment is an element, just like any other. Therefore, DesignHistoryRestore Restore will un-add, un-delete, or un-modify an attachment just as it would restore any other element type.

Note that if Restore recreates a reference attachment, it will not automatically load or fill the referenced model. You must do that manually (e.g., by calling mdlModelRef_loadReferenceModels on the parent model).

Restoring Referenced Models

Design history is file-specific. As a result, restoring a file will not cause its reference attachments to be restored. If you want to restore the references of a file, you must apply DesignHistoryRestore to each referenced file. To do that, you must iterate the ModelRefs of the parent file, compile a unique set of reference files, and apply DesignHistoryRestore to each file in turn.

See also
DesignHistoryCodeSamples, DesignHistoryHookFunctions

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.