I have had some success with the documentation automation interface. Because scripting is NOT something Sparx provide direct assistance with, I need to know where I can find the answers. This forum is useful, but it is not a published API guide. I need to know where the object model is described. I need to know he corect syntax. I have provided My Pseudocode Example below which outlines what I am trying to achieve. The pseudocode demonstrates that I have yet to learn the correct syntax.
In my company, for each Sparx project package, we need to print the package name, package notes, package-linked document, then iterate over all diagrams, print the diagram, then (if (currentDiagram.Type == 'Deployment')) within each diagram, print a tabulated list of diagram elements. I have already successfully built this reporting process (without using the documentation automation interface) using a Virtual Document with a «master document» containing 3 «model document»s. This is provided as a template to my customers. The customer simply drops project packages into the middle «model document» and runs their report, rooted in the «master document». There is one hole in the process. Currently, regardless of diagram.type, the process prints a print a tabulated list of diagram elements. The documentation automation interface may be the solution.
(My Pseudocode Example)
currentPackage = Repository.GetTreeSelectedPackage();
generationSuccess = docGenerator.DocumentPkgNotes( currentPackage.PkgID, 0, SECTION_HEADER_AND_NOTES_TEMPLATE );
generationSuccess = docGenerator.DocumentLinkedDocument( currentPackage.LinkedDocID, 0, LINKED_DOC_TEMPLATE );
// Iterate over all diagrams under the currently selected package
var packageDiagrams as EA.Collection;
packageDiagrams = currentPackage.Diagrams;
for ( var i = 0 ; i < packageDiagrams.Count ; i++ )
{
// Get the current diagram
var currentDiagram as EA.Diagram;
currentDiagram = packageDiagrams.GetAt( i );
generationSuccess = docGenerator.DocumentDiagram( currentDiagram.DiagramID, 0, PACKAGE_DIAGRAM_IMAGE_TEMPLATE );
if (currentDiagram == 'Deployment')
{
generationSuccess = docGenerator.DocumentDiagramElements( currentDiagram.DiagramID, 0, PACKAGE_DIAGRAM_ELEMENTS_TABLE_TEMPLATE );
}
}
Please can someone show the correct syntax for the above documentation automation interface JScript.