Free Samples: The Halloween Edition
Trick or Treat
When I immigrated as a nine-year-old kid to the United States, I was introduced to an event which I’ve never experienced before. As the sun was about to set on October 31st, kids from various neighborhoods would dress up, wear funny costumes, stroll from house to house carrying a small bucket, and ring strangers’ doorbells. Surprisingly, they would be greeted with smiles as screams of “Trick or Treat” rang out. Then free candies would just drop into their buckets with no questions asked. I learned very quickly that this is a very welcomed holiday celebrated annually both in the United States and in many other countries as well. Looks like kids just like adults love getting free stuff.
As I mentioned in my February article on “AutoCAD: Free Samples”, AutoCAD since version 2.6 has always been packaged with “free stuff.” Again, what I’m referring to are all the open source lisp files that come with AutoCAD. Since I discussed only four of these last time barely scratching the tip of the iceberg, it’s a no brainer to do follow-up articles exploring more freebies.
So, for this first follow-up article I’m adding a sub theme: “The Halloween Edition.” One reason is because the calendar is once again about to land on October 31st. Another reason is because these next four free sample lisp commands I’ll be discussing had very strange and unusual development cycles. On top of that how each product ended up was completely unexpected.
Like before, with each free sample, I’ll first discuss why Autodesk may have included the free lisp file. Then I’ll demonstrate the additional function the lisp file adds to AutoCAD. Finally, I’ll conclude with what came of the free sample function as AutoCAD continued development with newer releases.
I’ve always wondered what a Count is. According to Wikipedia, this title is typically given to someone with nobility during the medieval periods in Europe. So, I’d bet that the tale of “Count Dracula” came from that part of the world as well. But returning back to the world of AutoCAD the term Count refers to getting a quantity summary. In this particular case I’m referring to the counting of Blocks. Almost a decade after AutoCAD’s initial 1982 release, there was still no command to Count all the Blocks inserted into the current drawing, add them up and return their totals in some kind of summary format. So, by May of 1990, prior to AutoCAD’s r11 release, Tony Tanzillo, one of the more advanced AutoLISP coders, took up the challenge. Tanzillo developed and then shared Count.lsp as open source code to benefit other fellow AutoCAD users (see Figure 1).
Tanzillo’s Count.lsp command became so popular throughout AutoCAD r10, r11, r12 and r13 that by 1997 when AutoCAD r14 came out, Count.lsp was now “counted” worthy to be included with the free Bonus Tools collection (see Figure 2).
Now let me demonstrate what Count.lsp actually does using AutoCAD 2021. At AutoCAD’s command prompt, the following command sequence loads the file:
Note: This assumes that the lisp file is in the AutoCAD Support File Search Path; otherwise, the entire folder location would have to be included. Also, since the .lsp file extension is assumed, it does not have to be typed out.
After successfully loading the code, the command prompt shows the following:
C:COUNT loaded. Start command with COUNT.
Next, type the new command COUNT. You’re then given the option to hit “Enter” to do a Count of all Blocks inserted in the entire drawing or “Select objects.” Now regardless of what objects are attempted in the selection process, only Blocks would be included. Then the Text Screen window appears over the Graphics drawing window providing a list of Blocks and their quantities found in the current drawing (see Figure 3).
Granted, this Count command has the following limitations:
- It does not come with a graphic user interface (GUI).
- The header row is skewed to the right.
- The Block names are not listed in alphabetical order.
This initial attempt at getting a Block Count summary was quite impressive. But then the next developmental phase of Count.lsp took a strange twist. In March of 1999 when AutoCAD 2000 came out many of the Bonus Tools including Count.lsp were now rolled in as part of the new Express Tools package. Though on the outside the filename remained the same as Count.lsp, the code in the inside was completely rewritten with no author listed and the command name now changed to BCount (see Figure 4 and 5).
This new Count.lsp with a different internal command name of BCount kind of reminds me of another fictitious character “Dr. Jekyll and Mr. Hyde.” His exterior character may initially come off as kind and well respected but on the inside there’s a sinister character waiting for the opportunity to burst out. Here I go again with the Halloween theme. I best get back to discussing the revised Count.lsp command.
Though the code changed, there was no improvement offered. Entering BCount at the command prompt basically ends up with the same result as before. The only adjustment visible to the naked eye is with the header row now properly positioned over each column. But the Block name listing still appears in some strange, odd order and even in a different order than before. The command also ends up leaving me at the command prompt instead of the Text Screen. I would have to manually hit the F2 or Text Screen window toggle key in order to see the complete BCount summary (see Figure 6).
Even with these shortcomings, this BCount command continued to reign supreme and unchallenged for another 22 years until March of 2021. Finally, with the release of AutoCAD 2022 a new built-in command that’s surprisingly not called BCount, but Count was added. There’s actually a very good reason for the command name returning back to its roots. This new Count command works not only on Blocks but also on many other objects- though there are limitations (see Figure 7).
As an alternative to starting the Count command at the command prompt, you can now right mouse click on the Graphics drawing area and Count appears as one of the commands listed on the mouse menu for selection. You can also execute Count by first selecting a supported object, then right mouse click to gain access to the Count command again listed on the mouse menu.
But just to compare apples to apples I will focus on Counting Blocks and not on other supported objects. Unlike the previous Count command when a drawing opens a summary of the Block Count is already created and placed in the new Count palette. The Block names are now sorted alphabetically with the option of changing the order from ascending to descending. You can also select a Block on the palette and all matching Blocks on the Graphics drawing area will be highlighted for review (see Figure 8).
Another added feature with this new and improved built-in Count command is error detection. When errors are found a yellow exclamation mark symbol appears on the palette next to the Block name. These errors now can be quickly reviewed by clicking on that error symbol. The palette would change to show what makes up the errors and the Graphic drawing area would highlight the errant Blocks (see Figure 9).
There’s even an option to insert the Count summary as a Table placed into the drawing. Unfortunately, there are a number of other options with the Count command that are not readily apparent. I actually prefer to see these Count options on a GUI instead of having to guess or remember what they are. So, I designed my own DDCount.lsp to show the various options for user selection (see Figure 10).
You would think that after AutoCAD 2022 introduced the new built-in Count command, Count.lsp would be dropped from future releases. But this didn’t happen. Autodesk unexpectedly decided to keep the Express Tools intact and not touch any of the added commands. So Count.lsp continues to live on as part of the Express Tools even up to the current version of AutoCAD 2024.
I’ve discussed so much about counting Blocks that some of you may ask: What actually is a Block? Well, Blocks have been supported since the early days of AutoCAD. Basically, a Block can be made up of various objects and typically gets placed in multiple locations in the drawing. Some simple Block examples are grid bubbles, door swings, arrow heads and etc. You can read more about Blocks in the article I recently wrote for AUGIWORLD Magazine’s June issue called AutoCAD: Insert or Xref? That is the Question.
One of the advantages of using Blocks, besides getting quantity counts, is the ability to update or change them. In October of 1983, AutoCAD version 1.4 added the feature of changing or “redefining” a Block. This made it possible so that when one instance of a Block is redefined, then all copies of the same Block in the drawing automatically reflect the changes. This is a major timesaver compared to changing each Block one at a time. So how do you create a Block? This can be answered by looking at AutoCAD’s help file describing the Block command which remained about the same through AutoCAD r14 (see Figure 11).
For over a decade, using a command line interface was the only method available to create a Block. But this all changed in June of 1992 when AutoCAD r12 was released. AutoCAD r12 gave AutoLISP developers the new feature of creating and customizing programmable dialog boxes. This was truly a game changer. Now instead of responding to prompts one after another at the command line all the information can be collected in a single GUI before execution. This GUI was initially coded and saved in a separate file with a .DCL file extension clearly differentiating itself from the .LSP file extension where the AutoLISP code is stored. To promote this new feature AutoCAD included a number of open source DCL files with the main program as well as a separate Sample folder for customers to get a taste of this powerful addition (see Figure 12).
BMake.lsp and BMake.dcl, developed by Kieran V. McKeogh in February of 1991, were one of the free lisp and dcl files included with AutoCAD r12 in the Sample folder. BMake provides for the first time a GUI method to create a Block (see Figure 13 and 14).
I’ve often wondered why McKeogh didn’t call the new command BBlock. After all, BBlock would make sense since it could mean a command to “be” a Block. This causes me to think of a “rom com” 2005 movie that starred Nicole Kidman called “Bewitched.” This movie actually referenced the famous mid 60’s to early 70’s TV series with the same title. In both cases it’s about a witch who met and married a mortal but now wants to try and live happily ever after without using her magic. The movie is just hilarious and of course there is one scene showing the kids knocking at the door trick or treating. I just can’t get away from this Halloween stuff.
Now in order for BMake to load properly, both BMake.lsp and BMake.dcl need to be located in one of AutoCAD’s Support File Search Paths. Then at AutoCAD’s command prompt, the following command sequence loads the file:
After successfully loading the code, the command prompt shows the following:
C:BMAKE loaded. Start command with BMAKE.
Next enter the command BMake and the Block Definition GUI appears (see Figure 15).
Within the GUI all the information can be entered without the need to do it sequentially at the command prompt. After entering a Block name, you could then choose either the “Select Point” or the “Select Objects” button. The GUI would then disappear so a selection can be performed on the Graphics drawing area. Once the selection process is complete the GUI reappears for additional input. Finally, when all the needed information is filled out and the OK button is clicked then the Block is magically created.
I say magically because looking under the hood of McKeogh’s code, it does more than provide a GUI for the Block command. It goes further by creating the Block entirely from AutoLISP functions. AutoCAD’s built-in Block command is not used at all.
But then the next development phase of BMake.lsp like Count.lsp took a strange twist. When AutoCAD r13 came out in November of 1994, BMake.lsp was nowhere to be found. For some reason Autodesk chose to drop this gem completely from the AutoCAD packaging. Of course, for those die hard BMake lovers, BMake can continue to live on by copying BMake.lsp and BMake.dcl from the AutoCAD r12’s Sample folder, save them into AutoCAD r13’s Support folder and the code runs flawlessly.
Another surprising turn of events occurred again in February of 1997 when AutoCAD r14 came out. BMake.lsp and Bmake.dcl were shockingly resurrected from the dead. But this reappearance came with a number of changes. Now it’s no longer in the Sample folder but promoted as part of the main program in the Support folder. Like Count.lsp, BMake.lsp was completely re-written with no author listed. The version number changed from 0.5 to 14.0 matching AutoCAD’s release number. Instead of continuing on with the use of AutoLISP functions to create the Block, the code now relies entirely on the built-in Block command. Lastly, the GUI now has dropped the toggle button option of creating an “Unnamed” Block (see Figure 16 and 17).
Note: Unlike Count.lsp, BMake.lsp did not include a command name change. But if the command had been renamed to BBlock that would have made an even more fascinating story.
Then by the next release of AutoCAD in March of 1999, BMake.lsp was now gone again but this time for good. Autodesk made the decision to revamp AutoCAD’s original Block command. The redesigned Block command now presents a brand-new built-in GUI, dropping the requirement for a separate DCL file and completely replacing BMake (see Figure 18).
This initial version of the Block GUI would continue till March of 2009 when AutoCAD 2010 came out with a facelift to the Block command. On top of sporting a new look the Block GUI now includes more toggle button options accommodating for the added Block features. This redesign would continue to the current version of AutoCAD 2024 (see Figure 19).
Note: To run the original command line version of the Block command you’ll have to precede the command name with a hyphen: -BLOCK
There’s still one final twist to BMake. Though the command BMake disappeared from AutoCAD 2000, 2000i and 2002, when AutoCAD 2004 came out in March of 2003, BMake miraculously resurfaced. This time though I would say it’s in spirit only. For some reason Autodesk decided to add an alias in the ACAD.pgp file so that when the BMake command is entered AutoCAD would launch the Block command. This addition to the ACAD.pgp file has continued since that version to today’s AutoCAD 2024 (see Figure 20).
Back in the prehistoric days before the advent of fancy GUI Operating Systems (OS), commands were typed out on a dull, text character-based terminal. A number of these commands were built-in to the OS without a need for an external execution (EXE) file to run. Almost every known OS back then came with an internal command to view the contents of text files. In the Unix and Linux world this command is entered as: "cat". For IBM PC / Microsoft’s Disk Operating System (DOS) this command is known as: "TYPE".
In May of 1985 when AutoCAD released version 2.1 it took advantage of accessing DOS commands like TYPE by introducing the ACAD.pgp (which stands for Program Parameter) file. When these DOS command names are entered at the command prompt AutoCAD would read the information provided in the ACAD.pgp file and launch the corresponding referenced external DOS command (see Figure 21).
Note: AutoCAD did not support aliases or command shortcuts in the ACAD.pgp until October of 1990 when AutoCAD r11 came out.
Since AutoCAD is mainly a drawing-based program, it continued to rely on the external DOS TYPE command to view text files. Then with the release of AutoCAD r12 in June of 1992 adding support for programmable dialog boxes a developer by the name of Duff Kurland decided to take advantage of this new feature. Kurland in December of 1991 coded DDType.lsp and DDType.dcl to generate a GUI for the end user to select an external text file and display the contents inside a list box (see Figure 22).
Apparently, Kurland chose to name his command “Type” to replicate DOS’s TYPE command. The “DD” prefix which means “Dynamic Dialog” was added to match AutoCAD’s promotional naming convention at the time for lisp functions that included the DCL GUI. This new DDType command was shipped with AutoCAD r12 in the Sample folder free for customers to use.
As long as DDType.lsp and DDType.dcl are located in one of AutoCAD’s Support File Search Paths entering the following command sequence at the command prompt successfully loads it:
After successfully loading the code and entering DDType at the command prompt the following File to List selection window appears (see Figure 23):
By default, Kurland set the Files of type to only show “doc” files. But you can actually enter in the File name edit box any file type extension like “*.txt” or “*.bat” or even “*.*” and the file list window will update showing files that match the revised file type. Once a file is selected and the Open button is clicked another window appears displaying the file name in the title bar and the content in the list box for viewing (see Figure 24).
At the time, I was actually not aware of this free sample addition to AutoCAD. I made the mistake of not opening the AutoCAD folder to explore all the freebies that came with the product. Instead, I ended up coding my own text file viewer command I called DDBrowse.lsp. I purposely included in DDBrowse the following additional features:
- The DCL file is written on the fly at run time so there’s no need for a separate DCL file to accompany the lisp code.
- The GUI window is wider and taller so more of the text content can be seen without having to scroll up and down.
- A Print button option is included so the contents of the text file can be sent to the printer (see Figure 25).
But after this initial free sample introduction to the DDType command the development came to a screeching halt. DDType.lsp and DDType.dcl were never included in any future releases of AutoCAD again. Unless you kept a copy, both of these files just faded into digital oblivion. AutoCAD even up to the current 2024 version has offered no equivalent command to match the DDType functionality. This is perhaps due to the following reasons:
- The free sample was just a sample demonstrating what the new DCL can offer.
- As the prevalence of DOS began to fade and the dominance of the new Windows OS began to take over, viewing text files was a breeze. It was just a matter of double clicking on a text file from Windows Explorer. The free built-in app Notepad would open the file content for both viewing and editing.
- There was really no demand or need for a separate built-in command to view text files from within AutoCAD.
Since its first release, another text related command missing from the AutoCAD program for over 15 years was the ability to first find and then replace text characters in the drawing. Finding and replacing text sounds like such a simple and important feature to include. But since AutoCAD is a drawing-based application, the need to add a command to search through paragraphs of text was definitely not a top priority.
Finally, in 1997 a group of four developers Bill Kramer, Dominic Panholzer, Randy Kintzley and Greg Robinson came together to code a find and replace program called Find.lsp and Find.dcl (see Figure 26 and 27).
Autodesk then decided to package this code as part of the Bonus Tools with the release of AutoCAD r14 in February of 1997. The Bonus Tools Help window shows that FIND is only one out of an additional eight Text related commands added as a Bonus to the AutoCAD application. Autodesk definitely wanted to focus on adding more text related functions to AutoCAD (see Figure 28).
Since Find.lsp is part of the Bonus Tools package, there are a number of functions stored in a file called AC_Bonus.lsp shared by the other Bonus lisp files. So, in order for the code to load successfully, AC_Bonus.lsp has to load first by entering the following at the command prompt:
Once these shared functions are loaded and as long as Find.lsp and Find.dcl are located in one of AutoCAD’s Support File Search Paths then enter the following at the command prompt to successfully load it:
Note: When AutoCAD has a built-in matching command name there are two ways to run the lisp version. The first method involves multiple steps. First, execute the Undefine command and enter “Find” as the command to remove. Second, now you can run the lisp version by entering “Find”. Lastly, after the lisp version has completed, execute the Redefine command to restore the built-in “Find” command back. The second method, which is what I recommend, is to enter at the command prompt the following to call the lisp function: (c:find)
After executing the lisp version, the Find and Replace window appears (see Figure 29).
This is a very simple GUI that requests information prior to running the find and replace operation. In addition to edit boxes there are two toggle button options to refine the search. On the Find edit box enter text characters to look for. On the Replace With edit box enter text characters to replace with. By the way, I discovered that the “Replace With” edit box can be left empty. Then when a text match is found it will actually replace the text with nothing. Does that mean that a new invisible Text object is created? Should I now talk about “The Invisible Man?” No, I better not get sidetracked again but instead stay focused on finishing the topic at hand.
Though this added Find command makes-up for this missing text feature in AutoCAD, it does have the following limitations:
- Only Text objects are searched but Attributes, MText and Dimensions are not supported.
- There’s no feedback provided as to how many Text objects matching the pattern are found and replaced.
- After the command finishes regardless of success or failure the following message always appears at the command prompt: “Changing text (100%).”
Unfortunately, this very simple but effective Find and Replace command met a similar fate as DDType. Both Find.lsp and Find.dcl were dropped permanently with the release of AutoCAD 2000 in March of 1999. There were two major reasons for the quick death:
- AutoCAD 2000 introduced a more sophisticated built-in Find command.
- The Bonus Tools were transitioned to Express Tools, and this resulted in some of the lisp functions like Find to be left in the dust (see Figure 30).
Now with AutoCAD’s new Find command, included are a number of Options such as searching for more than just Text objects but also Block Attributes, Dimensions, Hyperlinks and MText. This new and improved GUI would remain fairly unchanged from AutoCAD 2000 through 2010 (see Figure 31).
Then starting with AutoCAD 2011 released in March of 2010 till the current version of AutoCAD 2024 the Find and Replace GUI was given a brand-new facelift and additional features. The found objects can now be shown in a window that expands when the List results toggle button is checked. Options, a lot more of them, are now positioned at the bottom of the window and can also be expanded or collapsed for selection (see Figure 32).
On With the Show
Hopefully I’ve piqued your interest on the many free sample lisp files available from previous up to the current version of AutoCAD. These freebies once again remind me of the many festivities accompanying the arrival of the upcoming Halloween season. Now that the pandemic is over, entire city streets may be shut down so that trick or treaters can stroll up and down the block entering one store after another to collect lots of free candies. Likewise, it’s time for you to crack open the AutoCAD folder and check out one lisp file after another to discover the many free gems available at your fingertips.