Description
The free autoLisp file BasicDim.lsp
is designed to automate adding basic dimensions to drawings in AutoCAD. Let’s break down how it works:
- Command Definition: The function
c:BasicDim
defines a new command for AutoCAD calledBasicDim
. This means you can typeBasicDim
in AutoCAD’s command line to run the script. - Selecting Objects: The script starts by asking you to select objects to dimension. It uses the
ssget
function to get the selected set of objects. - Looping through Objects: Once you select the objects, the script goes through each object one by one:
- Getting the Entity: It uses
ssname
to get the current object (or “entity”) from the set. - Checking the Type: The script then checks what kind of object it is. This is done by looking at the “type” attribute of the object, such as “LINE”, “ARC”, or “CIRCLE”.
- Adding a Dimension:
- Lines: If the object is a line, the script uses the AutoCAD command
DIMLINEAR
to add a linear dimension to it. - Arcs and Circles: If the object is an arc or circle, it uses
DIMANGULAR
to add an angular dimension.
- Lines: If the object is a line, the script uses the AutoCAD command
- Getting the Entity: It uses
- Moving to the Next Object: After processing the current object, the script moves to the next one by incrementing its index.
- Completion: Once all objects are processed, the script ends gracefully by calling
princ
, which exits quietly.
In summary, the BasicDim.lsp
script simplifies the process of adding dimensions to different types of objects in AutoCAD by automating it based on the object’s type. This helps save time and ensures consistency in your drawings.
Download the lisp file for free here
To use this Lisp script:
- Save the content into a file named
BasicDim.lsp
. - Load the file into AutoCAD by typing the command
APPLOAD
and navigating to the file. - Once loaded, you can run the command
BasicDim
to automate the process of adding basic dimensions to selected objects.