In the interest of completing this discussion, and just in case someone comes along later and wants to implement a solution, I spent 20 minutes trying out the code to create a baseline. I played with two different ways of creating the baseline:
1) create a baseline for each package that sits just under the model package.
2) create a baseline for the package containing a diagram when it is closed. NOTE: this is everytime it is closed whether any change is made or not.
I have included the functions below.
public void EA_FileClose(EA.Repository Repository)
{
//get a colection of models in the repository
foreach (EA.IDualPackage p in Repository.Models)
{
//get a collection of next layer package in the model
// and create abaseline for each of them using the current date and time as a version
EA.IDualCollection c = p.Packages;
foreach (EA.IDualPackage Kid in c)
{
Repository.GetProjectInterface().CreateBaseline(Kid.PackageGUID, DateTime.Now.ToString(), "");
}
}
return;
}
public void EA_OnPostCloseDiagram(EA.Repository Repository, int DiagramID)
{
//get a diagram object identified by the ID
EA.IDualDiagram diag = Repository.GetDiagramByID(DiagramID);
//get the parent package object that contains the diagram
EA.IDualPackage p = Repository.GetPackageByID(diag.PackageID);
//create a baseline for the package containing the diagram just closed using current date and time as a version
Repository.GetProjectInterface().CreateBaseline(p.PackageGUID, DateTime.Now.ToString(), "");
return;
}
Enjoy
Gary
