By Dennis Collin
I was asked recently if AutoCAD could draw Rectangles in a different way from the standard out of the box, which tends to be defining 2 opposite corners along with length, width and angle. For example, could it be defined by 3 corners? The first two points being the base line of the rectangle with the 3rd point indicating the width/depth.
The answer is yes, using an AutoLisp routine. This is what the standard rectangle command uses; coding to define a polyline boundary from a series of inputs.
AutoLisp has been around for many years, but a good resource for a resource of routines is Lee Mac’s AutoLisp site.
Clicking on the link below will download the lisp routine for you to place in a secure folder, which can then be loaded with AutoCAD (& LT 2024) Appload function and added to a start-up suite of useful routines.
3D Point Rectangle Lisp routine.
The program enables the user to dynamically construct a rectangle using three supplied points. It contains two commands, ‘3PR’ and ‘3PRD’ which are a standard and dynamic version of the program respectively.
Typing in these aliases at the AutoCAD command-line, a prompt requests the user to specify two points defining one of the two pairs of parallel sides of the resulting rectangle.
Assuming the inputs are valid, the user is then prompted for a third point to determine the length and direction of the second pair of edges, which are constructed perpendicular to the initial edges defined by the first two points.
If the dynamic version of the routine is used (3PRD) the program will display a real-time preview of the resulting rectangle, whilst the user is prompted for the third point.
Like all standard commands, the routine can be exited with the press of the Esc key or Right-click cancel. The routine will work with both world and local user coordinate systems (UCS) and will make use of object snaps and tracking functionality.
This 3-point method will be of interest to users like Land Surveyors or Civil engineers that may need to position square building shapes or features like equipment or inspection chambers.
An overview of the APPLOAD function for AutoCAD/LT can be found here.
Lisp routines can be used for all kinds of tasks, saving users time and improving efficiency and productivity.
For some other examples of AutoLisp usage see some examples below.
Comments (0 comments)