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
- Type OPG.
- At “Horizontal Distance:” type the opening width, or press Enter for the built-in default.
- At “Vertical Distance:” the same for the height.
- At “Trim Width:” give the casing width.
- 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.