Table of Contents

CadSystemVariable

from OpenCAD2D import CadSystemVariable

class CadSystemVariable(System.Object) ยท CadSystemVariable in the .NET reference

A system variable, as AutoCAD's: a name SETVAR asks, or typed alone, and the value it reads and sets where the presenter keeps it. One kept in the drawing (LTSCALE, $LTSCALE of the header) is changed as one step of undo, as AutoCAD records a change of the header; one of the app (OSMODE, PICKBOX) is changed at once, with no step. "Enter new value for OSMODE <4133>:" asks a whole number, 32 768 refused with "Requires an integer between 0 and 32767." and asked again; Enter keeps the value. A variable read only says its value, "EXTMIN = 0.0000,0.0000,0.0000 (read only)".

Properties and fields

IsInDrawing

.NET

@property
def IsInDrawing(self) -> bool

Gets whether it is kept in the drawing, so that a change of it is a step of undo and is saved with the drawing.

IsReadOnly

.NET

@property
def IsReadOnly(self) -> bool

Gets whether it can only be read, as EXTMIN and DWGNAME.

Kind

.NET

@property
def Kind(self) -> CadVariableKind

Gets what it holds.

Name

.NET

@property
def Name(self) -> str

Gets the name, in capitals: OSMODE.

Methods

Angle

.NET

@staticmethod
def Angle(name: str, get: System.Func[float], set: System.Action[float]) -> CadSystemVariable

Makes an angle the app keeps, as SNAPANG: asked "Enter new value for SNAPANG <30>:" in the drawing's angle units (AUNITS, AUPREC), typed in them or given by two points, and kept from nought up to a whole turn, as AutoCAD keeps 400 as 40 and -30 as 330; set at once, no step of undo.

Distance

.NET

@staticmethod
def Distance(name: str, get: System.Func[float], set: System.Action[float]) -> CadSystemVariable

Makes a distance the app keeps, of either sign, as POLARDIST: asked "Enter new value for POLARDIST <0.0000>:", shown to four places, typed or given by two points, 0,0 then 3,4 at "Specify second point:" setting 5 as AutoCAD 2021 does; text that is no number refused with AutoCAD's "Requires numeric distance or two points." and asked again; set at once, no step of undo.

GetValue

.NET

def GetValue(self, session: CadCommandSession) -> str

Gets the value as SETVAR shows it in its angle brackets: a whole number as 4133, a real to four places as 1.0000 (an angle as 90), a text in quotes as "0", a point as 0.0000,0.0000,0.0000.

Integer

.NET

@staticmethod
def Integer(name: str, least: int, most: int, get: System.Func[int], set: System.Action[int]) -> CadSystemVariable

Makes a whole number the app keeps, as OSMODE: asked "Enter new value for OSMODE <4133>:", a number outside least to most refused with AutoCAD's "Requires an integer between 0 and 32767." and asked again; set at once, no step of undo.

Point

.NET

@staticmethod
def Point(name: str, get: System.Func[GeoPoint2], set: System.Action[GeoPoint2]) -> CadSystemVariable

Makes a point the app keeps, as SNAPBASE: asked "Enter new value for SNAPBASE <0.0000,0.0000>:", typed or picked, a number alone the point that far from the last point towards the cursor, as AutoCAD 2021 takes SNAPBASE 5; set at once, no step of undo.

@staticmethod
def Point(name: str, get: System.Func[GeoPoint2], take: System.Func[GeoPoint2, bool]) -> CadSystemVariable

Makes a point the app keeps that refuses some values, as SNAPUNIT: asked "Enter new value for SNAPUNIT <10.0000,10.0000>:", typed or picked, a number alone the point that far from the last point towards the cursor (GRIDUNIT 5 with the last point at (10, 20) and the cursor at (13, 24) is 13,24, as AutoCAD 2021 takes it), text that is no point refused with "Invalid 2D point." and asked again; a point the take refuses, as 0,5 for a snap spacing, written off with AutoCAD's "Cannot set SNAPUNIT to that value." and not asked again; set at once, no step of undo.

Real

.NET

@staticmethod
def Real(name: str, most: float, get: System.Func[float], set: System.Action[float]) -> CadSystemVariable

Makes a real number above nought the app keeps, as POLARANG: asked "Enter new value for POLARANG <90>:", shown to as few places as it needs; nought or less refused with "Value must be positive and nonzero.", one above most with "Value must be at most 360.", and asked again; set at once, no step of undo.

Switch

.NET

@staticmethod
def Switch(name: str, get: System.Func[bool], set: System.Action[bool]) -> CadSystemVariable

Makes a switch the app keeps, as LWDISPLAY: shown as OFF or ON, asked "Enter new value for LWDISPLAY <OFF>:", 0, 1, ON or OFF taken in either case, anything else refused with AutoCAD's "Requires 0 or 1 only, or option keyword." and asked again; set at once, no step of undo.

Text

.NET

@staticmethod
def Text(name: str, get: System.Func[str], take: System.Func[str, bool]) -> CadSystemVariable

Makes a text the app keeps that may be empty, as POLARADDANG: asked "Enter new value for POLARADDANG, or . for none <"">:", a period for an empty text; one refused written off with AutoCAD's "Cannot set POLARADDANG to that value." and not asked again; set at once, no step of undo.

ToString

.NET

def ToString(self) -> str