|
|
|
|
|
|
AutoCAD
|
Insert time/date stamp into drawing
|
|
Ease of Use
|
Easy
|
Version tested with
|
2004
|
Submitted by:
|
lucas
|
Description:
|
This macro will insert a time and date stamp into the current drawing.
|
Discussion:
|
It is often very important to know when a drawing was created, changed, approved, issued, etc. This script will make it easy to insert a date and time into your drawings to a predefined height.
|
Code:
|
instructions for use
|
Insert this code into a standard module:
Option Explicit
Sub AddTimeAndDate()
Dim DateTimeInfo As AcadText
Dim insertionPoint(0 To 2) As Double
Dim height As Double
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
height = 0.5 * ThisDrawing.GetVariable("DIMSCALE")
Set DateTimeInfo = ThisDrawing.ModelSpace.AddText(Time & " " & Date, insertionPoint, height)
ZoomAll
ActiveDocument.Regen acActiveViewport
Set DateTimeInfo = Nothing
End Sub
|
How to use:
|
- Copy the AddTimeAndDate.dvb file to a permanent location on your hard drive. You may wish to set up a directory for your vba routines under your ACAD installation directory. I have one directory for VBA and one for Lisp routines.
- Open any CAD File
- Click on Tools on the main menubar and from the selections click on Load Application.
- You are now looking at the Load/Unload Applications dialog box
- In the top window browse to the location where you put your AddTimeAndDate.dvb file and select it. Click the Load button that is located just below the window.
- At the bottom of the dialog box You will get a message saying "AddTimeAndDate.dvb loaded successfully"
- Click on the close button.
- Note: If you wish to view the code or alter it go to tools on the main menu click on macro then click on Visual Basic editor. You can insert a module here and paste the code in manually if you want to.
|
Test the code:
|
- Go back to the main tools menu and click on Macro then on Macro's
- In the Macros dialog box You will see The file path-Name of your file(AddTimeAndDate.dvb ) followed by the module name.
- Highlight the line described above and click the Run button.
- Your computers current date and time will be inserted into your drawing at the points 2 on the x axis and 2 on the y axis.
|
Sample File:
|
AddTimeAndDate.zip 5.69KB
|
Approved by mdmackillop
|
This entry has been viewed 75 times.
|
|