After seeing the feedback regarding this interesting feature in AutoCAD 2013, I decided to do a little detective work to establish which commands could be called from inside the AutoCAD 2013 Core Console. I hope this proves to be of use to at least some of the many people I expect to take advantage of this tool.
Before I go into the details on generating the list – and then look at the list itself – it’s worth mentioning some additional background regarding this feature. I certainly see the Core Console as being extremely useful to many people, but it didn’t necessarily start life as a headline feature for the 2013 release. It was made possible by the Big Split, and proved to be a good, early way to test out the capabilities of AcCore.dll, but it only became part of the product later in the product cycle. It’s been used to implement at least one core feature inside AutoCAD 2013 – and I can certainly see it as being used much more extensively, over time – but this is a tool that has not yet benefited from much documentation investment (for instance). And – as we’ll see later on – there are even some areas you just want to avoid: our test suite includes various commands to ensure our internal developers don’t break important Core Console functionality, but there are full AutoCAD commands that currently prove problematic when executed from within the Core Console.
Generating the list was an interesting process: I started by implementing a core .NET module that read in the commands to test from a file (for AutoCAD OEM we maintain a list of AutoCAD commands in a file called OEMCMDS.txt, which I borrowed for this process). This module then queued up each command using SendStringToExecute() and fired off a simple AutoLISP function right after to check whether the command was active via CMDNAMES (or whether it was a sysvar – these are also included in the list) before cancelling the command (if it was still running) via an escape character. The LISP function wrote the name of the command or sysvar to the relevant file (for known or unknown commands). I also piped the output of the Core Console execution off to another text file, to help cross-check any issues.
This worked well enough, but didn’t show whether commands that succeeded and returned without any user input worked or not (it assumed they did not, as they were no longer active). So I went back to the drawing board and attached some event handlers from C# to watch for commands that started and those that weren’t found. These ended up proving much more reliable for commands, but less reliable for system variables.
Speaking of system variables: these have apparently not been stripped out of the Core Console, but many of the commands (and internal code) that use them won’t be available, so please adjust your expectations accordingly.
Here’s the C# code I used to generate the command lists:
using Autodesk.AutoCAD.ApplicationServices.Core;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace TestCommandsForCoreConsole
{
public class Commands
{
// Lists to be populated by our events
List<string> _found = null;
List<string> _notFound = null;
// Command to test the various commands in the console
[CommandMethod("TCS")]
public void TestCommands()
{
Document doc =
Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
// Create or clear our command lists
if (_found == null)
_found = new List<string>();
else
_found.Clear();
if (_notFound == null)
_notFound = new List<string>();
else
_notFound.Clear();
// Attach our event handlers
doc.UnknownCommand +=
new UnknownCommandEventHandler(OnUnknownCommand);
doc.CommandWillStart +=
new CommandEventHandler(OnCommandWillStart);
// Read in the list of commands to execute
var values =
from l in File.ReadAllLines(
"c:\\users\\walmslk\\desktop\\OEMCMDS.TXT"
)
let cols = l.Split(new[] { ';' })
select new { Command = cols.First() };
foreach (var obj in values)
{
doc.SendStringToExecute(
obj.Command + " \x1B", false, true, true
);
}
// Dump our collected commands out to text files
doc.SendStringToExecute("DUMPCMDS ", false, true, true);
}
void OnCommandWillStart(object sender, CommandEventArgs e)
{
string cmd = e.GlobalCommandName;
if (!_found.Contains(cmd) &&
(cmd != "SETVAR" || cmd != "DUMPCMDS")
)
{
_found.Add(cmd);
if (_notFound.Contains(cmd))
_notFound.Remove(cmd);
}
}
void OnUnknownCommand(object sender, UnknownCommandEventArgs e)
{
string cmd = e.GlobalCommandName;
if (!_notFound.Contains(cmd))
_notFound.Add(cmd);
}
void WriteCommands(List<string> cmds, string answer)
{
StreamWriter sw =
new StreamWriter(
"c:\\users\\walmslk\\desktop\\events-" + answer + ".txt"
);
using (sw)
{
foreach (string cmd in cmds)
{
sw.WriteLine(cmd);
}
sw.Close();
}
}
[CommandMethod("DUMPCMDS")]
public void DumpCommands()
{
_found.Sort();
_notFound.Sort();
WriteCommands(_found, "yes");
WriteCommands(_notFound, "no");
Document doc =
Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
doc.UnknownCommand -=
new UnknownCommandEventHandler(OnUnknownCommand);
doc.CommandWillStart -=
new CommandEventHandler(OnCommandWillStart);
ed.WriteMessage(
"\nFound a total of {0} commands, didn't find {1} others.",
_found.Count, _notFound.Count
);
}
}
}
Here’s a list of the 573 commands I found to be available in the Core Console (and here they are as a text file):
?, +CONSTRAINTSETTINGS, +PUBLISH, +SAVEAS, +UCSMAN, +VPORTS, 3DALIGN, 3DCLIP, -3DCONFIG, 3DCONFIG, 3DCORBIT, 3DDISTANCE, 3DDWF, 3DDWFPUBLISH, 3DEDITBAR, 3DFACE, 3DFLY, 3DFORBIT, 3DMESH, 3DMOVE, 3DORBIT, 3DORBITCTR, 3DORBITTRANSPARENT, -3DOSNAP, 3DOSNAP, 3DPAN, 3DPAN2, 3DPANTRANSPARENT, 3DPOLY, 3DROTATE, 3DSCALE, 3DSWIVEL, 3DSWIVELTRANSPARENT, 3DWALK, 3DZOOM, 3DZOOM2, 3DZOOMTRANSPARENT, ABOUT, ACADWBLOCKDIALOG, ACGZDRAGACTION, ACISIN, ACISOUT, ACTMDRAGACTION, ACUCSEDITACTION, ADDSELECTED, AECDISPLAYMANAGERCONFIGSSELECTION, -AECDWGUNITS, -AECEXPORTTOAUTOCAD, AECFILEOPENMESSAGE, AECFILESAVEMESSAGE, AECOBJECTCOPYMESSAGE, AECOBJRELDUMP, AECOBJRELSHOW, AECOBJRELUPDATE, AECPOSTDXFINFIX, AECSETXREFCONFIG, AECVERSION, AI_EMPTYPRINC, AI_MOLC, AI_VIEWPORTS_ALERT, AIDIMFLIPARROW, AIDIMPREC, AIDIMSTYLE, AIDIMTEXTMOVE, AIMLEADEREDITADD, AIMLEADEREDITREMOVE, AIOBJECTSCALEADD, AIOBJECTSCALEREMOVE, ALIGN, ALLPLAY, AMECONVERT, ANNORESET, ANNOUPDATE, APERTURE, ARC, AREA, -ARRAY, ARRAY, -ARRAYCLOSE, ARRAYCLOSE, ARRAYEDIT, ARRAYPATH, ARRAYPOLAR, ARRAYRECT, ARX, -ATTDEF, ATTDEF, ATTDISP, -ATTEDIT, ATTEDIT, -ATTEXT, ATTEXT, AUDIT, AUTOCOMPLETE, AUTOCONSTRAIN, AUTOPUBLISH, BASE, -BHATCH, BHATCH, BLEND, -BLOCK, BLOCK, BLOOKUPTABLE, BMAKE, BMOD, BMPOUT, -BOUNDARY, BOUNDARY, BOX, BPOLY, BREAK, BREP, CAL, CELLSELECT, CHAMFER, CHAMFEREDGE, CHANGE, CHPROP, CIRCLE, CLASSICGROUP, CLASSICXREF, CLEANSCREENOFF, CLEANSCREENON, CLIP, CLOSEALL, -COLOR, COLOR, COMPILE, CONE, CONSTRAINTBAR, CONSTRAINTSETTINGS, CONVERT, CONVERTPOLY, CONVTONURBS, CONVTOSOLID, CONVTOSURFACE, COPY, COPYBASE, COPYCLIP, COPYHIST, COPYLINK, -COPYTOLAYER, COPYTOLAYER, CUTCLIP, CVADD, CVHIDE, -CVREBUILD, CVREBUILD, CVREMOVE, CVSHOW, CYLINDER, -DATAEXTRACTION, DATAEXTRACTION, DATALINK, DATALINKUPDATE, DBLIST, DCALIGNED, DCANGULAR, DCCONVERT, DCDIAMETER, DCDISPLAY, DCFORM, DCHORIZONTAL, DCLINEAR, DCRADIUS, DCVERTICAL, DDEDIT, DELAY, DELCONSTRAINT, DGNADJUST, DGNLAYERS, DIM, DIM1, DIMALIGNED, DIMANGULAR, DIMARC, DIMBASELINE, DIMBREAK, DIMCENTER, DIMCONSTRAINT, DIMCONTINUE, DIMDIAMETER, DIMDISASSOCIATE, DIMEDIT, DIMHORIZONTAL, -DIMINSPECT, DIMINSPECT, DIMJOGGED, DIMJOGLINE, DIMLINEAR, DIMORDINATE, DIMOVERRIDE, DIMRADIUS, DIMREASSOCIATE, DIMREGEN, DIMROTATED, DIMSPACE, -DIMSTYLE, DIMSTYLE, DIMTEDIT, DIMVERTICAL, DIST, DISTANTLIGHT, DIVIDE, DONUT, DOUGHNUT, DRAGMODE, DRAWORDER, DROPGEOM, DTEXT, DUMPCMDS, DVIEW, -DWFADJUST, DWFADJUST, -DWFATTACH, DWFATTACH, DWFCLIP, DWFFORMAT, DWFLAYERS, DXBIN, DXFIN, DXFOUT, -EATTEXT, EATTEXT, EDGESURF, EDITTABLECELL, ELEV, ELLIPSE, END, EPLOTEXT, ERASE, EXPLODE, -EXPORT, EXPORT, EXPORTDWF, EXPORTDWFX, EXPORTPDF, EXPORTSETTINGS, EXTEND, EXTRUDE, FILEOPEN, FILL, FILLET, FILLETEDGE, FLATSHOT, FREESPOT, FREEWEB, GCCOINCIDENT, GCCOLLINEAR, GCCONCENTRIC, GCEQUAL, GCFIX, GCHORIZONTAL, GCPARALLEL, GCPERPENDICULAR, GCSMOOTH, GCSYMMETRIC, GCTANGENT, GCVERTICAL, GEOMCONSTRAINT, GRADIENT, -GRAPHICSCONFIG, GRAPHICSCONFIG, GRAPHSCR, GRID, -GROUP, GROUP, GROUPEDIT, -HATCH, HATCH, -HATCHEDIT, HATCHEDIT, HATCHGENERATEBOUNDARY, HATCHSETBOUNDARY, HATCHSETORIGIN, HATCHTOBACK, HELIX, HELP, HIDE, HIDEOBJECTS, ID, -IMAGE, -IMAGEADJUST, IMAGECLIP, IMAGEQUALITY, IMPLIEDFACEX, IMPORT, IMPRINT, -INSERT, INSERT, -INTERFERE, INTERFERE, INTERSECT, ISOLATEOBJECTS, ISOPLANE, JOIN, JPGOUT, JUSTIFYTEXT, LAYCUR, -LAYDEL, LAYDEL, -LAYER, LAYERCLOSE, LAYERP, LAYERPMODE, LAYFRZ, LAYISO, LAYLCK, -LAYMCH, LAYMCH, LAYMCUR, -LAYMRG, LAYMRG, LAYOFF, LAYON, -LAYOUT, LAYOUT, LAYTHW, LAYULK, LAYUNISO, LAYVPI, LEADER, LENGTHEN, LIGHT, LIMITS, LINE, -LINETYPE, LINETYPE, LIST, LIVESECTION, LOAD, LOFT, LOGFILEOFF, LOGFILEON, LTSCALE, -LWEIGHT, LWEIGHT, MASSPROP, MATCHCELL, MEASURE, MEASUREGEOM, MESH, MESHCAP, MESHCOLLAPSE, MESHCREASE, MESHEXTRUDE, MESHMERGE, MESHOPTIONS, MESHPRIMITIVEOPTIONS, MESHREFINE, MESHSMOOTH, MESHSMOOTHLESS, MESHSMOOTHMORE, MESHSPIN, MESHSPLIT, MESHUNCREASE, MINSERT, MIRROR, MIRROR3D, MLEADER, MLEADERALIGN, MLEADERCOLLECT, MLEADERCONTENTEDIT, MLEADEREDIT, MLINE, MODEL, MOVE, MREDO, MTEDIT, -MTEXT, MTEXT, MTPROP, MULTIPLE, NAVBAR, NAVVCUBE, NCOPY, NETLOAD, NEW, -OBJECTSCALE, OFFSET, OOPS, OPEN, OPTCHPROP, ORTHO, -OSNAP, OSNAP, -OVERKILL, PAGESETUP, -PAN, -PARAMETERS, PARAMETERS, PARAMETERSCLOSE, -PARTIALOAD, PARTIALOAD, -PARTIALOPEN, PASTEBLOCK, PASTEORIG, PEDIT, PFACE, PLAN, PLANESURF, PLINE, -PLOT, PLOT, -PLOTSTAMP, -PLOTSTYLE, PNGOUT, POINT, POINTLIGHT, POLYGON, POLYSOLID, PRESSPULL, PREVIEW, PROJECTGEOMETRY, -PSETUPIN, PSETUPIN, PSFILL, PSOUT, PSPACE, -PUBLISH, PUBLISH, -PURGE, PURGE, PYRAMID, QDIM, QLEADER, QNEW, QSAVE, QTEXT, RAY, RECOVER, RECTANG, RECTANGLE, REDO, REDRAW, REDRAWALL, REGEN, REGEN3, REGENALL, REGENAUTO, REGION, -RENAME, RENAME, RESETBLOCK, RESUME, REVCLOUD, REVERSE, REVOLVE, REVSURF, ROTATE, ROTATE3D, RULESURF, SAVE, SAVEAS, SCALE, -SCALELISTEDIT, SCALETEXT, SCRIPT, SECTION, SECTIONPLANE, SECTIONPLANEJOG, SECTIONPLANESETTINGS, SECTIONPLANETOBLOCK, SELECT, SELECTSIMILAR, SEQUENCEPLAY, SETBYLAYER, SETVAR, -SHADE, SHADE, -SHADEMODE, SHADEMODE, SHAPE, SKETCH, SLICE, SNAP, SOLDRAW, SOLID, SOLIDEDIT, SOLPROF, SOLVIEW, SPACEMOUSEACTION, SPACETRANS, SPHERE, SPLINE, SPLINEDIT, SPOTLIGHT, STLOUT, STRETCH, -STYLE, STYLE, SUBTRACT, SURFBLEND, SURFEXTEND, SURFEXTRACTCURVE, SURFFILLET, SURFNETWORK, SURFOFFSET, SURFPATCH, SURFSCULPT, SURFTRIM, SURFUNTRIM, SWEEP, -TABLE, TABLE, TABLEDIT, TABLEEXPORT, TABLESTYLE, TABLET, TABSURF, TARGETPOINT, -TEXT, TEXT, TEXTEDIT, TEXTSCR, TEXTTOFRONT, THICKEN, TIFOUT, TIME, TINSERT, TOLERANCE, TORUS, TRACE, TRANSPARENCY, TRIM, U, UCS, UCSICON, UCSMAN, UNDEFINE, UNDO, UNGROUP, UNION, UNISOLATEOBJECTS, -UNITS, UNITS, UPDATETHUMBSNOW, -VIEW, VIEWBACK, VIEWCUBEACTION, VIEWFORWARD, VIEWGO, VIEWPLAY, VIEWPLOTDETAILS, VIEWPORTS, VIEWRES, -VISUALSTYLES, VPCLIP, VPLAYER, VPMAX, VPMIN, -VPORTS, VPORTS, VSCURRENT, VSSAVE, WALKFLYSETTINGS, -WBLOCK, WBLOCK, WEBLIGHT, WEDGE, WHOHAS, WIPEOUT, WMFIN, WMFOUT, -XBIND, XBIND, XCLIP, XEDGES, XLINE, XOPEN, -XREF, XREF, ZOOM.
Important note: not all of these commands actually do something useful – some simply return directly to the user, where they would otherwise have displayed a dialog, etc. – so you’ll still need to test the commands you need by entering them or by executing your scripts.
I’m not going to list the commands that aren’t available in the Core Console – if the command isn’t in the above list, it’s a fair bet that it isn’t there – but there is another list of commands that is worth mentioning, as they currently cause the Core Console to crash (on my system, at least):
ACTBASEPOINT, ACTMANAGER, ACTRECORD, -ACTSTOP, ACTSTOP, ACTUSERINPUT, -ACTUSERMESSAGE, ACTUSERMESSAGE, ADJUST, CLASSICLAYER, CLOSE, CUI, CUIEXPORT, CUIIMPORT, -DGNATTACH, DGNATTACH, -DGNBIND, DGNCLIP, -LAYER, LAYER, MLEDIT, MLSTYLE, -NAVSMOTION, NAVSMOTION, NAVSMOTIONCLOSE, NAVSWHEEL, OBJECTSCALE, PAN, PASTEASHYPERLINK, PASTECLIP, -PDFADJUST, PDFADJUST, -PDFATTACH, PDFATTACH, PDFCLIP, PDFLAYERS, QCCLOSE, QUICKCALC, QUICKCUI, -QVDRAWING, QVDRAWING, QVDRAWINGCLOSE, -QVLAYOUT, QVLAYOUT, QVLAYOUTCLOSE, RECOVERALL, RIBBON, RIBBONCLOSE, RTPAN, RTZOOM, SCALELISTEDIT, ULAYERS, VTOPTIONS
I hope it goes without saying that these should be avoided – the good news is that they are mostly not commands you’ll need in the Core Console. If you find you do need something from full AutoCAD that’s not on the “working” list – and it’s reasonable to expect would work in a version of AutoCAD with a very limited UI – please do make sure the ADN team is aware (whether by contacting them directly or posting to the AutoCAD .NET Discussion Group).
And then, last but not least, there are just a few commands that actually show some UI when launched from the Core Console (and these clearly need attention from our side):
BESETTINGS, PLOTSTYLE, VLIDE
I hope this little analysis proves to be of use to you when working with the Core Console. In the absence of more formal documentation, we (meaning the ADN team and I) will continue to do our best to make sure you at least have some guidance on how best to work with it.