3PR LISP: 3-Point Rectangle (Free AutoLISP Download)
3PR draws a closed, perfectly square rectangle from just three picked points, typically three corners of a building or structure captured with a Total Station in the field. Instead of manually joining four corner points (and inheriting any small field-pick error), the routine computes the true perpendicular/parallel geometry mathematically from the first two points and a third width-reference point.
3PTRECT-bgol (3-Point Rectangle)
Command Type: AutoLISP routine (works in AutoCAD, BricsCAD, ZWCAD and most AutoLISP-compatible CAD platforms)
Developed by: BGol Community, bgol.in
Inspired by the general concept of 3-point rectangle utilities used in survey/drafting workflows. This is an original, independently written routine, new file name, new command name, new source code, created so the CAD community has a free, editable, open-source alternative.
Overview
3PR draws a closed, perfectly square rectangle from just three picked points, typically three corners of a building or structure captured with a Total Station in the field. Instead of manually joining four corner points (and inheriting any small field-pick error), the routine computes the true perpendicular/parallel geometry mathematically from the first two points and a third width-reference point.
How to Use
- Load
3PTRECT-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
3PRat the command line and press Enter. - Pick the 1st corner point.
- Pick the 2nd corner point, together with the 1st point this defines the rectangle's primary edge and angle.
- Pick a 3rd point anywhere near the opposite side, its perpendicular distance from the first edge defines the rectangle's width.
- A closed rectangular LWPOLYLINE is created through the 4 computed corners on a dedicated layer,
BGOL-3PR(colour green).
Why Use It
- Speed, replaces four manual point picks (and the line-joining afterward) with just three picks and one command.
- Self-correcting geometry, because the 4th corner is computed from perpendicular/parallel math rather than literally connecting the picked points, small field-survey pick errors are absorbed automatically and the result is always a true rectangle.
- Clean output, produces one closed polyline ready for area calculation, GIS export, or further drafting, instead of three disconnected points.
Where to Use It
- Converting Total Station survey shots of building corners into a base map or site plan.
- Any topographic or cadastral survey workflow where structures are captured as 3-corner point clusters and need to become regularized rectangles quickly.
- Land survey, infrastructure engineering, and drafting workflows with large numbers of building footprints to regularize fast.
Notes
- Point 3 only needs to be roughly near the opposite side, the routine uses its perpendicular distance from line 1-2, not its exact position, so it does not need to align precisely with either corner.
- The resulting polyline is always closed (4 vertices, closed flag set), ready for
AREA,LIST, or export commands. - Source code is fully open, feel free to study, modify, and redistribute it under the same open, free-for-all spirit.
Credits
Developed and shared for the CAD community by BGol Community. Website: https://bgol.in/ Free and open-source, use it, modify it, share it, for personal or commercial work alike.
Frequently Asked Questions
3PR is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
Point 3 only needs to be roughly near the opposite side, the routine uses its perpendicular distance from line 1-2, not its exact position, so it does not need to align precisely with either corner.
Speed, replaces four manual point picks (and the line-joining afterward) with just three picks and one command.
Yes. 3PR is fully open-source and free to use, modify, and redistribute for both personal and commercial work, developed and shared by the BGol Community.
Drag and drop 3PTRECT-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type 3PR at the command line to run it.
🤝 About BGol Community
BGol Community of Advanced Surveying builds and shares free, open-source tools for the survey and CAD drafting community.
🙌 Made with ❤️ by BGol Community of Advanced Surveying
Free, open-source, and built for the CAD community, for personal or commercial use, always.