Rumor has it that the next release of AutoCAD will allow you to do what you've described, without any programming.