Viewport

The VIEWPORT (DXF Reference) entity is a window from a paperspace layout to the modelspace.

Subclass of

ezdxf.entities.DXFGraphic

DXF type

'VIEWPORT'

Factory function

ezdxf.layouts.Paperspace.add_viewport()

Inherited DXF attributes

Common graphical DXF attributes

Warning

Do not instantiate entity classes by yourself - always use the provided factory functions!

class ezdxf.entities.Viewport
dxf.center

Center point of the viewport in modelspace (3D point in WCS).

dxf.width

Viewport width in paperspace units (float)

dxf.height

Viewport height in paperspace units (float)

dxf.status

Viewport status field (int)

-1

On, but is fully off screen, or is one of the viewports that is not active because the $MAXACTVP count is currently being exceeded.

0

Off

>0

On and active. The value indicates the order of stacking for the viewports, where 1 is the active viewport, 2 is the next, and so forth

dxf.id

Viewport id (int)

dxf.view_center_point

View center point in DCS.

dxf.snap_base_point
dxf.snap_spacing
dxf.snap_angle
dxf.grid_spacing
dxf.view_direction_vector

View direction (3D vector in WCS).

dxf.view_target_point

View target point (3D point in WCS).

dxf.perspective_lens_length

Lens focal length in mm as 35mm film equivalent.

dxf.front_clip_plane_z_value
dxf.back_clip_plane_z_value
dxf.view_height

View height in WCS.

dxf.view_twist_angle
dxf.circle_zoom
dxf.flags

Viewport status bit-coded flags:

1 (0x1)

Enables perspective mode

2 (0x2)

Enables front clipping

4 (0x4)

Enables back clipping

8 (0x8)

Enables UCS follow

16 (0x10)

Enables front clip not at eye

32 (0x20)

Enables UCS icon visibility

64 (0x40)

Enables UCS icon at origin

128 (0x80)

Enables fast zoom

256 (0x100)

Enables snap mode

512 (0x200)

Enables grid mode

1024 (0x400)

Enables isometric snap style

2048 (0x800)

Enables hide plot mode

4096 (0x1000)

kIsoPairTop. If set and kIsoPairRight is not set, then isopair top is enabled. If both kIsoPairTop and kIsoPairRight are set, then isopair left is enabled

8192 (0x2000)

kIsoPairRight. If set and kIsoPairTop is not set, then isopair right is enabled

16384 (0x4000)

Enables viewport zoom locking

32768 (0x8000)

Currently always enabled

65536 (0x10000)

Enables non-rectangular clipping

131072 (0x20000)

Turns the viewport off

262144 (0x40000)

Enables the display of the grid beyond the drawing limits

524288 (0x80000)

Enable adaptive grid display

1048576 (0x100000)

Enables subdivision of the grid below the set grid spacing when the grid display is adaptive

2097152 (0x200000)

Enables grid follows workplane switching

dxf.clipping_boundary_handle
dxf.plot_style_name
dxf.render_mode

0

2D Optimized (classic 2D)

1

Wireframe

2

Hidden line

3

Flat shaded

4

Gouraud shaded

5

Flat shaded with wireframe

6

Gouraud shaded with wireframe

dxf.ucs_per_viewport
dxf.ucs_icon
dxf.ucs_origin

UCS origin as 3D point.

dxf.ucs_x_axis

UCS x-axis as 3D vector.

dxf.ucs_y_axis

UCS y-axis as 3D vector.

dxf.ucs_handle

Handle of UCSTable if UCS is a named UCS. If not present, then UCS is unnamed.

dxf.ucs_ortho_type

0

not orthographic

1

Top

2

Bottom

3

Front

4

Back

5

Left

6

Right

dxf.ucs_base_handle

Handle of UCSTable of base UCS if UCS is orthographic (Viewport.dxf.ucs_ortho_type is non-zero). If not present and Viewport.dxf.ucs_ortho_type is non-zero, then base UCS is taken to be WORLD.

dxf.elevation
dxf.shade_plot_mode

(DXF R2004)

0

As Displayed

1

Wireframe

2

Hidden

3

Rendered

dxf.grid_frequency

Frequency of major grid lines compared to minor grid lines. (DXF R2007)

dxf.background_handle
dxf.shade_plot_handle
dxf.visual_style_handle
dxf.default_lighting_flag
dxf.default_lighting_style

0

One distant light

1

Two distant lights

dxf.view_brightness
dxf.view_contrast
dxf.ambient_light_color_1

as AutoCAD Color Index (ACI)

dxf.ambient_light_color_2

as true color value

dxf.ambient_light_color_3

as true color value

dxf.sun_handle
dxf.ref_vp_object_1
dxf.ref_vp_object_2
dxf.ref_vp_object_3
dxf.ref_vp_object_4
frozen_layers

Set/get frozen layers as list of layer names.