Table of Contents

CadViewportLayerEditor

from OpenCAD2D import CadViewportLayerEditor

class CadViewportLayerEditor(System.Object) ยท CadViewportLayerEditor in the .NET reference

The edits of layers in the viewports of the layouts, as the VP columns of AutoCAD's Layer manager, VPLAYER and LAYVPI make them: a layer frozen or thawed in one viewport or in all, frozen in the viewports made from now on, and its colour, linetype, lineweight, transparency and plot style overridden in one viewport. Each is one undo step through CadDocument.ApplyEdit, refused before anything is written where AutoCAD would not do it.

Methods

AddFrozenInAllViewports

.NET

@staticmethod
def AddFrozenInAllViewports(document: CadDocument, layer: str, name: str = ...) -> CadEditResult

Adds a layer frozen in every viewport of every layout there is, as the Layer manager's "New Layer VP Frozen in All Viewports" and VPLAYER Newfrz: of the colour White and the linetype Continuous, as a new layer is, one undo step.

LayoutViewports

.NET

@staticmethod
def LayoutViewports(document: CadDocument) -> System.Collections.Generic.IReadOnlyList[DxfViewport]

Gets the viewports of every layout, the sheets' own left out, in the order of the layout tabs and of each layout's block: those "in all viewports" acts on.

RemoveOverrides

.NET

@staticmethod
def RemoveOverrides(
    document: CadDocument,
    layers: System.Collections.Generic.IEnumerable[str],
    viewport: str,
) -> CadEditResult

Takes out every override of layers, in one viewport or in all, as the Layer manager's "Remove Viewport Overrides for": nothing where they have none.

SetColor

.NET

@staticmethod
def SetColor(document: CadDocument, viewport: str, layer: str, color: DxfColor) -> CadEditResult

Overrides a layer's colour in a viewport, as the VP Color column: one of the index or a true colour; ByLayer and ByBlock refused.

SetFrozen

.NET

@staticmethod
def SetFrozen(
    document: CadDocument,
    viewports: System.Collections.Generic.IEnumerable[str],
    layers: System.Collections.Generic.IEnumerable[str],
    frozen: bool,
    name: str = ...,
) -> CadEditResult

Freezes or thaws layers in viewports, as the VP Freeze column and VPLAYER Freeze and Thaw do: each viewport whose frozen layers change has one record, the layers it freezes before and after; nothing changed is no edit. A layer is frozen in a viewport even where it is the current one, as AutoCAD allows.

SetFrozenInAllViewports

.NET

@staticmethod
def SetFrozenInAllViewports(
    document: CadDocument,
    layers: System.Collections.Generic.IEnumerable[str],
    frozen: bool,
) -> CadEditResult

Freezes or thaws layers in every viewport of every layout, as the Layer manager's "VP Freeze Layer in All Viewports" and "VP Thaw Layer in All Viewports".

SetFrozenInNewViewports

.NET

@staticmethod
def SetFrozenInNewViewports(document: CadDocument, layer: str, frozen: bool, name: str = ...) -> CadEditResult

Sets whether a layer is frozen in each viewport made from now on, as the New VP Freeze column and VPLAYER Vpvisdflt do (flag 2 of the layer's group 70); the viewports there are now keep their own.

SetLineWeight

.NET

@staticmethod
def SetLineWeight(document: CadDocument, viewport: str, layer: str, lineWeight: DxfLineWeight) -> CadEditResult

Overrides a layer's lineweight in a viewport, as the VP Lineweight column: Default or one of AutoCAD's widths.

SetLinetype

.NET

@staticmethod
def SetLinetype(document: CadDocument, viewport: str, layer: str, linetype: str) -> CadEditResult

Overrides a layer's linetype in a viewport, as the VP Linetype column: one the drawing has.

SetPlotStyle

.NET

@staticmethod
def SetPlotStyle(document: CadDocument, viewport: str, layer: str, plotStyle: str) -> CadEditResult

Overrides a layer's plot style in a viewport, as the VP Plot Style column: a name of the drawing's plot styles, in a drawing of named plot styles; refused in one plotted by colour, where the column is grey, as AutoCAD refuses it.

SetTransparency

.NET

@staticmethod
def SetTransparency(
    document: CadDocument,
    viewport: str,
    layer: str,
    transparency: DxfTransparency,
) -> CadEditResult

Overrides a layer's transparency in a viewport, as the VP Transparency column: by alpha, in a drawing of AutoCAD 2004 on.

TargetViewport

.NET

@staticmethod
def TargetViewport(document: CadDocument) -> DxfViewport

Gets the viewport the VP columns act on, as AutoCAD's Layer manager does in a layout: the one worked through (CadDocument.ActiveViewport), else the one viewport selected on the paper of the layout shown; null on the Model tab, on the paper with no viewport alone selected, and for the sheet's own viewport.