Main Content

slreportgen.utils.getCurrentEditorView

Get current editor view area

Since R2020a

Description

viewArea = slreportgen.utils.getCurrentEditorView returns the current Simulink® Editor view area as a 1-by-4 array of doubles. The first two values of the array are the x and y coordinates, in pixels, of the top left corner of the diagram area in the Simulink Editor coordinate space. The last two values are the width and height, in pixels.

example

Examples

collapse all

This example creates an slreportgen.report.Diagram reporter that takes a snapshot of the current editor view.

Open a model in Simulink.

openExample('f14')

In the Simulink Editor, zoom in on the area of the diagram that you want to capture in the report.

Set up the report and create an slreportgen.report.Diagram reporter to take a snapshot of the top-level diagram. Specify that you want to capture the current editor view in the diagram snapshot.

import slreportgen.report.*
import slreportgen.utils.*

rpt = Report('output','pdf');

diag = Diagram('f14');
diag.SnapshotArea = getCurrentEditorView();
add(rpt,diag);

close(rpt);
rptview(rpt);

Version History

Introduced in R2020a