CadTemplate
from OpenCAD2D import CadTemplate
class CadTemplate(System.Object) ยท CadTemplate in the .NET reference
The drawing NEW starts from: the presenter's own metric template, made in code with the settings of AutoCAD's acadiso.dwt (not its file). A drawing of R2013 in millimetres, its linear units decimal to four places and its angles decimal degrees to none, its limits an A3 sheet of 420 by 297, its text 2.5 high, its points dots, its Layout1 an A3 sheet in millimetres (CadTemplate.UseMillimetreSheet), and its dimensions drawn in ISO-25: arrowheads and text 2.5, the text above the line, two decimal places and a decimal comma.
Properties and fields
DimensionStyle
DimensionStyle: ClassVar[str]
The name of the dimension style the template makes current.
Extensions
Extensions: ClassVar[System.Collections.Generic.IReadOnlyList[str]]
The file types a template is chosen among, as the Select Template dialog lists them.
SampleDescription
SampleDescription: ClassVar[str]
The description the sample template carries in its template section, the text Select Template shows under its name.
SampleFileName
SampleFileName: ClassVar[str]
The file name of the sample template that ships in the DrawingTemplates folder, written from CadTemplate.CreateSample.
Methods
CreateImperial
@staticmethod
def CreateImperial() -> DxfDatabase
Makes a new drawing of the presenter's own imperial template, as AutoCAD's "Open with no Template - Imperial" starts one (the settings of acad.dwt, not its file): R2013 in inches, MEASUREMENT 0, its limits a sheet of 12 by 9, its text 0.2 high, and its dimensions drawn in Standard, arrowheads and text 0.18, four decimal places and a decimal point. The layer 0, the linetypes, the text styles Standard and Annotative are those of CadTemplate.CreateMetric.
CreateMetric
@staticmethod
def CreateMetric() -> DxfDatabase
Makes a new drawing of the metric template: R2013 (AC1027), every setting of CadTemplate in its header and tables, nothing drawn.
CreateSample
@staticmethod
def CreateSample() -> DxfDatabase
Makes the drawing of the sample template OpenCAD2D-mm.dwt, for a detail drawn at 1:1 in millimetres and printed on an A3 sheet: R2013, MEASUREMENT 1, INSUNITS 4 (millimetres), distances to two decimal places, limits of 42 000 by 29 700 (an A3 sheet at 1:100), LTSCALE and PSLTSCALE 1 (the dashes of the presenter's own linetypes are millimetres: CENTER has a dash of 31.75), and nothing drawn.
DescriptionOf
@staticmethod
def DescriptionOf(file: str) -> str
Reads the description of a template, the text AutoCAD's Template Options writes into a DWG's template section. A file that is no DWG (a DXF), one with no description, and one that cannot be read have none.
Find
@staticmethod
def Find(typed: str, folder: str) -> str
Finds the file of a template named as typed: as typed, else in the template folder, else, for a name with no folder, the first of that name in the folder's subfolders; a name with no extension is given .dwt, as AutoCAD does.
FindIn
@staticmethod
def FindIn(folder: str) -> System.Collections.Generic.IReadOnlyList[str]
Lists the templates of a folder and its subfolders: the .dwt, .dwg and .dxf files, in the order of the walk (CadSupportWalk): the folder's own files by name (letters of either case the same, then as written) and then by extension, then the files of its subfolders in the same way, each subfolder after the folder it is in. Of two files of one name (sheet.dwt in the folder and in a subfolder) the first is listed, so the one at the top wins; empty where the folder is not there.
UseMillimetreSheet
@staticmethod
def UseMillimetreSheet(database: DxfDatabase) -> None
Sets up the layouts of a drawing as AutoCAD's acadiso.dwt has Layout1: a sheet of ISO A3 on its side, 420 by 297 millimetres with margins of 5 (CadPaper.Default), the paper in millimetres and the layout as the plot area. The library's new drawing leaves a layout with the paper in inches and no sheet (0 by 0), which reads as 25.4 millimetres to the unit and has nothing to plot on. Model space and the names of the layouts are left alone; so is a drawing read from a file, which is not given to this method.