1. Home
  2. /
  3. Autocad-autolisp
  4. /
  5. Draw a Line via AutoLISP

Draw a Line via AutoLISP - Autocad-autolisp Typing CST Test

Loading…

Draw a Line via AutoLISP — Autocad-autolisp Code

AutoLISP function that draws a line between two hardcoded points in AutoCAD.

(defun c:DRAWLINE ()
	(command "_LINE" '(0 0) '(100 100) "")
	(princ "Line drawn from (0,0) to (100,100).\n")
	(princ)
)

Autocad-autolisp Language Guide

AutoLISP is a dialect of the LISP programming language built for automating tasks and customizing functionality within Autodesk AutoCAD. It enables users to create scripts, routines, and functions that extend AutoCAD’s capabilities for design, drafting, and drawing automation.

Primary Use Cases

  • ▸Automating repetitive drafting tasks
  • ▸Creating custom drawing and editing commands
  • ▸Developing parameterized design routines
  • ▸Batch processing drawings and data extraction
  • ▸Integration with external data sources (Excel, databases) for CAD automation

Notable Features

  • ▸Direct access to AutoCAD drawing objects and entities
  • ▸Ability to create custom commands with (defun) and (defun-c)
  • ▸Interactive prompts and dialogs for user input
  • ▸Integration with other AutoCAD APIs like ActiveX and VBA
  • ▸Supports recursive functions and list processing for geometric calculations

Origin & Creator

Developed by Autodesk based on the LISP language to enable programmatic customization and automation of AutoCAD workflows.

Industrial Note

Essential for CAD managers, BIM coordinators, and design engineers who need repeatable, scriptable solutions for complex CAD tasks.

More Autocad-autolisp Typing Exercises

Hello World Command

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher