1. Home
  2. /
  3. Autolisp
  4. /
  5. Draw Rectangle Using AutoLISP

Draw Rectangle Using AutoLISP - Autolisp Typing CST Test

Loading…

Draw Rectangle Using AutoLISP — Autolisp Code

Prompts user for two corners and draws a rectangle.

(defun c:DrawRectangle ()
	(setq p1 (getpoint "\nFirst corner: "))
	(setq p2 (getpoint "\nOpposite corner: "))
	(command "_.RECTANGLE" p1 p2)
	(princ)
)

Autolisp Language Guide

AutoLISP is a dialect of the Lisp programming language built specifically for automating tasks, customizing workflows, and extending functionality within Autodesk AutoCAD software, enabling rapid development of scripts and commands to enhance CAD productivity.

Primary Use Cases

  • ▸Automating drawing modifications
  • ▸Custom command creation
  • ▸Batch plotting and file management
  • ▸Parametric drawing generation
  • ▸Data extraction and CAD reporting

Notable Features

  • ▸Embedded in AutoCAD environment
  • ▸Dynamic interaction with drawing entities
  • ▸Supports creation of custom commands
  • ▸Integrated Visual LISP IDE for development
  • ▸Ability to interface with external files and databases

Origin & Creator

Developed by Autodesk Inc., USA, as an extension of the Lisp programming language for CAD automation.

Industrial Note

Commonly used in AEC (Architecture, Engineering, Construction), mechanical design, civil engineering workflows, and production drafting where repetitive AutoCAD operations need automation.

More Autolisp Typing Exercises

Simple AutoLISP Routine to Draw a LineAutoLISP Loop to Draw Multiple CirclesDraw a Polyline in AutoLISPDraw Concentric CirclesMove Selected ObjectsScale Selected ObjectsRotate Selected ObjectsErase Selected ObjectsCreate Text at a Point

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher