Here's a code clip from one of the numerous tblock subs I've written. I usually
use the select case statement these days, it's less typing, but none the less, a
picture says a thousand words
🙂
If BlkRef.HasAttributes Then
AttArray = BlkRef.GetAttributes
For I = LBound(AttArray) To UBound(AttArray)
If AttArray(I).TagString = "TT2" Then
AttArray(I).TextString = DateTime.Date
ElseIf AttArray(I).TagString = "LDR_BY" Then
AttArray(I).TextString = "JDW"
ElseIf AttArray(I).TagString = "LCHKD_BY" Then
AttArray(I).TextString = "RMS"
ElseIf AttArray(I).TagString = "LDRAWN_DATE" Then
AttArray(I).TextString = DateTime.Date
ElseIf AttArray(I).TagString = "LCHKD_DATE" Then
AttArray(I).TextString = "AUG 99"
ElseIf AttArray(I).TagString = "TT17" Then
AttArray(I).TextString = "53020799/53020800"
ElseIf AttArray(I).TagString = "TT29" Then
AttArray(I).TextString = ThisDrawing.Application.Name
ElseIf AttArray(I).TagString = "TT1" Then
AttArray(I).TextString = "---------"
ElseIf AttArray(I).TagString = "TT26" Then
AttArray(I).TextString = "1999"
ElseIf AttArray(I).TagString = "TT3" Then
AttArray(I).TextString = "FULL"
ElseIf AttArray(I).TagString = "TT34" Then
AttArray(I).TextString = "--------"
ElseIf AttArray(I).TagString = "TT9" Then
AttArray(I).TextString = "130"
ElseIf AttArray(I).TagString = "TT10" Then
AttArray(I).TextString = "TBD"
ElseIf AttArray(I).TagString = "TT7" Then
AttArray(I).TextString = "RMS"
ElseIf AttArray(I).TagString = "TT6" Then
AttArray(I).TextString = "JDW"
ElseIf AttArray(I).TagString = "TT12" Then
AttArray(I).TextString =
ThisDrawing.Application.ActiveDocument.FullName
ElseIf AttArray(I).TagString = "TT4" Then
AttArray(I).TextString =
Mid$(ThisDrawing.Application.ActiveDocument.Name, 5, 2)
MaJicMrLn wrote:
> Thanx for the Help (as always)
>
> Chris
>
> "Frank Oquendo"
wrote in message
> news:[email protected]...
> > Use the BeginSave event to create a filtered selection set containing only
> your
> > title block(s). From there, iterate the set, retreive the attributes,
> iterate
> > the attributes until you find the tag you're interested in and change the
> > TextString property.
> >
> > --
> > http://www.acadx.com
> > Win a free autographed copy of
> > "AutoCAD 2000 VBA Programmer's Reference"
> >
> > "MaJicMrLn" wrote in message
> > news:[email protected]...
> > > I dont know if this possible, but this is what I would like to do:
> > >
> > > When a drawing is opened (any drawing), through my computer, Mechanical
> > > Desktop will search for either a text string or attribute and replace it
> > > with the drawing's file name (less the .dwg).
> > >
> > > I basically want to make a tool that will automatically fill in the
> drawing
> > > number when the file is saved as its drawing number (eliminate the
> drawing
> > > file name and the title block drawing number not matching)
> > >
> > > --
> > > Chris
> > >
> >