CadLinetypes
from OpenCAD2D import CadLinetypes
class CadLinetypes(System.Object) ยท CadLinetypes in the .NET reference
The linetypes of a document loaded, tested and drawn, as LINETYPE and its dialogs need them. A linetype of a file on disk is loaded by the library's own loader (DxfDatabase.LoadLineTypeFile), which reads it as AutoCAD does, text and shapes alike; one of the presenter's own set is written from its definition (CadLinetypes.Add).
Methods
Add
@staticmethod
def Add(database: DxfDatabase, linetype: CadLinetypeDefinition) -> DxfLinetypeTableRecord
Writes a linetype of the presenter's own as an LTYPE record of a drawing, as AutoCAD writes one: its name, its description, 72 the alignment A, the count of its elements and its length, then each element's 49 and 74, and for a text its 75 of nought, the handle of its text style (340), its scale, rotation and offset (46, 50, 44, 45) and the text (9). GAS_LINE's gap of 5.08 carrying GAS in STANDARD is 49 -5.08, 74 2, 75 0, 340 Standard's handle , 46 2.54, 50 0, 44 -2.54, 45 -1.27, 9 GAS. One of CadLinetypeFile.BuiltIn itself named like one of AutoCAD's (CENTER, HIDDEN, DASHED and the rest) is written in the drawing's units, as AutoCAD takes acad.lin or acadiso.lin by MEASUREMENT: CENTER in a metric drawing is 31.75, -6.35, 6.35, -6.35 and in one whose MEASUREMENT is 0 it is 1.25, -0.25, 0.25, -0.25; any other definition is written as it is.
DashesOf
@staticmethod
def DashesOf(database: DxfDatabase, name: str) -> System.Collections.Generic.IReadOnlyList[float]
Gets the lengths of a linetype of the drawing, as its LTYPE holds them; none for Continuous or one the drawing has not.
IsInUse
@staticmethod
def IsInUse(database: DxfDatabase, name: str) -> bool
Gets whether something of the drawing draws with a linetype, so that it may not be deleted: ByLayer, ByBlock and Continuous always, as AutoCAD keeps them, and any other an entity, a layer, a style or the header names, as the library's purge finds it.
IsKept
@staticmethod
def IsKept(name: str) -> bool
Gets whether a linetype is one AutoCAD keeps in every drawing: ByLayer, ByBlock or Continuous.
Load
@staticmethod
def Load(
document: CadDocument,
linetypes: System.Collections.Generic.IEnumerable[CadLinetypeDefinition],
path: str,
stepName: str = ...,
) -> CadLinetypeLoad
Loads linetypes into a document as one undo step, named as given: each of a file on disk through the library's loader, each of CadLinetypeFile.BuiltInName from its definition; one the drawing has already passed over, one the drawing cannot take (its text style or shape missing) refused alone, the others loaded. DASHED of the presenter's own set loaded into a new drawing is an LTYPE of a dash 12.7 and a gap 6.35, 19.05 long. A linetype of CadLinetypeFile.BuiltIn itself is written from its definition whatever the path, so that the Load dialog's list, the presenter's own set followed by a file's, loads in one step.
Names
@staticmethod
def Names(database: DxfDatabase) -> System.Collections.Generic.IReadOnlyList[str]
Gets the names of the drawing's linetypes, ByLayer and ByBlock left out, in the order of their names: Continuous, DASHED, HIDDEN.
Rename
@staticmethod
def Rename(document: CadDocument, name: str, newName: str) -> CadEditResult
Renames a linetype with everything drawn with it, as -RENAME LType does: the entities, the layers, the styles of multilines and the current linetype name it. Refused for ByLayer, ByBlock and Continuous, which AutoCAD keeps, and for a linetype of an external reference, Cannot rename linetype "X".; for a name AutoCAD does not take, Invalid linetype name.; and for the name of another linetype, letters of either case the same, Linetype "X" already exists.