• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

2D Window LISP: Draw a Window Opening with Trim in AutoCAD

June 18, 2014

Last updated July 28, 2026

A small routine that draws a window in plan with its trim. Give it the opening size and the trim width and it draws the lot, offering sensible defaults so you can press Enter through the prompts when the standard size will do.

It is by Tom Rothstein, and it comes from the same mid-1990s collection as the 2D door routine on this site.

The command is OPG

Not 2DWIN, which is what the file and the download are called. The command the file actually defines is OPG — presumably for opening.

That is a bigger gap than usual between the name on the tin and the name you type, and there is nothing on the download page to warn you. Three letters is also short enough to be worth checking against your own aliases before loading.

The defaults tell you it is imperial

The three prompts come with defaults built in: 56 for the horizontal distance, 48 for the vertical, and 2 for the trim width.

Those are inches. A window 56 by 48 inches is roughly 1400 by 1200 millimetres, which is an entirely ordinary domestic window — and 2 inch trim is standard American casing. Read as millimetres they would be a window the size of a postcard.

Nothing stops you typing metric numbers instead; the routine draws whatever you give it. What you lose is the convenience of the defaults, and pressing Enter by habit will give you something very small on a metric drawing. If you will use it regularly, the three default values are plain numbers near the top of the file and changing them to your own standard window sizes takes a minute.

How the defaults are done

Worth a mention for anyone learning, because it is a pattern you will reuse. The default is shown to you in the prompt, in angle brackets, so you can see what pressing Enter will give you. But the prompt text is only a label — AutoCAD does not act on it. The routine then asks for a distance, checks whether the answer came back as nothing, and substitutes the value itself.

So the number in the brackets and the number actually used are written in two separate places in the file, and nothing keeps them in step. Change one and forget the other and the prompt will confidently offer you a value it does not then use. If you edit these defaults to metric, change both.

How to load it

Unzip 2DWIN.zip and load 2DWIN.LSP with APPLOAD. No support files. Our AutoLISP guide covers loading.

Step-by-step usage

  1. Type OPG.
  2. At “Horizontal Distance:” type the opening width, or press Enter for the built-in default.
  3. At “Vertical Distance:” the same for the height.
  4. At “Trim Width:” give the casing width.
  5. Place the window. Follow the remaining prompts for its position.

Draw one at a known size first and dimension it, so you can see how the trim width relates to the opening you asked for.

Compatibility notes

No date in the file; its companion door routine is dated January 1995, which places this in the same period. Written-for rather than tested-on, though it is straightforward point arithmetic with AutoCAD’s own drawing commands and nothing in that has changed.

Plain AutoLISP with no dialog boxes and no Express Tools calls, so nothing requires the full product; LT users on LT 2024 or later, the release that brought AutoLISP to LT, should be able to run it. See what runs on AutoCAD LT. It only adds geometry, so nothing existing is at risk.

Download

Name: 2D Window
Description: A small program that draws a 2D window on your floor plan.
Type: AutoCAD AutoLISP Routine
Author: Tom Rothstein
File Size: 1 Kb
Cost: Free
Worked on: AutoCAD
Download File: 2DWIN.zip

Related routines

  • 2D Door — its companion, from the same collection.
  • CASEMENT — a casement window with a hinge side.
  • Building collection — two window types and two door types.

References

  • AutoLISP: the complete guide
  • Free LISP routines library
  • AutoLISP Lesson 10: Input and Output
  • AutoLISP on AutoCAD LT

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in