Main Content

slreportgen.utils.getCurrentEditorView

Get current editor view area

Description

example

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.

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.

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);
Introduced in R2020a