Method Translate
- Namespace
- OpenCAD2D
- Assembly
- OpenCAD2D.Core.dll
Translate(CadDocument, IReadOnlyList<CadLayerMapping>, CadLayerTranslatorSettings, IList<string>)
Translates layers, as AutoCAD's Layer Translator does for the mappings made: the layers translated to are made where the drawing has none (with the linetype copied from the standards file where the drawing has none) and given the colour, linetype, lineweight, transparency and plot style of the mapping where it has them; every object of a layer translated, in model space, the layouts and the blocks (those of the blocks left out where the settings say so), the attributes of block references among them, is put on the layer it is translated to; the layers translated from are deleted but for layer 0, Defpoints and any layer another mapping translates to. A drawing with 40 lines on OLD-WALL and a mapping of OLD-WALL to WALL (colour 3) has the 40 lines on WALL, WALL green, and no layer OLD-WALL afterwards. One undo step.
public static CadEditResult Translate(CadDocument document, IReadOnlyList<CadLayerMapping> mappings, CadLayerTranslatorSettings settings, IList<string> log)
Parameters
documentCadDocumentThe document.
mappingsIReadOnlyList<CadLayerMapping>The mappings, each a layer of the drawing and the layer it goes to.
settingsCadLayerTranslatorSettingsThe translator's settings: what to force to ByLayer, and whether blocks are translated.
logIList<string>Receives the lines of the transaction log, in order; may be null.
Returns
- CadEditResult
What came of it; refused, nothing changed, where no layer is mapped, a layer is not in the drawing or belongs to an external reference, or a name to translate to is not one AutoCAD takes. Failed, the drawing taken back, where a layer cannot be deleted after its objects are moved.
Exceptions
- ArgumentNullException
Thrown when the document, the mappings or the settings are null.