CadCommandSession
from OpenCAD2D import CadCommandSession
class CadCommandSession(System.Object) ยท CadCommandSession in the .NET reference
The command line of one document, as AutoCAD's: a command started by its name or alias, its prompts answered by points picked on the canvas, text typed, objects selected, Enter and Esc, with the history of what was asked and answered. It knows no window: the canvas and the command line call CadCommandSession.Feed, CadCommandSession.Feed, CadCommandSession.FeedSelection, CadCommandSession.Enter and CadCommandSession.Escape, and a test calls them the same way.
The dialogs of AutoLISP's DCL functions: what shows them for this session.
The object selection filter of FILTER, kept for the session as AutoCAD keeps its named filters.
The input of grread: the keys, clicks and moves the window gives a routine that reads the mouse. Each is one answer of the wait and runs the routine's loop once. Keys and clicks wait their turn in the order they came; a move that comes when the one before it has not been taken yet takes its place, so that a loop slower than the mouse never falls behind it.
The AutoLISP of a document: the interpreter, the lines typed at the command line, the c: commands and load.
What AutoLISP's command and vl-cmdf do in the session: each argument goes, in turn, to the command running or starts one, as typed (never as AutoLISP), the lines the command line would show are written when CMDECHO is 1, and a PAUSE lets the user answer the prompt the command asks while the routine waits.
A routine of AutoLISP that waits for the user: a get function, entsel or ssget asks, the evaluation returns to the session, and the question is asked as a prompt of a small command of its own, so that object snaps, typed points, the rubber band, transparent ZOOM and PAN and the refusal messages work as at any prompt. The answer resumes the routine, Esc gives it Function cancelled, and the command ends when the routine does.
The macro of a ribbon button, as AutoCAD's CUI buttons run it: "^C^C_CIRCLE;0,0;\" cancels what runs, starts CIRCLE, gives it the centre 0,0 and waits for the radius the user types.
A command that a host runs inside the command it holds open, as AutoLISP's command runs one inside a routine: the host's command waits at its waiting prompt (CadPrompt.ForWaiting), the nested command asks its prompts on the command line and ends, and the host's command is given back with nothing written (no ">>" in front of the prompts, no "Resuming" line). The nested command's edits join the undo step the host's command holds open, and Esc at it ends the host's command too, as Esc ends every command a transparent one interrupted.
The point modifiers AutoCAD takes at any prompt for a point, typed or chosen from the Shift+right-click menu: FROM, a base point and an offset from it; M2P (MTP), the point midway between two; TT, a point tracking lines run from; TK (TRACKING), a point reached from another along the axes; and the point filters .X .Y .Z .XY .XZ .YZ, the coordinates named taken from one point and the rest from another.
The reactors of Visual LISP of a document: the ones its routines made (vlr-command-reactor and the others) and the events the session raises for them, which the document's own events (a drawing saved, an object changed) join. A document with no reactor pays for nothing here: every raise looks at one null field first.
The answers typed at the prompts, which the Recent Input menu of the canvas offers again, as AutoCAD 2021's with its INPUTHISTORYMODE 15: those of every command of the session, kept apart by what the prompt asked, the points and numbers written in the drawing's units and the selection sets named by their count, "Selection set (3 items)".
A distance or an angle asked with no base point and given by two points, as AutoCAD 2021 takes them: a point typed or picked at "Enter new value for POLARDIST <0.0000>:" asks "Specify second point:", a rubber band drawn from the first, and the distance between the two, or the direction from the first to the second, answers the prompt. 0,0 then 3,4 sets POLARDIST to 5; 0,0 then 1,1 sets SNAPANG to 45.
The options of "Select objects:", as AutoCAD 2021's.
The temporary graphics of the session: what grdraw and grvecs put on the screen until a redraw takes it off.
PAN, ZOOM, CAL, SETVAR, the settings ORTHO, POLAR, OSNAP, GRID and SNAP, DIST, ID, LAYER, COLOR, LINETYPE, LWEIGHT, UNITS, QUICKCALC, DSETTINGS, TEXTSCR and the name of any system variable run inside another command, as AutoCAD 2021 runs 'PAN and 'ZOOM: typed with an apostrophe at any prompt but one for text, they ask their own prompts after ">>", and once they end the command they interrupted writes "Resuming LINE command." and asks its prompt again, the objects "Select objects:" gathered still gathered. One nests in the other, 'ZOOM in a transparent PAN, as AutoCAD's does; 'ZOOM at ZOOM's own prompt is refused with ZOOM's words. A transparent CAL ends by typing its value at the prompt the command interrupted waits at, a point as 11,21,0 or a distance as 7 (CadCommandContext.TransparentResult), as AutoCAD 2021 does.
A point typed after an object snap override (END, MID, CEN typed, or chosen from the Shift+right-click menu), which AutoCAD 2021 takes as a click: the objects within the aperture of the point are looked at, and the snap point of any of them nearest the point is the answer, or "No Endpoint found for specified point." and the prompt is asked again.
The implied window of the Command prompt and of "Select objects:", as AutoCAD 2021's.
Constructors
__init__
def __init__(self, document: CadDocument, registry: CadCommandRegistry | None = ...) -> None
Makes the command line of a document.
Properties and fields
AngleOverride
@property
def AngleOverride(self) -> float | None
Gets the direction an angle override typed at the prompt holds the next point to, in radians counter-clockwise from the world's X axis; null where none was typed. <30 typed at a prompt for a point that has a base point, as LINE's next point, is AutoCAD's angle override: "Angle Override: 30" is written, the prompt is asked again, and a distance typed then runs along the line at 30 degrees, counted as the angle of @100<30 is, from ANGBASE and clockwise with ANGDIR 1; <<30 counts it from east, counter-clockwise. A point typed is taken as typed. The window holds the cursor on it through ObjectSnap.AngleOverride. It ends with the prompt's answer.
AttributeManager
@property
def AttributeManager(self) -> CadAttributeManagerSettings
Gets what the Block Attribute Manager of BATTMAN keeps from one run to the next, as its Settings dialog sets it: the columns of its grid, tags given twice drawn in red, and whether Apply brings the INSERTs in line at once.
Clipboard
@property
def Clipboard(self) -> ICadClipboard
@Clipboard.setter
def Clipboard(self, value: ICadClipboard | None) -> None
Gets or sets the clipboard COPYCLIP, CUTCLIP and COPYBASE put objects on and the PASTE commands take them from: one in memory of this session's own until set; the window sets the Windows clipboard, so that objects go between its drawings and other copies of the app.
Constraints
@property
def Constraints(self) -> CadConstraintSettings
@Constraints.setter
def Constraints(self, value: CadConstraintSettings | None) -> None
Gets or sets the settings of the Constraint Settings dialog and of the constraint variables, which stay with the session.
Current
@property
def Current(self) -> CadCommand | None
Gets the command running, or null.
Cursor
@property
def Cursor(self) -> GeoPoint2 | None
@Cursor.setter
def Cursor(self, value: GeoPoint2 | None) -> None
Gets or sets where the cursor is, in drawing units, so that a number typed at a point prompt is a distance along the rubber band, as AutoCAD's direct distance entry.
Document
@property
def Document(self) -> CadDocument
Gets the document.
Documents
@property
def Documents(self) -> CadDocuments
Gets the drawings open in the app, as AutoCAD's DocumentManager lists them: listed, opened, made, shown and closed. The window gives its sessions the drawings of the window; a session with no window lists its own drawing alone and refuses the calls that change what is open (see CadDocuments.HasWindow).
Editor
@property
def Editor(self) -> CadEditor
Gets the editor of this session: its view, the selection by area, the system variables and the named views, as a plugin, a program driving the app through Remote, or a Python script uses them. Made once, with the session.
FileDialogs
@property
def FileDialogs(self) -> bool
Gets whether a command asks the window for a file by its file dialog, as AutoCAD's FILEDIA 1, the default; FILEDIA 0 typed makes PNGOUT, JPGOUT, BMPOUT and the window's SAVEAS ask "Enter file name:" or "Save drawing as" on the command line instead, as AutoCAD does in a script.
Gathering
@property
def Gathering(self) -> System.Collections.Generic.IReadOnlyCollection[str]
Gets the objects a "Select objects:" prompt has gathered so far, in ordinal order, so the canvas can highlight them.
History
@property
def History(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the lines of the history, the oldest first: each command, each prompt with its answer, each message.
IsGripEditing
@property
def IsGripEditing(self) -> bool
Gets whether the command running is a grip edit (CadCommandSession.StartGripEdit), whose hot grips the canvas keeps showing.
IsImpliedWindow
@property
def IsImpliedWindow(self) -> bool
Gets whether the only thing running is the implied window of the Command prompt (CadCommandSession.StartWindow), which a click on nothing starts and the next click ends; false while a command runs, even where it asks a window of its own inside "Select objects:". A double click on the paper inside a viewport works through it where the first click has started this window, and ends it.
IsRunning
@property
def IsRunning(self) -> bool
Gets whether a command is running.
IsTransparent
@property
def IsTransparent(self) -> bool
Gets whether the command running was started inside another, as 'ZOOM typed at LINE's next point.
IsWindowOpen
@property
def IsWindowOpen(self) -> bool
Gets whether the implied window asks its opposite corner, "Specify opposite corner or [Fence/WPolygon/CPolygon]:".
IsWindowing
@property
def IsWindowing(self) -> bool
Gets whether the implied window runs (CadCommandSession.StartWindow), at its opposite corner or as the fence or polygon it was turned into: the canvas snaps none of its points.
LastCommandName
@property
def LastCommandName(self) -> str
Gets the name of the command run last, which Enter with no command running runs again.
LastOutcome
@property
def LastOutcome(self) -> CadCommandOutcome | None
Gets how the command run last ended; null before any.
LastPoint
@property
def LastPoint(self) -> GeoPoint2
Gets the last point given to a prompt, which a typed @dx,dy is measured from (AutoCAD's LASTPOINT).
LastSegment
@property
def LastSegment(self) -> GeoVector2 | None
Gets the way the last segment drawn ran at its end, a line or an arc of LINE, ARC or a continued arc, as a unit vector: what ARC's Enter continues along, and what the window counts polar angles from under POLARMODE 1; null where none has been drawn. After a line from (0, 0) to (30, 40) it is (0.6, 0.8).
Lisp
@property
def Lisp(self) -> LispInterpreter
Gets the AutoLISP interpreter of this document, made on first use: what a routine defines is seen by this document alone. load searches CadDocument.SupportFolders, read each time the interpreter is asked for, then the program's Lisps folder (CadSupportKind.Lisps), and rtos and angtos take the document's LUNITS, LUPREC, AUNITS, AUPREC and DIMZIN.
LispCommandNames
@property
def LispCommandNames(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the names of the commands AutoLISP routines defined with defun c:name, without c:, sorted by ordinal comparison; empty where no AutoLISP has run.
LoadSecurity
@property
def LoadSecurity(self) -> CadLoadSecurity
@LoadSecurity.setter
def LoadSecurity(self, value: CadLoadSecurity) -> None
Gets or sets the gate every file of code this session loads goes through: SECURELOAD, TRUSTEDPATHS and LEGACYCODESEARCH, which the variables of those names read and set. A session of the library has an instance of its own at SECURELOAD 0, so what it loads is as it was before the gate; the window gives all its sessions one shared instance made from the Global settings. load and what is built on it (APPLOAD, the startup files) ask it for each file, and findfile and load_dialog ask it where to look.
LoadedLispFiles
@property
def LoadedLispFiles(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the AutoLISP files loaded into this document, as full paths in the order they were first loaded (LispInterpreter.LoadedFiles): by CadCommandSession.LoadLisp, by (load) and by the startup files; empty where no AutoLISP has run.
MatchProperties
@property
def MatchProperties(self) -> CadMatchProperties
@MatchProperties.setter
def MatchProperties(self, value: CadMatchProperties) -> None
Gets or sets the properties MATCHPROP copies, as the check boxes of its Property Settings dialog: every one until changed, as in AutoCAD. With Layer alone left checked, MATCHPROP moves the objects to the source's layer and keeps their colour.
Overkill
@property
def Overkill(self) -> CadOverkillSettings
@Overkill.setter
def Overkill(self, value: CadOverkillSettings | None) -> None
Gets or sets the settings OVERKILL and -OVERKILL keep from one run to the next, as AutoCAD keeps them: the tolerance, the properties ignored, and what is done with polylines and with overlaps. The defaults until changed.
ParametersShown
@property
def ParametersShown(self) -> bool
@ParametersShown.setter
def ParametersShown(self, value: bool) -> None
Gets or sets whether the Parameters Manager palette is shown, which PARAMETERSSTATUS reads; the window sets it as it shows or closes the palette.
PickAperture
@property
def PickAperture(self) -> float
@PickAperture.setter
def PickAperture(self, value: float) -> None
Gets or sets how near a picked point must come to an object to pick it, in drawing units: the pick box in pixels divided by the view's pixels per unit. 3 until set.
PlotStamp
@property
def PlotStamp(self) -> CadPlotStamp
@PlotStamp.setter
def PlotStamp(self, value: CadPlotStamp) -> None
Gets or sets the plot stamp -PLOTSTAMP sets, off until CadPlotStamp.On is set; PLOT, -PLOT, EXPORTPDF and -EXPORT hand a copy of it to the PDF they write while it is on, as AutoCAD stamps every plot. A session starts with a stamp of its own; a host that has several drawings gives them one to share.
Progress
@property
def Progress(self) -> CadProgress
@Progress.setter
def Progress(self, value: CadProgress | None) -> None
Gets or sets the progress meter a command shows long work on (CadCommandContext.Progress): one of this session's own, shown nowhere, until set; the window sets the one of its status bar.
Prompt
@property
def Prompt(self) -> CadPrompt | None
Gets the prompt waiting for an answer, or null when no command runs.
PromptText
@property
def PromptText(self) -> str
Gets the text the command line shows: the prompt's, or empty when no command runs; (_> while a line of AutoLISP waits for its closing parenthesis.
RecentInput
@property
def RecentInput(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the answers typed at prompts of the kind the prompt waiting asks, the newest first and each once, ten at most: points typed at a prompt for a point (as 100,0, @0,50 or a distance along the rubber band), numbers at one for a distance, an angle or a whole number, written in the drawing's units (100.0000,0.0000 at LUNITS 2 and LUPREC 4), and at Select objects the sets of objects answered, "Selection set (2 items)". A point picked on the canvas and an option keyword are not kept. After LINE's 0,0 then 100,0, the next point offers 100.0000,0.0000 and 0.0000,0.0000; empty where the prompt asks for something else or no command runs.
Registry
@property
def Registry(self) -> CadCommandRegistry
Gets the commands it knows.
Remembered
@property
def Remembered(self) -> System.Collections.Generic.Dictionary[str, float]
Gets the values the commands remember from one run to the next, by name, as TEXT the height last typed ("text.height"); a host sets a default here, as Global settings sets the text height of TEXT and MTEXT, their width factor ("text.widthFactor") and the height of the text of the dimensions DIM* makes ("dim.text.height").
SelectionFilter
@property
def SelectionFilter(self) -> CadSelectionFilter
Gets the filter FILTER edits and applies: its current lines and the lists saved under a name.
SheetSetFound
@property
def SheetSetFound(self) -> str
Gets the file of the sheet set CadCommandSession.LocateSheetSet found for the drawing, as SSFOUND says it; empty where none was looked for or found. Not kept with the drawing.
SheetSetOptions
@property
def SheetSetOptions(self) -> CadSheetSetOptions
@SheetSetOptions.setter
def SheetSetOptions(self, value: CadSheetSetOptions) -> None
Gets or sets the Sheet Set Manager's variables SSLOCATE, SSMAUTOOPEN, SSMPOLLTIME and SSMSHEETSTATUS. A session starts with a set of its own; a host that has several drawings gives them one to share and keeps its values in the settings.
SnapAperture
@property
def SnapAperture(self) -> float
@SnapAperture.setter
def SnapAperture(self, value: float) -> None
Gets or sets the aperture of the object snap in drawing units, 10 pixels over the zoom as the canvas sets it with the cursor: how near an object must lie to a point typed after an override (CadCommandSession.SnapOverride) to be snapped.
SnapOverride
@property
def SnapOverride(self) -> CadSnapModes | None
@SnapOverride.setter
def SnapOverride(self, value: CadSnapModes | None) -> None
Gets or sets the object snap taken for the next point alone (the window sets it with its own override): a point typed at a prompt for a point, at "Select objects:", at a prompt for one object, at a corner of a window and at a point of a fence or a polygon is snapped to the snap point of the object under it, within CadCommandSession.SnapAperture, as AutoCAD 2021 snaps it, the point of an object found however far from the typed point it lies: with END, an aperture of 1.3 and a line from (0, 0) to (100, 0), 30,1 gives (0, 0) and 70,1 gives (100, 0), but 50,3 gives "No Endpoint found for specified point." and then the words of the prompt it was typed at ("Invalid point.", "*Invalid selection*" at "Select objects:", "Invalid window specification." at a corner, "Invalid response." at a fence), and the prompt is asked again. The override is for one point: it is cleared once a point is typed. ENDpoint, MIDpoint, CENter, QUAdrant, NODe, INSert, NEArest, PERpendicular, TANgent and GCEnter are taken; INTersection and APPint take the crossing of two objects under the point, or where one lies there ask " and" for the second, answered by a point on it, and with the objects not crossing say "No Intersection found for specified point."; EXTension and PARallel, which need the cursor to rest on an object, find nothing at a point typed. Where a snap has no name in AutoCAD's words (NEArest, TANgent, GCEnter, APPint, EXTension, PARallel) it says "No found for specified point." NONe leaves the point as typed. Null for none.
SpellDictionaryPath
@property
def SpellDictionaryPath(self) -> str | None
@SpellDictionaryPath.setter
def SpellDictionaryPath(self, value: str | None) -> None
Gets or sets the custom dictionary file SPELL starts with, AutoCAD's sample.cus form of words one to a line: read where it exists, and the file Add to Dictionary appends to, made where it is not there; null, until set, for none, SPELL then asking for one as before. The window sets the file in its settings folder.
TemporaryTrackPoints
@property
def TemporaryTrackPoints(self) -> System.Collections.Generic.IReadOnlyList[GeoPoint2]
Gets the temporary track points (TT) given for the point asked now, the oldest first: the window acquires each for object snap tracking, as AutoCAD does, so that lines run from it level and upright, or on the polar angles, while OTRACK is on. They are let go once a point is given or the command ends.
Tolerance
@property
def Tolerance(self) -> Tolerance
@Tolerance.setter
def Tolerance(self, value: Tolerance) -> None
Gets or sets the tolerance of the commands' checks, as whether two points given are one; Tolerance.Default until set.
Ucs
@property
def Ucs(self) -> CadUcs
Gets the user coordinate system the prompts work in, the document's CadUcsManager.Working: a point typed as x,y, @dx,dy or @distance\<angle is in it, one typed after a * in the world's, and an angle given is measured from its X axis. Points given to the commands are world points all the same: in a system turned a quarter turn, @100<0 from (0, 0) is the world point (0, 100).
View
@property
def View(self) -> CadView | None
@View.setter
def View(self, value: CadView | None) -> None
Gets or sets the view of the canvas, which ZOOM and PAN change; null where there is none, as in a test.
Events
PromptChanged
@property
def PromptChanged(self) -> System.EventHandler[System.EventArgs]
@PromptChanged.setter
def PromptChanged(self, value: System.EventHandler[System.EventArgs]) -> None
Raised when the prompt changes: a command started, a prompt answered, a command ended.
UiRequested
@property
def UiRequested(self) -> System.EventHandler[CadUiRequestEventArgs]
@UiRequested.setter
def UiRequested(self, value: System.EventHandler[CadUiRequestEventArgs]) -> None
Raised when a command asks the window for something: PROPERTIES, LAYER, OPTIONS, QSAVE.
Methods
CountAngle
def CountAngle(self, direction: float) -> float
Counts a direction as the drawing counts angles, for a readout or a default in angle brackets: from ANGBASE, clockwise with ANGDIR 1, from nought up to a whole turn, as AutoCAD's DIST writes 90 for a line drawn east in a drawing whose angles are counted from north, clockwise.
CycleGripOption
def CycleGripOption(self) -> bool
Ctrl cycling of a multi-functional grip, as AutoCAD 2021's help describes it: with the grip hot and the first point not yet given, each press goes to the next option of the grip's menu (CadGripMenus.Of, the grey items left out) and back to the first after the last. The vertex of a polyline goes from Stretch ("** STRETCH **") to Add Vertex ("** ADD VERTEX **"), Remove Vertex ("** REMOVE VERTEX **", "Pick to remove vertex:") and Stretch again; the middle of a straight segment from Stretch to Add Vertex, Convert to Arc and Stretch (Convert to Line, "Pick to convert to line segment:", for an arc segment). The option left is dropped as Esc would drop it, writing nothing, and the grip stays hot. Nothing cycles once the grip edit has changed the drawing (Add Vertex with Copy on, a vertex made), with several hot grips, or for a grip whose menu has fewer than two items; the host decides whether Ctrl is heard (the canvas by GRIPMULTIFUNCTIONAL's bit 1).
EndWindow
def EndWindow(self) -> bool
Ends the implied window at its opposite corner without selecting, the prompt kept in the history as a click answers it: the canvas that picked the corner selects with the box it shows, Shift and a twisted viewport with it.
Enter
def Enter(self) -> None
Enter or Space with nothing typed: the prompt's default, the end of a selection, the end of a command that draws on until Enter (LINE); with no command running, the command run last again.
Escape
def Escape(self) -> None
Esc: ends the command running, keeping what it made, with "*Cancel*" in the history; while a line of AutoLISP waits for its closing parenthesis it drops that line alone and the command goes on asking, as AutoCAD does; at a question of an AutoLISP routine (getpoint, entsel) the routine gets Function cancelled, as it would in AutoCAD.
Feed
def Feed(self, point: GeoPoint2) -> bool
Answers the prompt with a point picked on the canvas (already snapped). At "Select objects:" it picks the object nearest the point within CadCommandSession.PickAperture.
def Feed(self, text: str) -> bool
Takes text typed on the command line and Enter: with no command running, the name of one to start (or Enter alone running the last again); else the answer to the prompt, a keyword by its capital letters, a number, a point as x,y, @dx,dy, @distance\<angle or distance<angle, a number alone at a point prompt being a distance along the rubber band towards the cursor. At "Select objects:" the options of AutoCAD 2021: ALL every object of the space, Window, Crossing and BOX by two corners, Fence, WPolygon and CPolygon by points until Enter, Last the object made last, Previous the objects the command before took, Group by name, Remove and Add to take out and put in, Undo the last change, Multiple points until Enter, SIngle to end with the first objects taken, AUto; a point typed there picks as a click does, "Select objects: 50,0" then "1 found", and where it hits nothing starts the window as AutoCAD 2021 does, "Select objects: -50,-50" then "Specify opposite corner:"; anything else is "*Invalid selection*" with the options listed. A point modifier, FROM, M2P, TT, TK or a point filter, starts at a prompt for a point or for objects (CadCommandSession.StartPointModifier). A point typed after an object snap override is snapped to the object under it, or refused where none is found (CadCommandSession.SnapOverride). 'PAN or 'ZOOM typed at any prompt but one for text runs inside the command waiting (CadCommandSession.IsTransparent).
def Feed(self, point: GeoPoint2, shift: bool) -> bool
Answers the prompt with a point picked on the canvas, as CadCommandSession.Feed does, saying whether Shift was held: at a prompt for one object the answer carries it (CadInput.Shift), as TRIM extends an object picked with Shift held, and EXTEND trims one; at "Select objects:" the object picked is taken out of the objects gathered, as AutoCAD takes it out. At any other prompt Shift changes nothing.
def Feed(self, snapped: CadSnapResult, control: bool) -> bool
Answers the prompt with a point an object snap gave on the canvas, as CadCommandSession.Feed answers with its point, keeping which snap and which object gave it: a dimension made with DIMASSOC 2 ties the point to the object, as AutoCAD ties a point picked with ENDpoint, MIDpoint, CENter, QUAdrant, NODe or NEArest. The end of a line snapped with ENDpoint at the first prompt of DIMLINEAR ties the dimension's first point to that end.
def Feed(self, point: GeoPoint2, shift: bool, control: bool) -> bool
Answers the prompt with a point picked on the canvas, as CadCommandSession.Feed does, saying whether Ctrl was held too: at a prompt for a point, a distance or an angle the answer carries it (CadInput.Control), as ARC draws an arc whose end is picked with Ctrl held clockwise rather than counter-clockwise, and a grip edit takes its first point picked with Ctrl held as Copy.
FeedRecentInput
def FeedRecentInput(self, index: int) -> bool
Answers the prompt waiting with an entry of CadCommandSession.RecentInput, as the Recent Input menu does: the text typed again, or at Select objects the set of objects again, those of it that are still in the drawing.
FeedSelection
def FeedSelection(self, handles: System.Collections.Generic.IEnumerable[str], remove: bool = ...) -> bool
Answers "Select objects:" with objects picked by a click, a window or a crossing box, or with Shift held takes them out of those gathered: "1 found, 1 removed, 2 total". At "Remove objects:" they are taken out either way. At a prompt for one object, the first.
def FeedSelection(
self,
handles: System.Collections.Generic.IEnumerable[str],
window: DisplayBox,
crossing: bool,
remove: bool = ...,
) -> bool
Answers "Select objects:" with the objects a window or crossing box dragged on the canvas took, as CadCommandSession.FeedSelection does, the box kept with them: -ATTEDIT then takes only the attributes of an INSERT that lie inside the window, or that the crossing box touches, as AutoCAD's does.
IsLispInput
def IsLispInput(self, line: str) -> bool
Gets whether text typed at the command line is AutoLISP: a line of it waits for more, or the text starts with (, a form, or !, the value of a variable. A bare word or number at the Command prompt is a command. While a routine waits for an answer, or for a command it started, nothing is AutoLISP: AutoCAD does not run LISP inside LISP, and the text goes to the prompt as typed.
LoadLisp
def LoadLisp(self, path: str) -> bool
Loads an AutoLISP file as APPLOAD does: the lines the file wrote, then name.lsp successfully loaded., or the ; error: line an error gave, which leaves what the file ran before it.
LocateSheetSet
def LocateSheetSet(self) -> str
Finds the sheet set of the drawing, as AutoCAD does when a drawing opens with SSLOCATE on: the sheet set mark the drawing carries (CadSheetSetHint) names the set's file, which is looked for where it says and, if it is not there, as far from the drawing as the mark says it was, so that a set moved with its sheets is found. The file is CadCommandSession.SheetSetFound and the window is asked (the request SSLOCATE, a CadSheetSetRequest) to open the set in the Sheet Set Manager, and to show the manager where SSMAUTOOPEN is on. The host calls it when it has opened a drawing.
OpenUndoStep
def OpenUndoStep(self) -> None
Opens the undo step of the command running now, so that a setting changed through CadDocument.ApplySetting by the window while the command asks (GRID turning the grid on after its spacing) joins the command's step; does nothing where no command runs.
Start
def Start(self, command: CadCommand) -> bool
Starts a command that is not in the registry, as a host does for the question of a script: its prompts, Esc, the rubber band and the object snaps are those of any command. Leaves CadCommandSession.LastCommandName as it was, so Enter repeats the last command the user ran. Refused while a command runs.
def Start(self, typed: str) -> bool
Starts a command by its name or alias, ending any command running first as Esc would, as often as it takes (a form waiting at its prompt, then the command it interrupted).
StartGripAction
def StartGripAction(self, handle: str, gripIndex: int, action: CadGripAction) -> bool
Starts an item of a multi-functional grip's hover menu (CadGripMenus.Of), as a choice in AutoCAD 2021's menu starts it. Stretch and Stretch Vertex are the grip edit of CadCommandSession.StartGripEdit, asking "** STRETCH **" as AutoCAD's table of the polyline's grip modes does. Add Vertex asks "** ADD VERTEX **" and "Specify new vertex point or [Base point/Copy/Undo/eXit]:", the polyline drawn with the vertex at the cursor, and puts the vertex after the grip's vertex (with Copy on it asks again, each vertex after the last, until eXit or Enter; Undo takes the last one back). Convert to Arc asks "** CONVERT TO ARC **" and "Specify midpoint of arc segment:" and makes the segment the arc through the point; Convert to Line makes the arc segment straight at once, asking nothing. Remove Vertex takes the vertex out at once, asking nothing (a spline's fit point or control vertex likewise). A line's or an arc's end offers Lengthen ("** LENGTHEN **", "Specify end point:"), the middle of an arc Radius ("** RADIUS **", "Specify radius:"), a hatch Hatch Scale, Hatch Angle and Origin Point, a spline's point its own Add Vertex ("** ADD FIT POINT **" or "** ADD CONTROL VERTEX **"). Lengthen and Radius also have Copy and Undo. A linear dimension's grips offer Continue Dimension and Baseline Dimension (the row DIMCONTINUE or DIMBASELINE makes), its arrowheads Flip Arrow ("** FLIP ARROW**", "Pick to flip arrowhead:"), the grip of its words Move Text Only, Move with Leader, Move with Dim Line, Above Dim Line, Center Vertically and Reset Text Position. Every item is one undo step, and Esc at a prompt changes nothing.
StartGripEdit
def StartGripEdit(
self,
hotGrips: System.Collections.Generic.IEnumerable[System.Collections.Generic.KeyValuePair[str, int]],
) -> bool
Starts a grip edit, as a click on a grip starts AutoCAD's with no command running: the grips given are hot, the first the one clicked, and the command line asks "** STRETCH **" and "Specify stretch point or [Base point/Copy/Undo/eXit]:". Enter or Space goes on to MOVE, ROTATE, SCALE and MIRROR and back to STRETCH; STRETCH, MOVE, ROTATE, SCALE and MIRROR, or ST, MO, RO, SC and MI, typed go to that mode. STRETCH moves the hot grips together by the way from the base point, the first hot grip until Base point gives another; the other modes move, turn, scale or mirror the objects selected. Copy leaves the originals and asks again until eXit, Enter or Esc, as does a first point picked with Ctrl held (CadCommandSession.Feed). The whole grip edit is one undo step; the command run last stays the one Enter runs again. With one hot grip that has a menu of two items or more, CadCommandSession.CycleGripOption goes on to its next option.
StartPointModifier
def StartPointModifier(self, typed: str) -> bool
Starts a point modifier at a prompt that takes a point, as AutoCAD's: FROM (or FRO) asks "Base point:" then "<Offset>:" and gives the offset point, an offset typed as @dx,dy or @distance\<angle being measured from the base point; M2P or MTP asks "First point of mid:" and "Second point of mid:" and gives the point midway; TT asks "Specify temporary OTRACK point:" and asks the first prompt again with tracking lines from the point (CadCommandSession.TemporaryTrackPoints); TK (TRACK, TRACKING) asks "First tracking point:" then "Next point (Press ENTER to end tracking):" until Enter, each point taken square from the one before along the axis it lies farther along, upright where it lies as far along both (a distance typed going along the axis nearest the cursor), and gives the last; .X, .Y, .Z, .XY, .XZ or .YZ asks "of" a point whose coordinates named are kept, then "(need YZ):" for the rest, a point whose coordinates asked are taken, or where one is asked a number alone. Coordinates are those of the CadCommandSession.Ucs, and Z, which a plan has none of, is asked as AutoCAD asks it and left out. A modifier typed at a modifier's prompt nests in it, as FROM with M2P for its base point, and each point may be snapped; AutoCAD 2021 takes TT and TK only at the command's own prompt or inside M2P, inside TT and TK only M2P, and M2P not inside M2P; one it does not take is text that is no point, refused as that is, as the window's menu says it too. What is no point AutoCAD's way too: Enter or text at TT's or a filter's prompt, and Enter at FROM's, is answered by the prompt they were typed at, as text and never as a modifier; FROM and M2P ask again for text, M2P for Enter too; TK says "Invalid 2D point.", at its first prompt going back to the prompt it was typed at. A leading underscore is allowed, as the menu sends "_from". At "Select objects:", at a prompt for one object, and at the corner of a window or the point of a fence, AutoCAD 2021 takes them all the same: the point a modifier gives there picks as a click does, "Select objects: _from", "Base point: 0,-10", "<Offset>: @50,10" then "1 found", or, lying on no object, is the first corner of the window, "Specify opposite corner:"; TT gives nothing and "Select objects:" is asked again; text no modifier takes is refused as that prompt refuses it, "*Invalid selection*" and the options listed. A line of 100,50 FROM with the offset @30,20 starts at (130, 70); M2P between (0, 0) and (100, 40) gives (50, 20); TK from (100, 0) to (130, 50) gives (100, 50); .X of (30, 999) with (888, 40) at "(need YZ):" gives (30, 40), and with 40,3 gives (30, 3).
StartTool
def StartTool(self, tool: CadTool, at: GeoPoint2 | None = ...) -> bool
Runs a tool of a tool palette, as clicking it does in AutoCAD. A command tool starts the command of its line, with the answers the line gives to its first prompts fed in; a hatch tool starts HATCH with the tool's pattern, angle and scale; a block tool starts INSERT with its block, scale and rotation, asking the insertion point on the command line (and the scale and rotation, where the tool prompts for them). The tool's layer, colour, linetype and lineweight are the current ones while the command runs, and the drawing's are put back when it ends or is cancelled. A command running is ended first, as Esc would.
StartWindow
def StartWindow(self, corner: GeoPoint2) -> bool
Starts the implied window, as a click on nothing at the Command prompt starts AutoCAD's: the command line asks "Specify opposite corner or [Fence/WPolygon/CPolygon]:", a point given as a click or typed ends the box, left to right a window and right to left a crossing, and the objects it takes are selected. F, WP or CP turns the box into a fence or a polygon whose first point is the corner, asking "Specify next fence point or [Undo]:" or "Specify endpoint of line or [Undo]:" until Enter. A box from (0, 0) with the opposite corner typed 110,110 selects the lines wholly inside it. The history keeps the prompt after "Command:", as AutoCAD's does, and Esc ends it with "*Cancel*". The command run last stays the one Enter runs again.
At a command's "Select objects:" (or "Remove objects:") the same window is asked inside the command, as AutoCAD asks it there: the history keeps "Select objects: Specify opposite corner or [Fence/WPolygon/CPolygon]: 110,60", what the box, fence or polygon takes is gathered for the command (or taken out), and "Select objects:" is asked again. ERASE with a box from (-10, -10) to (110, 60) over two lines of 100 and 50 gathers both, "2 found". Esc there cancels the command.
TogglePickStyle
def TogglePickStyle(self) -> None
Ctrl+Shift+A: switches the picking of groups whole (CadDocument.PickStyle) off where it is on and on where it is off, writing "<Group off>" or "<Group on>" as AutoCAD does; a command running goes on.
ToggleSelectionCycling
def ToggleSelectionCycling(self) -> None
Switches selection cycling (CadDocument.SelectionCycling) off, or on again as 2, writing "<Selection Cycling off>" or "<Selection Cycling on>" as AutoCAD does.
Write
def Write(self, line: str) -> None
Writes a line into the history.