CadStandard
from OpenCAD2D import CadStandard
class CadStandard(System.Object) ยท CadStandard in the .NET reference
A drawing standard a company writes once and checks its drawings against (CadStandards.Check): the layers a drawing may use and how each looks, the text and dimension styles with their fonts, the heights words may have on paper, the least gap between words and lines, how a chain of dimensions lines up, and whether an object may sit on layer 0 or take a colour or linetype of its own. It is read from a JSON file of a versioned schema (CadStandard.Schema, docs/schemas/opencad2d-standard-v1.schema.json) in which every member but the two that name the schema is optional, and a rule whose member is absent is not run. A member the schema does not know is refused, so that a misspelt rule is not skipped without a word.
Properties and fields
Version
Version: ClassVar[int]
The version of the schema this reads and CadStandard.Schema describes.
Name
@property
def Name(self) -> str
Gets the name the standard gives itself, or an empty text.
Schema
Schema: ClassVar[str]
Gets the JSON Schema (draft 2020-12) of a standard file: the file docs/schemas/opencad2d-standard-v1.schema.json of the repository, built into this assembly.
Methods
Parse
@staticmethod
def Parse(json: str) -> CadStandard
Reads a standard from its JSON text.
Runs
def Runs(self, rule: str) -> bool
Gets whether a rule is run for this standard.
WeightOf
def WeightOf(self, rule: str) -> float
Gets the weight of a rule in the total score: 1 unless the standard says otherwise.