CadLayerTranslatorRequest
from OpenCAD2D import CadLayerTranslatorRequest
class CadLayerTranslatorRequest(System.Object) · CadLayerTranslatorRequest in the .NET reference
The Layer Translator of LAYTRANS, as data its command and the window share. Translate From lists the layers of the drawing; Translate To lists the layers it can be mapped to, those of the drawing to start with and those of the standards files loaded (a DWG, DWS, DWT or DXF) added, a layer of a name the list has taking the settings of the file's; Map and Map same make the mappings, Edit changes the settings a mapping gives, Save writes the standards file of the Translate To list with the mappings, and Translate carries them out. A drawing with OLD-WALL and OLD-DOOR, loaded with a standards file of WALL and DOOR, maps OLD-WALL to WALL and OLD-DOOR to DOOR, and translates them as one undo step.
Properties and fields
Action
@property
def Action(self) -> CadDialogAction
@Action.setter
def Action(self, value: CadDialogAction) -> None
Gets or sets what the dialog closed with: OK for Translate, Cancel for Cancel; Cancel until set.
Document
@property
def Document(self) -> CadDocument
Gets the document.
FromLayers
@property
def FromLayers(self) -> System.Collections.Generic.IReadOnlyList[CadTranslateLayer]
Gets the layers of the drawing that can be translated, in ordinal order of the names, letters of either case alike: those of external references are left out.
LoadedFiles
@property
def LoadedFiles(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the standards files loaded, in the order loaded.
Log
@property
def Log(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the lines of the transaction log of the last Translate, in order.
LogFile
@property
def LogFile(self) -> str | None
Gets the file the last Translate wrote its log to; null where none was written.
Mappings
@property
def Mappings(self) -> System.Collections.Generic.IReadOnlyList[CadLayerMapping]
Gets the mappings made, in ordinal order of the layers translated.
Message
@property
def Message(self) -> str | None
Gets what the last change said where it was refused or could not be made; null where it was made.
Settings
@property
def Settings(self) -> CadLayerTranslatorSettings
Gets the translator's settings; each is on until set.
ToLayers
@property
def ToLayers(self) -> System.Collections.Generic.IReadOnlyList[CadTranslateLayer]
Gets the layers that can be translated to: the drawing's own, then those of the files loaded, in ordinal order of the names.
Methods
Edit
def Edit(self, from_: System.Collections.Generic.IEnumerable[str], /, settings: CadTranslateLayer) -> int
Edit…: gives the mappings of the layers named the settings of the layer they go to, as the Edit Layer dialog sets them; the layer in the Translate To list and the file it came from are left as they are.
HideContents
def HideContents(self) -> None
Puts the layers back as they were before any contents were shown; done when the dialog closes.
Load
def Load(self, path: str) -> bool
Load…: adds the layers of a standards file to the Translate To list, a layer of a name the list has taking the file's settings, and the mappings the file keeps (those a Save of this wrote) for layers of the drawing that are not mapped yet. A file that cannot be read, or has no layer, changes nothing.
Map
def Map(self, from_: System.Collections.Generic.IEnumerable[str], /, to: str) -> int
Map: maps layers of the drawing to a layer of the Translate To list; a layer mapped already is mapped again. Layer 0 and Defpoints are not mapped to another layer.
MapSame
def MapSame(self) -> int
Map same: maps each layer of the drawing to the layer of the Translate To list of its name, letters of either case alike.
NewLayer
def NewLayer(self, layer: CadTranslateLayer) -> bool
New…: adds a layer to the Translate To list, to map layers to and make in the drawing where it has none of the name.
Remove
def Remove(self, from_: System.Collections.Generic.IEnumerable[str], /) -> int
Remove: takes the mappings of the layers named away, so that those layers are not translated.
Save
def Save(self, path: str) -> bool
Save…: writes the Translate To list as a standards file, a DWG for a name ending in .dws or .dwg and a DXF otherwise, with the mappings made kept in it, so that Load reads them again. A linetype a layer names is copied into the file from the drawing or the file it came from.
ShowContents
def ShowContents(self, names: System.Collections.Generic.IReadOnlyCollection[str]) -> None
Show layer contents when selected: shows only the layers named in the drawing, every other layer turned off, until CadLayerTranslatorRequest.HideContents; nothing is done where the setting is off. None named is the drawing as it was.
Translate
def Translate(self) -> CadEditResult
Translate: carries the mappings out as CadLayerEditor.Translate says, and writes the transaction log beside the drawing (plan.dxf as plan.log) where the settings ask and the drawing has a file.