Hi @Victoria Ramirez ,
You asked, “I´m using system composer, and i want to create a report with the views and sequence diagrams that i have. I have this code to generate the report and add the views, but i don´t know if there is a way to add too the sequence diagrams because there is nothing like "SequenceDiagramFinder".”
Please see my response to your comments below.
To incorporate sequence diagrams into your report alongside the views, you can leverage the `systemcomposer.rptgen.report.SequenceDiagram` class, which allows you to create a reporter for sequence diagrams within your System Composer model. For more information regarding to this class, please refer to,
Below is an adapted version of your existing code that demonstrates how to include both views and sequence diagrams in your report. So, first make sure that your model is loaded as you have done. Initialize the report as before. Then, iterate through the views using ViewFinder and use the SequenceDiagram class to add sequence. Please see modified version of your code below.
% Load the System Composer model model = systemcomposer.loadModel(model_name);
% Create a new report rpt = slreportgen.report.Report(output="ViewFinderReport",... CompileModelBeforeReporting=false);
% Create a ViewFinder for views viewFinder = ViewFinder(model_name); chapter = Chapter("Title","Views");
% Add views to the chapter while hasNext(viewFinder) view = next(viewFinder); sect = Section("Title", view.Name); add(sect, view); add(chapter, sect); end add(rpt, chapter); % Add the views chapter to the report
% Now add a section for Sequence Diagrams seqChapter = Chapter("Title", "Sequence Diagrams");
% Get all sequence diagrams in the model seqDiagrams = systemcomposer.sequenceDiagrams(model_name); % Adjust if necessary
for i = 1:length(seqDiagrams) seqDiagram = seqDiagrams(i);
% Create a SequenceDiagram reporter for each diagram seqReporter = systemcomposer.rptgen.report.SequenceDiagram("Name", seqDiagram.Name, "ModelName", model_name);
% Create a section for each sequence diagram and add it to the chapter seqSect = Section("Title", seqDiagram.Name); add(seqSect, seqReporter); add(seqChapter, seqSect); end
add(rpt, seqChapter); % Add the sequence diagrams chapter to the report
% Finally, close and generate the report close(rpt);
I wanted to let you know that the SequenceDiagram reporter allows customization through its properties like TemplateSrc and TemplateName. If you have specific formatting or content requirements, consider creating custom templates. Also, I will suggest implementing error handling when loading models or generating reports to catch any potential issues that may arise during execution.After implementing these changes, test your script with different models and sequences to ensure compatibility and that all expected diagrams are included in the output. By following these steps, you should be able to effectively generate a comprehensive report that includes both architectural views and sequence diagrams, enhancing your documentation process within System Composer. Please let me know if you have any further questions.