Outside The Box

Random thoughts about AutoCAD, ObjectARX, and the meaning of life.
All Original Content Copyright 2006 - 2008 Owen Wengerd, All Rights Reserved

This post is inspired by a conversation I had with a nephew, and it hearkens to the same nostalgic emotions engendered by the first music video on MTV.

I was a young inquisitive child growing up in the 70s in an Amish household. Without access to modern technology, I struggled at age 11 to build an oscillator circuit by using sheet metal cut from an old stovepipe, a 9 volt battery fitted into a piece of 2x6 pine, dynamite wire scavenged from the nearby strip mine, and a speaker and 555 timer IC that I cut out of some electronic equipment dug out of the local garbage dump.

The achievement was incredible considering the circumstances, but thinking back, I have very little recollection of the actual consummation of the project. I assume I probably showed it proudly to my friends, who would have been awestruck, but completely ignorant of how it worked or why it was important to me. I simply don't remember what I did with the project after it was complete.

What I do remember fondly is the struggle to achieve; the thrill of the hunt. I struggled to get information. I had obtained a prized 555, but I had to wait for weeks until the next trip to the city so I could stop by Radio Shack to get a pinout of the 555 along with circuit diagrams showing how to use it. Then I had to find components. I had long since built a treasure trove of capacitors and resistors that I had salvaged from discarded electronics, along with a pot full of potentiometers that I could use to adjust the oscillator frequency, but I still had to scavenge for some missing components.

The challenges of the quest made the final result more satisfying. It was the search for the holy grail that etched itself into my memory; I barely remember the grail itself.

Over the holidays during a family gathering, one of my Amish nephews was anxious to pick my brain. He explained that someone had told him that it's possible to convert an electric motor into a generator, and so he set out on a quest to build a generator from an old electric motor and a small gasoline engine. The quest involved several letters mailed back and forth between people he knew that might have information about how to go about the task. He tried and tried, but could not get his generator to work.

I explained to him how he needed to remove the external circuitry from his motor so that it wouldn't foul up the results; how he can add a rectifier and a regulator to generate direct current output. The excitement over this new discovery was written all over the young man's face as he anticipated more adventure.

On the way home, I thought to myself that Google could quickly and easily have provided the answers that my nephew sought. But then it occurred to me that Google would also have deprived him of the struggle and adventure of discovery that motivates him to continue the quest.

I wonder how many young minds are missing out on the supreme adventure of discovery because we live in a modern culture where all the knowledge in the universe is seemingly already at our fingertips, just a Google search away.

Labels:

Many of you use my VC Build Hook utility to target multiple versions of AutoCAD from a single solution in Visual Studio 2008. Visual Studio 2010 now includes a new feature called native multi-targeting that performs the same function as VC Build Hook. The new feature works great for using build tools back to VC 7.1, but it does not work with VC 7, which is required for targeting AutoCAD versions 2006 and earlier.

The problem is that VC 7 chokes on Unicode response files. In earlier versions of Visual Studio you could set a project property to select Unicode or ANSI response files, but that property has been removed in Visual Studio 2010. I have been told by a Microsoft engineer that the problem will be addressed in SP1, presumably by adding that project property back.

The moral of the story is that you'll need to wait for SP1 before you'll be able to use the VC 7 build tools from within the Visual Studio 2010 IDE. I am not planning to update VC Build Hook to support Visual Studio 2010.

Labels: , ,

There are a myriad of ways to load AutoLISP applications in AutoCAD, including acaddoc.lsp, an .mnl file, the Startup Suite, and manually by various means. For application developers wishing to deploy their applications to others, all of these methods have drawbacks. The ideal solution should be easy to implement in an installation program, require minimal or zero changes to the user's AutoCAD configuration, work the same way across all versions of AutoCAD, and easily undone when the application is uninstalled.

ObjectARX application developers have long used registry demand loading to load their applications automatically, either when AutoCAD starts or when the user enters a command that the application defines. Registry demand loading is relatively easy to set up and meets the other requirements for an ideal solution, except for one problem: it works only with ObjectARX modules (or with .NET modules in AutoCAD 2006 and later).

Many years ago, I created a solution to this problem by building a small stub ObjectARX module that did nothing but load an associated LISP file. This effectively allows the registry demand loading mechanism to be used for loading a LISP file. If you develop AutoLISP applications that could benefit from registry demand loading, then I have a Christmas present for you: LspLoad.zip contains a complete suite of newly updated stub modules for all versions of AutoCAD from AutoCAD 2000 to AutoCAD 2010, plus modules for Bricscad 9 and 10, which also supports registry demand loading.

To use the stub modules, just rename them so that the base filename matches your application's main LISP filename, then install them in the same folder as the LISP file and create the registry demand load entries. The only work you have to do is to get the stub module to load. You can simply drag and drop the appropriate stub module into a running instance of AutoCAD in order to test it.

Creating the demand loading registry keys is not difficult, but it may require some programming. I write custom actions for my installation programs that enumerate all installed AutoCAD versions and flavors, and set up the demand load keys for every one. However you do it, the final result should look something like this (for AutoCAD 2010 on my system):


In this screen shot, I created an application called "!LspLoadTest" (the "!" was added just so it displayed at the beginning of the list). I added the minimum required subkeys. The LOADER string value is set to the complete path of the stub module, and LOADCTRLS is set to a value of 2, which means I want the application loaded when AutoCAD starts. LOADCTRLS is a bit coded value; for use with LspLoad, it's only useful values are 2 or 4. A value of 4 means "load when my command is invoked"; this mode requires a COMMANDS subkey that lists the defined commands.

The way it works is very simple. In the example above, you can see that I renamed the module (but left the ".18.x64.arx" so that I can tell it apart). I then added !LspLoadTest.lsp to the W:\LspLoad folder. That file contained the following:
(princ "\nThis test file loaded from ")
(princ (if GetPathOf!LspLoadTest (GetPathOf!LspLoadTest) ""))
(princ)

Now when I start AutoCAD 2010, I see on the command line:
This test file loaded from W:\LspLoad\

These files are free to use for any purpose. Have a great holiday, everyone!

Labels: , , ,

2009-11-11
A lot of you are probably having to cut back on your expenses to make ends meet in this economic downturn. I've drastically reduced my discretionary spending, postponed the purchase of new office equipment, and investigated less expensive alternatives to a lot of my monthly expense items. I've also been streamlining and reorganizing my finances, which inevitably involves a lot of contact with banks.

Kean Walmsley's post about his recent bank customer service issue motivated me to post about one of my recent bank experiences.

First of all, I'm here to tell you that banks do make mistakes. I'm sure that the vast majority of the time when your check book doesn't balance, it was you that made a mistake, and not the bank. But if you are cursed like I am, then banks delight in creating phantom overdrafts and charging you exorbitant overdraft fees, then, when confronted with their error, apologizing and refunding the fees (after the damage is done and all those bounced checks have caused you to incur returned check charges from your creditors). That has happened twice to me in the past two months, with two different banks and two completely unrelated accounts.

In both cases, the bank eventually fixed the error, but I'm still out the returned check charges and whatever damage that has done to my credit rating.

One of the "returned" payments was a credit card payment. Of course, I did not get notified about this until the day after the payment due date, so it was too late to fix the problem in time to prevent another exorbitant late fee from being charged by the credit card bank.

Obviously the returned check triggered some alarms at the credit card bank, because I started receiving phone calls begging me to make a payment immediately. Irritated, I decided to make the credit card bank wait until the next due date before making the replacement payment. I figured my late fee bought me that extra time, so I might as well use it. My patience paid off: after a few futile attempts at collecting their late payment, the bank offered to refund the late fee if I made an immediate payment. That's what I'm talking about!

Labels: