HAR
Hurricane Attribute
Replace
for AutoCAD®
These instructions are written assuming you have installed Hurricane and AutoCAD r14, you are currently using Hurricane and understand the concepts behind scripting.
Run AutoCAD and type VBALOAD at the command prompt.
Locate and Select the HAR.DVB file to load it. (You will have to do this EVERYTIME you run AutoCAD, UNLESS you rename HAR.DVB and put it in your AutoCAD directory
Q. Is there a way to automatically run a VBA routine on start-up?
Method #1 - You can run a project by calling it with the command line version of VBARUN from an AutoCAD start-up facility like acad.lsp. First, you need to prepare the acad.dvb file for autoloading. As an example, take the VBA sample called drawline.dvb and use the VBALOAD command to bring it up in the VBA IDE. Then use the VBA IDE Save menu pick and save the project with the name acad.dvb. Next, invoke notepad.exe and create (or append to) acad.lsp the following lines:
(defun S::STARTUP()
(command "_-vbarun" "drawline")
)Method #2 - rename the VBA (or DVB) file to ACAD.DVB and put it in your system directory, it will automatically be loaded the first time you attempt a "VBARUN" command.
Once HAR.DVB is loaded:
To invoke HAR, type -VBARUN at the AutoCAD command prompt, and type HAR.
Command: vbaload (Locate and Select HAR.DVB)
Command: -vbarun
Macro name: HAR
Enter BLOCK NAME (a SPACE or <ENTER> terminates input): TITLEBLOCK
Command: Enter TAG NAME (<ENTER> terminates input): TAG1
Command: Enter TAGS NEW VALUE (Use Variables here) (<ENTER> terminates input): %FILENAME
The above command pattern can be adjusted to any block with attributes.
If you are unsure of the TAGs name, temporarily Explode the block, and the actual TAGnames will be displayed. (Then just type Undo)
HAR has the ability to use dynamic text, as it changes from drawing to drawing. By adding any of the following "reserved" words or "Variables" you can substitute real-time information into your drawing.
%FILENAME inserts the current drawing name
%DATE inserts the current system date
%TIME inserts the current time
%SHEET inserts the current drawings sheet number (this is derived from the last few characters in the filename). For instance, if your drawings name is drawing007.dwg, the returned value will be 7.%COUNTER inserts a preset number and increments a preset number (use Options to setup)
This can be run over and over again on multiple drawings with the following Hurricane Command Line:
-VBARUN HAR yourblockname yourtagname«yourtext_or_variable«
AUTOCAD COMMANDS TO REMEMBER
VBALOAD or -VBALOAD (no dialog box)
VBARUN or -VBARUN (no dialog box)
VBAUNLOAD (unloads the current dvb project)
(I recommend making buttons for each of these)