Excel has enough capabilities to be used as a poor man’s CAD application, not recalling to Windows API to do it (at least not the ones used to draw), which IMHO would be the best way to accomplish full CAD features but could take longer to get working as a whole. Full DXF, SHP, KML,… I/O operations can be done inside the Excel CAD.
A good first reference of what can be done with Excel is this guide.
First, we need to know which are the shapes that we will deal with. So lets draw them in an Excel Worksheet to take a look in their geometry. To do so, we use a VBA macro to generate them, from information in Mso online help.
If we paste the Mso help table in a Worksheet, order them by msoAutoShapeType, we can therun the following VBA code to make the shapes appear (also will show the number of adjustments it has, and the numeration of the connecting sites if desired).
[sourcecode language=”vb”]
Public Sub sShapes_Template()
‘https://msdn.microsoft.com/en-us/vba/office-shared-vba/articles/msoautoshapetype-enumeration-office
‘ConnectionSites are generally distributed from 1=90º in counter clockwise order (from 109 to 136 in clockwise order, and 1=0º)
Dim oCell As Excel.Range
Dim oShpGroup As Excel.Shape
Dim oShp As Excel.Shape
Dim oShpCtr As Excel.Shape
Dim oShpConnector As Excel.Shape
‘Dim oAdjustment As Excel.Adjustments
Dim msoAutoshapeTypeValue As Long
Dim sgHeight As Single
Dim sgWidth As Single
Dim sgLeft As Single
Dim sgTop As Single
Dim lgAdjustment As Long
Dim lgConnector As Long
Const TOP_SIDE As Integer = 1
Const LEFT_SIDE As Integer = 2
Const BOTTOM_SIDE As Integer = 3
Const RIGHT_SIDE As Integer = 4
With ActiveSheet
.Rows(“2:185”).RowHeight = 72
For Each oCell In .Columns(1).SpecialCells(xlCellTypeConstants).Cells
If oCell.Row >= 3 Then
msoAutoshapeTypeValue = oCell.Offset(0, 1).Value
sgHeight = oCell.Height – 10
sgWidth = sgHeight
On Error GoTo NextShp
Set oShp = .Shapes.AddShape(Type:=msoAutoshapeTypeValue, _
Left:=oCell.Left + (2 * sgWidth), _
Top:=oCell.Top + 5, _
Width:=sgWidth, _
Height:=sgHeight)
‘Set new Group
Set oShpGroup = oShp
oShpGroup.Name = “#” & msoAutoshapeTypeValue & “_”
With oShp
With .Fill
.ForeColor.RGB = RGB(255, 255, 0)
.Transparency = 0
End With
With .Line
.DashStyle = msoLineSolid
.Transparency = 0
End With
With .TextFrame
With .Characters
.Text = oShp.Adjustments.Count
.Font.Color = 1
‘.Font.Name = “Garamond”
‘.Font.size = 12
End With
.HorizontalAlignment = xlHAlignCenter
.VerticalAlignment = xlVAlignCenter
End With
End With
‘oCell.Offset(0, 2).Value = oShp.Adjustments.Count
‘If oShp.Adjustments.Count > 0 Then
‘ For lgAdjustment = 1 To oShp.Adjustments.Count
‘ ‘Add adjustment counter
‘ Set oShpConnector = .Shapes.AddShape(msoShapeRectangle, _
‘ oShp.Left, _
‘ oShp.Top + oShp.Heigth, _
‘ oShp.Left + oShp.Width, _
‘ oShp.Top)
‘ Next lgAdjustment
‘End If
oShp.Name = “#” & msoAutoshapeTypeValue
If oShp.ConnectionSiteCount > 0 Then
lgConnector = 0
For lgConnector = 1 To oShp.ConnectionSiteCount
‘Add connector Pointers
Set oShpConnector = .Shapes.AddConnector(msoConnectorCurve, _
0, _
0, _
0, _
0)
With oShpConnector
With .ConnectorFormat
.BeginConnect ConnectedShape:=oShp, ConnectionSite:=lgConnector
.EndConnect ConnectedShape:=oShp, ConnectionSite:=lgConnector
End With
sgLeft = .Left – 10
sgTop = .Top – 10
.Delete
End With
‘Add connector markers
Set oShpCtr = .Shapes.AddShape(Type:=msoShapeOval, _
Left:=sgLeft, _
Top:=sgTop, _
Width:=20, _
Height:=20)
With oShpCtr
.Name = “#” & msoAutoshapeTypeValue & “_” & lgConnector
With .Fill
.Transparency = 1
End With
With .Line
.DashStyle = msoLineDashDotDot
.Transparency = 1
End With
If .Connector Or .Type = msoLine Then
.Line.EndArrowheadStyle = msoArrowheadTriangle
‘ rough approximation of the Excel 2007 preset line style #17
.Line.Weight = 2
.Line.ForeColor.RGB = RGB(192, 80, 77)
.Shadow.Type = msoShadow6
.Shadow.IncrementOffsetX -4.5
.Shadow.IncrementOffsetY -4.5
.Shadow.ForeColor.RGB = RGB(192, 192, 192)
.Shadow.Transparency = 0.5
.Visible = msoTrue
End If
With .TextFrame
With .Characters
.Text = lgConnector
.Font.Color = 1
‘.Font.Name = “Garamond”
‘.Font.size = 12
End With
.HorizontalAlignment = xlHAlignCenter
.VerticalAlignment = xlVAlignCenter
End With
End With
‘Add Connector to Group
‘Set oShpGroup = .Shapes.Range(Array(oShpGroup.Name, oShpCtr.Name)).Group
Next lgConnector
End If
End If
NextShp:
On Error GoTo 0
Next oCell
End With
End Sub
Once we have the basic shapes, we can focus in what can be done to resemble a CAD application. Mostly, we need a Command entry area, a Command History area, a drawing area, some menus,… and little more. Lets face how to achive all this functionality.
It’s cristal clear that all this commands have to be programmed, as few can be achieved directly via Excel Shape methods. So there is still plenty to do, coding function procedures for the commands, i.e. for 3DFACE command:
[sourcecode language=”vb”]
Public Function fcmdCAD_3DFACE() As Boolean
‘ Creates a three-dimensional face
Dim strRetVal As String
Dim lgRetVal As Long
‘Dim oPolygon() As tPoint
Dim lgPoint As Long
Dim bPoint As Boolean
For lgPoint = 0 To 3
‘Do
‘ strRetVal = VBA.InputBox(Prompt:=”Invisible edge/:”, _
Default:=”First” & ” point of 3D face>:”)
‘ bPoint = fTextToPoint(strRetVal, oPoint)
‘ oPolygon(g_Base + lgPoint) = oPoint
‘Loop Until bPoint
Next lgPoint
‘If Not fCoplanar(oPolygon(g_Base + 3), oPolygon(g_Base + 0), oPolygon(g_Base + 1), oPolygon(g_Base + 2)) Then
‘ lgRetVal = vba.msgbox(“Points are not coplanar, modify Z to be coplanar?”, vbYesNo + vbExclamation, “W A R N I N G”)
‘ If lgRetVal = vbYes Then
‘ modify Z to be coplanar…
‘ Else
‘ fcmdCAD_3DFACE = False
‘ Exit Function
‘ End If
‘End If
‘Create 3D face polygon
‘…
fcmdCAD_3DFACE = True
End Function
CAD Paper space
So, get a new blank worksheet, add an ActiveX label control (named lbXYZ for tracking the cursor position), two ActiveX textbox controls (named txtCommand and txtHistory), and throw the following code into its coding section (ALT+F11): [sourcecode language=”vb”] Option Explicit Private Const g_Base As Long = 0 ‘!!!!!!!!!! Public Type tPoint X As Double Y As Double Z As Double End Type Public Type tPoly ‘also for 3D face?… ‘Id As Long ‘4 bytes ‘Properties Layer As Long ‘4 bytes Group As Long ‘4 bytes Thickness As Single ‘4 bytes Color As Long ‘4 bytes Interior As Long ‘4 bytes ‘Geometry TypePol As Long ‘8 bytes Lft As Double ‘8 bytes Top As Double ‘8 bytes Height As Double ‘8 bytes Width As Double ‘8 bytes Rotation As Double ‘8 bytes Closed As Boolean Pointº As Integer ‘2 bytes Point() As tPoint ‘Pointº * 24 bytes Bulge() As Double ‘Pointº * 8 bytes Offset As Double ‘8 bytes ‘Comments Commentº As Long ‘4 bytes Comment As String ‘Commentº bytes End Type Public Type tSpline ‘Id As Long ‘4 bytes ‘Properties Layer As Long ‘4 bytes Group As Long ‘4 bytes Thickness As Single ‘4 bytes Color As Long ‘4 bytes Interior As Long ‘4 bytes ‘Geometry ‘TypePol As Long ‘8 bytes Lft As Double ‘8 bytes Top As Double ‘8 bytes Height As Double ‘8 bytes Width As Double ‘8 bytes Rotation As Double ‘8 bytes Closed As Boolean Pointº As Integer ‘2 bytes Point() As tPoint ‘Pointº * 24 bytes Bulge() As Double ‘Pointº * 8 bytes Offset As Double ‘8 bytes ‘Comments Commentº As Long ‘4 bytes Comment As String ‘Commentº bytes End Type Public Type tArc ‘Id As Long ‘4 bytes ‘Properties Layer As Long ‘4 bytes Group As Long ‘4 bytes Thickness As Single ‘4 bytes Color As Long ‘4 bytes Interior As Long ‘4 bytes ‘Geometry Lft As Double ‘8 bytes Top As Double ‘8 bytes Height As Double ‘8 bytes Width As Double ‘8 bytes SemiaxisA As Double ‘8 bytes ‘clockwise “> 0”, “< 0″ counter-clockwise SemiaxisB As Double ‘8 bytes StartAngle As Double ‘8 bytes EndAngle As Double ‘8 bytes Rotation As Double ‘8 bytes Offset As Double ‘8 bytes Closed As Boolean ‘Comments Commentº As Long ‘4 bytes Comment As String ‘Commentº bytes End Type ‘Public Type tMesh ‘ ‘Id As Long ‘4 bytes ‘ ‘ ‘Properties ‘ Layer As Long ‘4 bytes ‘ Group As Long ‘4 bytes ‘ Thickness As Single ‘4 bytes ‘ Color As Long ‘4 bytes ‘ Interior As Long ‘4 bytes ‘ ‘ ‘Geometry ‘ ‘TypePol As Long ‘8 bytes ‘ Lft As Double ‘8 bytes ‘ Top As Double ‘8 bytes ‘ Height As Double ‘8 bytes ‘ Width As Double ‘8 bytes ‘ Rotation As Double ‘8 bytes ‘ ‘ PointAº As Integer ‘2 bytes ‘ SideA() As tPoint ‘PointAº * 24 bytes ‘ BulgeA() As Double ‘PointAº * 8 bytes ‘ ‘ PointBº As Integer ‘2 bytes ‘ SideB() As tPoint ‘PointBº * 24 bytes ‘ BulgeB() As Double ‘PointBº * 8 bytes ‘ ‘ ‘Comments ‘ Commentº As Long ‘4 bytes ‘ Comment As String ‘Commentº bytes ‘End Type Public Type tText ‘Id As Long ‘4 bytes ‘Properties Layer As Long ‘4 bytes Group As Long ‘4 bytes Thickness As Single ‘4 bytes Color As Long ‘4 bytes Interior As Long ‘4 bytes ‘Geometry Lft As Double ‘8 bytes Top As Double ‘8 bytes Height As Double ‘8 bytes Width As Double ‘8 bytes Ground As tPoly ‘*** bytes Rotation As Double ‘8 bytes Autofit As Boolean ‘8 bytes AlignmentH As Long ‘4 bytes AlignmentV As Long ‘4 bytes size As Single ‘4 bytes ‘Text Textº As Long ‘4 bytes Text As String ‘Textº bytes ‘Comments Commentº As Long ‘4 bytes Comment As String ‘Commentº bytes End Type Public Type tCAD Viewportº As Long Viewport() As tPoly Layerº As Long Layer() As String * 256 Polyº As Long Poly() As tPoly Splineº As Long Spline() As tSpline Arcº As Long Arc() As tArc Textº As Long Text() As tText End Type ‘VarType(varName) vbVarType ‘Value Constant ‘ 0 vbEmpty ‘ 1 vbNull ‘ 10 vbError ‘ 8192 vbArray ‘ 17 vbByte ‘ 11 vbBoolean ‘ 2 vbInteger ‘ 3 vbLong ‘ 20 vbLongLong ‘(defined only on implementations that support a LongLong value type) ‘ 4 vbSingle ‘ 5 vbDouble ‘ 8 vbString ‘ 7 vbDate ‘ 14 vbDecimal ‘ 6 vbCurrency ‘ 13 vbDataObject ‘ 36 vbUserDefinedType ‘ 9 vbObject ‘ 12 vbVariant Private aCmd() As String Private aShrt() As String Private PtrCmd() As Long Private bEnableEvents As Boolean ‘– LISTENERS ——————- Public bClickListener As Boolean Public bSelectListener As Boolean Public bTextListener As Boolean Public oPointListener As tPoint Public strShpListener As String Public lgListen As Long ‘Counter for number of clicks it has to listen to before TRUE (zero for undefined) Public msoAutoshapeTypeValue As Long ‘Autoshape type to draw ‘——————————– ‘– MOUSE ———————– Public LastX As Long Public LastY As Long Public LastZ As Long ‘——————————– Private Sub txtCommand_DblClick(ByVal Cancel As MSForms.ReturnBoolean) ‘ txtComman.Select End Sub ‘Set for txtHistory and txtCommand: ‘ Multiline = True ‘ SelectionHide = False ‘ Scrollbars Private Sub txtCommand_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If KeyCode = 13 Then With txtHistory .Value = .Value & vbNewLine & txtCommand.Value ‘txtHistory. autoscroll to last line ‘In VB6: .SelectionStart = .Text.length ‘In VB6: .ScrollToCaret() lgLen = lgLen + Len(txtCommand.Value) .SelStart = lgLen ‘Len(.Value) End With txtCommand.Value = vbNullString ‘Clear content ElseIf KeyCode = 32 Then With txtCommand ‘Look for command if no spaces before: If .Value = vbNullString Then ‘Repeat last command .Value = LastCmd & VBA.Chr(32) ElseIf VBA.InStrRev(.Value, VBA.Chr(32), Len(.Value) – 1) = 0 Then LastCmd = VBA.Trim$(.Value) ‘Run associated command function ‘Application.Run(“fcmd_” & LastCmd) End If End With End If End Sub Private Sub Worksheet_Activate() bNoFollow = True ‘Do ‘ Me.lbXYZ.Caption = “X=” & MouseX & “;” & “Y = ” & MouseY ‘ & “;” & “Z = ” & MouseZ ‘ DoEvents ‘Loop While bNoFollow End Sub Private Sub Worksheet_Deactivate() bNoFollow = False End Sub Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) ‘Select near entities… End Sub Private Sub Worksheet_Change(ByVal Target As Range) Me.lbXYZ.Caption = “X=” & MouseX & “;” & “Y = ” & MouseY ‘ & “;” & “Z = ” & MouseZ LastCell = ActiveCell.Address(True, True) Me.txtCommand.Activate End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) Me.lbXYZ.Caption = “X=” & MouseX & “;” & “Y = ” & MouseY ‘ & “;” & “Z = ” & MouseZ End Sub As you can be see, there are a short number of public variables used all along the worksheet and the userforms, so information can be passed from one procedure to another and to set conditions to roll on the alternatives. Also, it is insinued that we need an object structure to store all the drawing information (Lines, Polylines, Arcs, Splines, Texts, Meshes,…) so I/O operations can be performed. Export/Import format can be anyone, KML, DXF,… but it has to be coded as an apart.Entering COMMANDS
Sooner than later we’ll have to deal on a method that lets us enter CAD commands. They have to be introduced on txtCommand ActiveX control, waiting for commands to be entered through keyboard, but first we must gain focus for it, avoiding Excel ActiveCell’s default focus. This only can be done via code. A not comprehensive list of CAD commands can be obtained from http://academics.triton.edu/faculty/fheitzman/commands.html, and also the complete list of command shortcuts aliases: https://www.autodesk.com/shortcuts/autocad. A table (year 2018) of 406 commands is shown here:Command | Shortcut | Parameters | Description |
3D | Creates three-dimensional polygon mesh objects | ||
3DARRAY | Creates a three-dimensional array | ||
3DCLIP | Invokes the interactive 3D view and opens the Adjust Clipping Planes window | ||
3DCORBIT | Invokes the interactive 3D view and enables you to set the objects in the 3D view into continuous motion | ||
3DDISTANCE | Invokes the interactive 3D view and makes objects appear closer or farther away | ||
3DFACE | Creates a three-dimensional face | ||
3DMESH | Creates a free-form polygon mesh | ||
3DORBIT | ORBIT | Rotates the view in 3D space, but constrained to horizontal and vertical orbit only | |
3DPAN | Invokes the interactive 3D view and enables you to drag the view horizontally and vertically | ||
3DPOLY | Creates a polyline with straight line segments using the CONTINUOUS linetype in three-dimensional space | ||
3DSIN | Imports a 3D Studio (3DS) file | ||
3DSOUT | Exports to a 3D Studio (3DS) file | ||
3DSWIVEL | Invokes the interactive 3D view and simulates the effect of turning the camera | ||
3DZOOM | Invokes the interactive 3D view so you can zoom in and out on the view | ||
ABOUT | Displays information about AutoCAD | ||
ACISIN | Imports an ACIS file | ||
ACISOUT | Exports AutoCAD solid objects to an ACIS file | ||
ACTRECORD | ARR | Starts the Action Recorder | |
ACTSTOP | ARS | Stops the Action Recorder and provides the option of saving the recorded actions to an action macro file | |
ACTUSERINPUT | ARU | Pauses for user input in an action macro | |
ACTUSERMESSAGE | ARM | Inserts a user message into an action macro | |
ADCCLOSE | Closes AutoCAD DesignCenter | ||
ADCENTER | ADC | Manages and inserts content such as blocks, xrefs, and hatch patterns | |
ADCNAVIGATE | Directs the Desktop in AutoCAD DesignCenter to the file name, directory location, or network path you specify | ||
ALIGN | AL | Aligns objects with other objects in 2D and 3D | |
AMECONVERT | Converts AME solid models to AutoCAD solid objects | ||
ANALYSISZEBRA | ZEBRA | Projects stripes onto a 3D model to analyze surface continuity. | |
APERTURE | Controls the size of the object snap target box | ||
APPLOAD | AP | Load Application | |
ARC | A | Creates an arc | |
AREA | AA | Calculates the area and perimeter of objects or of defined areas | |
ARRAY | AR | Creates multiple copies of objects in a pattern | |
ARX | Loads, unloads, and provides information about ObjectARX applications | ||
ATTDEF | ATT | Redefines a block and updates associated attributes | |
ATTDISP | Globally controls attribute visibility | ||
ATTEDIT | ATE | Changes attribute information in a block | |
ATTEXT | Extracts attribute data | ||
ATTIPEDIT | ATI | Changes the textual content of an attribute within a block | |
ATTREDEF | Redefines a block and updates associated attributes | ||
AUDIT | Evaluates the integrity of a drawing | ||
BACKGROUND | Sets up the background for your scene | ||
BASE | Sets the insertion base point for the current drawing | ||
BCLOSE | BC | Closes the Block Editor | |
BEDIT | BE | Opens the block definition in the Block Editor | |
BHATCH | Fills an enclosed area or selected objects with a hatch pattern | ||
BLIPMODE | Controls the display of marker blips | ||
BLOCK | B | Creates a block definition from selected objects | |
BLOCKICON | Generates preview images for blocks created with Release 14 or earlier | ||
BMPOUT | Saves selected objects to a file in device-independent bitmap format | ||
BOUNDARY | BO | Creates a region or a polyline from an enclosed area | |
BOX | Creates a three-dimensional solid box | ||
BPARAMETER | PARAM | Adds a parameter with grips to a dynamic block definition | |
BREAK | BR | Breaks the selected object between two points | |
BROWSER | Launches the default Web browser defined in your system’s registry | ||
BSAVE | BS | Saves the current block definition | |
BVSTATE | BVS | Creates, sets, or deletes a visibility state in a dynamic block | |
CAL | Evaluates mathematical and geometric expressions | ||
CAMERA | CAM | Sets a camera and target location to create and save a 3D perspective view of objects | |
CHAMFER | CHA | Bevels the edges of objects | |
CHANGE | Changes the properties of existing objects | ||
CHECKSTANDARDS | CHK | Checks the current drawing for standards violations | |
CHPROP | Changes the color, layer, linetype, linetype scale factor, lineweight, thickness, and plot style of an object | ||
CIRCLE | C | Creates a circle | |
CLOSE | Closes the current drawing | ||
COLOR | COL | Sets the color for new objects | |
COMMANDLINE | CLI | Displays the Command Line window | |
COMPILE | Compiles shape files and PostScript font files | ||
CONE | Creates a three-dimensional solid cone | ||
CONSTRAINTBAR | CBAR | A toolbar-like UI element that displays the available geometric constraints on an object | |
CONVERT | Optimizes 2D polylines and associative hatches created in AutoCAD Release 13 or earlier | ||
COPY | CO | Copies objects a specified distance in a specified direction | |
COPYBASE | Copies objects with a specified base point | ||
COPYCLIP | Copies objects to the Clipboard | ||
COPYHIST | Copies the text in the command line history to the Clipboard | ||
COPYLINK | Copies the current view to the Clipboard for linking to other OLE applications | ||
CTABLESTYLE | CT | Sets the name of the current table style | |
CUTCLIP | Copies objects to the Clipboard and erases the objects from the drawing | ||
CYLINDER | CYL | Creates a 3D solid cylinder | |
DATAEXTRACTION | DX | Extracts drawing data and merges data from an external source to a data extraction table or external file | |
DATALINK | DL | The Data Link dialog box is displayed | |
DATALINKUPDATE | DLU | Updates data to or from an established external data link | |
DBCCLOSE | Closes the dbConnect Manager | ||
DBCONNECT | DBC | Provides an interface to external database tables | |
DBLIST | Lists database information for each object in the drawing | ||
DDEDIT | ED | Edits single-line text, dimension text, attribute definitions, and feature control frames | |
DDPTYPE | Specifies the display mode and size of point objects | ||
DDVPOINT | VP | Sets the 3D viewing direction. | |
DELAY | Provides a timed pause within a script | ||
DIM | AND DIM1 Accesses Dimensioning mode | ||
DIMALIGNED | Creates an aligned linear dimension | ||
DIMANGULAR | DAN | Creates an angular dimension | |
DIMARC | DAR | Creates an arc length dimension | |
DIMBASELINE | DBA | Creates a linear, angular, or ordinate dimension from the baseline of the previous or selected dimension | |
DIMCENTER | DCE | Creates the center mark or the centerlines of circles and arcs | |
DIMCONSTRAINT | DCON | Applies dimensional constraints to selected objects or points on objects | |
DIMCONTINUE | DCO | Creates a dimension that starts from an extension line of a previously created dimension | |
DIMDIAMETER | DDI | Creates a diameter dimension for a circle or an arc | |
DIMDISASSOCIATE | DDA | Removes associativity from selected dimensions | |
DIMEDIT | DED | Edits dimension text and extension lines | |
DIMJOGGED | DJO | Creates jogged dimensions for circles and arcs | |
JOG | Creates jogged dimensions for circles and arcs | ||
DIMJOGLINE | DJL | Adds or removes a jog line on a linear or aligned dimension | |
DIMLINEAR | Creates linear dimensions | ||
DIMORDINATE | DOR | Creates ordinate dimensions | |
DIMOVERRIDE | DOV | Controls overrides of system variables used in selected dimensions | |
DIMRADIUS | DRA | Creates a radius dimension for a circle or an arc | |
DIMREASSOCIATE | DRE | Associates or re-associates selected dimensions to objects or points on objects | |
DIMSTYLE | D | Creates and modifies dimension styles | |
DIMTEDIT | Moves and rotates dimension text | ||
DIST | DI | Measures the distance and angle between two points | |
DIVIDE | DIV | Creates evenly spaced point objects or blocks along the length or perimeter of an object | |
DONUT | DO | Creates a filled circle or a wide ring | |
DRAGMODE | Controls the way AutoCAD displays dragged objects | ||
DRAWINGRECOVERY | DRM | Displays a list of drawing files that can be recovered after a program or system failure | |
DRAWORDER | DR | Changes the draw order of images and other objects | |
DSETTINGS | DS | Sets grid and snap, polar and object snap tracking, object snap modes, Dynamic Input, and Quick Properties | |
DSVIEWER | Opens the Aerial View window | ||
DVIEW | DV | Defines parallel projection or perspective views by using a camera and target | |
DWGPROPS | Sets and displays the properties of the current drawing | ||
DXBIN | Imports specially coded binary files | ||
EDGE | Changes the visibility of three-dimensional face edges | ||
EDGESURF | Creates a three-dimensional polygon mesh | ||
ELEV | Sets elevation and extrusion thickness properties of new objects | ||
ELLIPSE | EL | Creates an ellipse or an elliptical arc | |
ERASE | E | Removes objects from a drawing | |
ETRANSMIT | ZIP | Creates a Self-Extracting or Zipped Transmittal Package. | |
EXPLODE | X | Breaks a compound object into its component objects. | |
EXPORT | EXP | Saves the objects in a drawing to a different file format | |
EXPORTPDF | EPDF | Exports drawing to PDF | |
EXPRESSTOOLS | Activates the installed AutoCAD Express Tools if currently unavailable | ||
EXTEND | EX | Extends objects to meet the edges of other objects | |
EXTERNALREFERENCES | ER | Opens the External References palette | |
EXTRUDE | EXT | Extends the dimensions of a 2D object or 3D face into 3D space | |
FILL | Controls the filling of multilines, traces, solids, all hatches, and wide polylines | ||
FILLET | F | Rounds and fillets the edges of objects | |
FILTER | FI | Creates a list of requirements that an object must meet to be included in a selection set | |
FIND | Finds, replaces, selects, or zooms to specified text | ||
FLATSHOT | FSHOT | Creates a 2D representation of all 3D objects based on the current view | |
FOG | Provides visual cues for the apparent distance of objects | ||
FSMODE | FS | Creates a selection set of all objects that touch the selected object | |
GEOCONSTRAINT | GCON | Applies or persists geometric relationships between objects or points on objects | |
GEOGRAPHICLOCATION | GEO | Specifies the geographic location information for a drawing file | |
NORTH | Specifies the geographic location information for a drawing file | ||
GRADIENT | GD | Fills an enclosed area or selected objects with a gradient fill | |
GRAPHSCR | Switches from the text window to the drawing area | ||
GRID | Displays a dot grid in the current viewport | ||
GROUP | G | Creates and manages saved sets of objects called groups | |
BH | Fills an enclosed area or selected objects with a hatch pattern, solid fill, or gradient fill | ||
HATCH | H | Fills an enclosed area or selected objects with a hatch pattern, solid fill, or gradient fill | |
HATCHEDIT | HE | Modifies an existing hatch or fill | |
HELP | (F1) Displays online help | ||
HIDE | HI | Regenerates a 3D wireframe model with hidden lines suppressed | |
HIDEPALETTES | POFF | Hides currently displayed palettes (including the command line) | |
HYPERLINK | Attaches a hyperlink to a graphical object or modifies an existing hyperlink | ||
HYPERLINKOPTIONS | Controls the visibility of the hyperlink cursor and the display of hyperlink tooltips | ||
ID | ID | Displays the UCS coordinate values of a specified location | |
IMAGE | IM | Displays the External References palette | |
IMAGEADJUST | IAD | Controls the image display of the brightness, contrast, and fade values of images | |
IMAGEATTACH | IAT | Inserts a reference to an image file | |
IMAGECLIP | ICL | Crops the display of a selected image to a specified boundary | |
IMAGEFRAME | Controls whether AutoCAD displays the image frame or hides it from view | ||
IMAGEQUALITY | Controls the display quality of images | ||
IMPORT | IMP | Imports files of different formats into the current drawing | |
INSERT | I | Inserts a block or drawing into the current drawing | |
INSERTOBJ | IO | Inserts a linked or embedded object | |
INTERFERE | INF | Creates a temporary 3D solid from the interferences between two sets of selected 3D solids | |
INTERSECT | IN | Creates a 3D solid, surface, or 2D region from overlapping solids, surfaces, or regions | |
ISOPLANE | Specifies the current isometric plane | ||
JOIN | J | Joins similar objects to form a single, unbroken object | |
LAYER | LA | Manages layers and layer properties | |
LAYERSTATE | LAS | Saves, restores, and manages named layer states | |
LAYOUT | LO | Creates and modifies drawing layout tabs | |
LAYOUTWIZARD | Starts the Layout wizard, in which you can designate page and plot settings for a new layout | ||
LEADER | Creates a line that connects annotation to a feature | ||
LENGTHEN | LEN | Changes the length of objects and the included angle of arcs | |
LIGHT | Manages lights and lighting effects | ||
LIMITS | Sets and controls the drawing boundaries and grid display | ||
LINE | L | Creates straight line segments | |
LINETYPE | LT | Loads, sets, and modifies linetypes | |
LIST | LI | Displays property data for selected objects | |
LOAD | Makes shapes available for use by the SHAPE command | ||
LOGFILEOFF | Closes the log file opened by LOGFILEON | ||
LOGFILEON | Writes the text window contents to a file | ||
LSEDIT | Edits a landscape object | ||
LSLIB | Maintains libraries of landscape objects | ||
LSNEW | Adds realistic landscape items, such as trees and bushes, to your drawings | ||
LTSCALE | LTS | Changes the scale factor of linetypes for all objects in a drawing | |
LWEIGHT | LW | Sets the current lineweight, lineweight display options, and lineweight units | |
MARKUP | MSM | Opens the Markup Set Manager | |
MASSPROP | Calculates and displays the mass properties of regions or solids | ||
MATCHPROP | MA | Applies the properties of a selected object to other objects | |
MATLIB | Imports and exports materials to and from a library of materials | ||
MEASURE | ME | Joins similar objects to form a single, unbroken object | |
MEASUREGEOM | MEA | Measures the distance, radius, angle, area, and volume of selected objects or sequence of points | |
MENU | Loads a menu file | ||
MENULOAD | Loads partial menu files | ||
MENUUNLOAD | Unloads partial menu files | ||
MESHSMOOTHLESS | LESS | Decreases the level of smoothness for mesh objects by one level | |
MESHSMOOTHMORE | MORE | Increases the level of smoothness for mesh objects by one level | |
MESHSPLIT | SPLIT | Splits a mesh face into two faces | |
MINSERT | Inserts multiple instances of a block in a rectangular array | ||
MIRROR | MI | Creates a mirrored copy of selected objects | |
MIRROR3D | Creates a mirror image of objects about a plane | ||
MLEADER | MLD | Creates a multileader object | |
MLEADERALIGN | MLA | Aligns and spaces selected multileader objects | |
MLEADERCOLLECT | MLC | Organizes selected multileaders that contain blocks into rows or columns, and displays the result with a single leader | |
MLEADEREDIT | MLE | Adds leader lines to, or removes leader lines from, a multileader object | |
MLEADERSTYLE | MLS | Creates and modifies multileader styles | |
MLEDIT | Edits multiple parallel lines | ||
MLINE | ML | Creates multiple parallel lines | |
MLSTYLE | Defines a style for multiple parallel lines | ||
MODEL | Switches from a layout tab to the Model tab and makes it current | ||
MOVE | M | Moves objects a specified distance in a specified direction | |
MSLIDE | Creates a slide file of the current viewport in model space, or of all viewports in paper space | ||
MSPACE | MS | Switches from paper space to a model space viewport | |
MTEXT | MT | Creates a multiline text object | |
T | Creates a multiline text object | ||
MULTIPLE | Repeats the next command until canceled | ||
MVIEW | MV | Creates and controls layout viewports | |
MVSETUP | Sets up the specifications of a drawing | ||
NAVSWHEEL | WHEEL | Displays a wheel that contains a collection of view navigation tools. | |
NAVVCUBE | CUBE | Controls the visibility and display properties of the ViewCube tool | |
NEW | Creates a new drawing file | ||
NEWSHOT | NSHOT | Creates a named view with motion that is played back when viewed with ShowMotion | |
NEWVIEW | NVIEW | Creates a named view with no motion | |
OFFSET | O | Creates concentric circles, parallel lines, and parallel curves | |
OLELINKS | Updates, changes, and cancels existing OLE links | ||
OLESCALE | Displays the OLE Properties dialog box | ||
OOPS | Restores erased objects | ||
OPEN | Opens an existing drawing file | ||
OPTIONS | OP | Customizes the program settings | |
ORTHO | Constrains cursor movement | ||
OSNAP | OS | Sets running object snap modes | |
PAGESETUP | Specifies the layout page, plotting device, paper size, and settings for each new layout | ||
PAN | P | Adds a parameter with grips to a dynamic block definition | |
PARAMETERS | PAR | Controls the associative parameters used in the drawing | |
PARTIALOAD | Loads additional geometry into a partially opened drawing | ||
PARTIALOPEN | Loads geometry from a selected view or layer into a drawing | ||
PASTEBLOCK | Pastes a copied block into a new drawing | ||
PASTECLIP | Inserts data from the Clipboard | ||
PASTEORIG | Pastes a copied object in a new drawing using the coordinates from the original drawing | ||
PASTESPEC | PA | Pastes objects from the Clipboard into the current drawing and controls the format of the data | |
PCINWIZARD | Displays a wizard to import PCP and PC2 configuration file plot settings into the Model tab or current layout | ||
PEDIT | PE | Edits polylines and 3D polygon meshes | |
PFACE | Creates a three-dimensional polyface mesh vertex by vertex | ||
PLAN | Displays the plan view of a user coordinate system | ||
PLINE | PL | Creates a 2D polyline | |
PLOT | Plots a drawing to a plotter, printer, or file | ||
PLOTSTYLE | Sets the current plot style for new objects, or the assigned plot style for selected objects | ||
PLOTTERMANAGER | Displays the Plotter Manager, where you can launch the Add-a-Plotter wizard and the Plotter Configuration Editor | ||
POINT | PO | Creates a point object | |
POINTCLOUDATTACH | PCATTACH | Inserts an indexed point cloud file into the current drawing | |
POLYGON | POL | Creates an equilateral closed polyline | |
POLYSOLID | PSOLID | Creates a 3D wall-like polysolid | |
PREVIEW | PRE | Displays the drawing as it will be plotted | |
CH | Controls properties of existing objects | ||
MO | Controls properties of existing objects | ||
PROPERTIES | PR | Displays Properties palette | |
PROPERTIESCLOSE | Closes the Properties window | ||
PSDRAG | Controls the appearance of a PostScript image as it is dragged into position with PSIN | ||
PSETUPIN | Imports a user-defined page setup into a new drawing layout | ||
PSFILL | Fills a two-dimensional polyline outline with a PostScript pattern | ||
PSIN | Imports a PostScript file | ||
PSOUT | Creates an encapsulated PostScript file | ||
PSPACE | PS | Switches from a model space viewport to paper space | |
PURGE | PU | Removes unused items, such as block definitions and layers, from the drawing | |
PYRAMID | PYR | Creates a 3D solid pyramid | |
QDIM | Quickly creates a dimension | ||
QLEADER | LE | Creates a leader and leader annotation | |
QSAVE | QSAVE | Saves the current drawing | |
QSELECT | Quickly creates selection sets based on filtering criteria | ||
QTEXT | Controls the display and plotting of text and attribute objects | ||
QUICKCALC | QC | Opens the QuickCalc calculator | |
QUICKCUI | QCUI | Displays the Customize User Interface Editor in a collapsed state | |
QUICKPROPERTIES | QP | Displays open drawings and layouts in a drawing in preview images | |
QUIT | EXIT | Exits the program | |
QVDRAWING | QVD | Displays open drawings and layouts in a drawing using preview images | |
QVDRAWINGCLOSE | QVDC | Closes preview images of open drawings and layouts in a drawing | |
QVLAYOUT | QVL | Displays preview images of model space and layouts in a drawing | |
QVLAYOUTCLOSE | QVLC | Closes preview images of model space and layouts in the current drawing | |
RAY | Creates a semi-infinite line | ||
RECOVER | Repairs a damaged drawing | ||
RECTANG | REC | Creates a rectangular polyline | |
REDEFINE | Restores AutoCAD internal commands overridden by UNDEFINE | ||
REDO | Reverses the effects of the previous UNDO or U command | ||
REDRAW | R | Refreshes the display in the current viewport | |
REDRAWALL | RA | Refreshes the display in all viewports | |
REFCLOSE | Saves back or discards changes made during in-place editing of a reference (an xref or a block) | ||
REFEDIT | Selects a reference for editing | ||
REFSET | Adds or removes objects from a working set during in-place editing of a reference (an xref or a block) | ||
REGEN | RE | Regenerates the entire drawing from the current viewport | |
REGENALL | REA | Regenerates the drawing and refreshes all viewports | |
REGENAUTO | Controls automatic regeneration of a drawing | ||
REGION | REG | Converts an object that encloses an area into a region object | |
REINIT | Reinitializes the digitizer, digitizer input/output port, and program parameters file | ||
RENAME | REN | Changes the names assigned to items such as layers and dimension styles | |
RENDER | RR | Creates a photorealistic or realistically shaded image of a 3D solid or surface model | |
RENDERCROP | RC | Renders a specified rectangular area, called a crop window, within a viewport | |
RENDERPRESETS | RP | Specifies render presets, reusable rendering parameters, for rendering an image | |
RENDERWIN | RW | Displays the Render window without starting a rendering operation | |
RENDSCR | Redisplays the last rendering created with the RENDER command | ||
REPLAY | Displays a BMP, TGA, or TIFF image | ||
RESUME | Continues an interrupted script | ||
REVOLVE | REV | Creates a 3D solid or surface by sweeping a 2D object around an axis | |
REVSURF | Creates a revolved surface about a selected axis | ||
RMAT | Manages rendering materials | ||
ROTATE | RO | Rotates objects around a base point | |
ROTATE3D | Moves objects about a three-dimensional axis | ||
RPREF | RPR | Displays or hides the Advanced Render Settings palette for access to advanced rendering settings | |
RSCRIPT | Creates a script that repeats continuously | ||
RULESURF | Creates a ruled surface between two curves | ||
SAVE | Saves the drawing under the current file name or a specified name | ||
SAVEAS | Saves an unnamed drawing with a file name or renames the current drawing | ||
SAVEIMG | Saves a rendered image to a file | ||
SCALE | SC | Enlarges or reduces selected objects, keeping the proportions of the object the same after scaling | |
SCALESCRIPT | SCR | Executes a sequence of commands from a script file | |
SCENE | Manages scenes in model space | ||
SCRIPT | Executes a sequence of commands from a script | ||
SECTION | SEC | Uses the intersection of a plane and solids, surfaces, or mesh to create a region | |
SECTIONPLANE | SPLANE | Creates a section object that acts as a cutting plane through 3D objects | |
SELECT | Places selected objects in the Previous selection set | ||
SEQUENCEPLAY | SPLAY | Plays named views in one category | |
SETUV | Maps materials onto objects | ||
SETVAR | SET | Lists or changes the values of system variables | |
SHADEMODE | SHA | Starts the VSCURRENT command | |
SHAPE | Inserts a shape | ||
SHEETSET | SSM | Opens the Sheet Set Manager | |
SHELL | Accesses operating system commands | ||
SHOWMAT | Lists the material type and attachment method for a selected object | ||
SHOWPALETTES | PON | Restores the display of hidden palettes | |
SKETCH | Creates a series of freehand line segments | ||
SLICE | SL | Creates new 3D solids and surfaces by slicing, or dividing, existing objects | |
SNAP | SN | Restricts cursor movement to specified intervals | |
SOLDRAW | Generates profiles and sections in viewports created with SOLVIEW | ||
SOLID | SO | Creates solid-filled triangles and quadrilaterals | |
SOLIDEDIT | Edits faces and edges of 3D solid objects | ||
SOLPROF | Creates profile images of three-dimensional solids | ||
SOLVIEW | Creates floating viewports using orthographic projection to lay out multi- and sectional view drawings of 3D solid and body objects while in a layout | ||
SPELL | SP | Checks spelling in a drawing | |
SPHERE | Creates a three-dimensional solid sphere | ||
SPLINE | SPL | Creates a smooth curve that passes through or near specified points | |
SPLINEDIT | SPE | Edits a spline or spline-fit polyline | |
STANDARDS | STA | Manages the association of standards files with drawings | |
STATS | Displays rendering statistics | ||
STATUS | Displays drawing statistics, modes, and extents | ||
STLOUT | Stores a solid in an ASCII or binary file | ||
STRETCH | S | Stretches objects crossed by a selection window or polygon | |
STYLE | ST | Creates, modifies, or specifies text styles | |
STYLESMANAGER | Displays the Plot Style Manager | ||
SUBTRACT | SU | Combines selected 3D solids, surfaces, or 2D regions by subtraction | |
SURFOFFSET | OFFSETSRF | Creates a parallel surface or solid by setting an offset distance from a surface | |
SURFPATCH | PATCH | Creates a new surface by fitting a cap over a surface edge that forms a closed loop | |
SYSWINDOWS | Arranges windows | ||
TABLE | TB | Creates an empty table object | |
TABLESTYLE | TS | Creates, modifies, or specifies table styles | |
TABLET | Calibrates, configures, and turns on and off an attached digitizing tablet | ||
TABSURF | Creates a tabulated surface from a path curve and a direction vector | ||
TEXT | DT | Creates a single-line text object | |
TEXTALIGN | TA | Aligns multiple text objects vertically, horizontally, or obliquely | |
TEXTEDIT | TEDIT | Edits a dimensional constraint, dimension, or text object | |
TEXTSCR | Opens the AutoCAD text window | ||
THICKNESS | TH | Sets the default 3D thickness property when creating 2D geometric objects | |
TILEMODE | TI | Controls whether paper space can be accessed | |
TIME | Displays the date and time statistics of a drawing | ||
TOLERANCE | TOL | Creates geometric tolerances contained in a feature control frame | |
TOOLBAR | TO | Displays, hides, and customizes toolbars | |
TOOLPALETTES | TP | Opens the Tool Palettes window | |
TORUS | TOR | Creates a donut-shaped 3D solid | |
TRACE | Creates solid lines | ||
TRANSPARENCY | Controls whether background pixels in an image are transparent or opaque | ||
TREESTAT | Displays information about the drawing’s current spatial index | ||
TRIM | TR | Trims objects to meet the edges of other objects | |
U | Reverses the most recent operation | ||
UCS | Manages user coordinate systems | ||
UCSICON | Controls the visibility and placement of the UCS icon | ||
UCSMAN | UC | Manages defined user coordinate systems. | |
UNDEFINE | Allows an application-defined command to override an internal AutoCAD command | ||
UNDO | Reverses the effect of commands | ||
UNION | UNI | Unions two solid or two region objects. | |
UNHIDE | Displays objects previously hidden with the ISOLATEOBJECTS or HIDEOBJECTS command. | ||
UNISOLATEOBJECTS | UNISOLATE | Displays objects previously hidden with the ISOLATEOBJECTS or HIDEOBJECTS command. | |
UNITS | UN | Controls coordinate and angle display formats and precision. | |
VBAIDE | Displays the Visual Basic Editor | ||
VBALOAD | Loads a global VBA project into the current AutoCAD session | ||
VBAMAN | Loads, unloads, saves, creates, embeds, and extracts VBA projects | ||
VBARUN | Runs a VBA macro | ||
VBASTMT | Executes a VBA statement on the AutoCAD command line | ||
VBAUNLOAD | Unloads a global VBA project | ||
VIEW | V | Saves and restores named views, camera views, layout views, and preset views. | |
VIEWGO | VGO | Restores a named view. | |
VIEWPLAY | VPLAY | Plays the animation associated to a named view. | |
VIEWRES | Sets the resolution for objects in the current viewport | ||
VISUALSTYLES | VSM | Creates and modifies visual styles and applies a visual style to a viewport. | |
VLISP | Displays the Visual LISP interactive development environment (IDE) | ||
VPCLIP | Clips viewport objects | ||
VPLAYER | Sets layer visibility within viewports | ||
VPOINT | Sets the viewing direction for a three-dimensional visualization of the drawing | ||
VPORTS | Divides the drawing area into multiple tiled or floating viewports | ||
VSCURRENT | VS | Sets the visual style in the current viewport. | |
VSLIDE | Displays an image slide file in the current viewport | ||
WBLOCK | W | Writes objects or a block to a new drawing file. | |
WEDGE | WE | Creates a 3D solid wedge. | |
WHOHAS | Displays ownership information for opened drawing files | ||
WMFIN | Imports a Windows metafile< | ||
WMFOPTS | Sets options for WMFIN | ||
WMFOUT | Saves objects to a Windows metafile | ||
XATTACH | XA | Inserts a DWG file as an external reference (xref). | |
XBIND | XB | Binds one or more definitions of named objects in an xref to the current drawing. | |
XCLIP | XC | Crops the display of a selected external reference or block reference to a specified boundary. | |
XLINE | XL | Creates a line of infinite length. | |
XPLODE | Breaks a compound object into its component objects | ||
XREF | XR | Starts the EXTERNALREFERENCES command. | |
ZOOM | Z | Increases or decreases the magnification of the view in the current viewport. |
COMMANDS from menus/dockbars
In a CAD application, there are also dockbars (or floating menus) to enter commands via mouse clicks. In order to do so, a Userform can be arranged to look like a floating menu (turning ShowModal property to False).Drawing area
Before going further, we must set some conventions, mostly on how user shapes will be named, and for my convenience I’ve followed the following criteria (can be adapted to one’s needings):- Shape name should start with “#” character, followed by its assigned name (Id code) represented by a number.
- If shape is not in layer “0” then insert, at the end of the name, the layer name preceded by “@” character.