Populate a titleblock attribute with the DWGNAME system variable

Populate a titleblock attribute with the DWGNAME system variable

Anonymous
Not applicable
199 Views
1 Reply
Message 1 of 2

Populate a titleblock attribute with the DWGNAME system variable

Anonymous
Not applicable
I'd like to populate the attribute in a titleblock with the DWGNAME system variable. SHould I be posting to the LISP discussion group?
0 Likes
200 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
This might help.

In acad vba the following methods give the file name.

strDrawingName = ThisDrawing.Name ' Drawing name

or

strDrawingName = UCase(Left$(ThisDrawing.Name, Len(ThisDrawing.Name) -
4)) ' drawing name in UC less extension.

or

strDrawingName = Left$(ThisDrawing.Name, Len(ThisDrawing.Name) - 4) '
drawing name in LC less extension

To write the attribute

Private Sub FillBorder()
Dim objBorderBlockEnt As AcadEntity
Dim objBorderBlock As AcadBlock
Dim varAttribute As Variant
Dim varPick As Variant
Dim varRet As Variant
Dim intI As Integer

' Set Title Block Attribute Varibles
strDrawingNumber = "Not Defined"
strDrawingNumberTop = "Not Defined"
strTitleLine1 = "Blank"
strTitleLine2 = "Blank"

' User to select border
On Error Resume Next
SelectAgain:
ThisDrawing.Utility.GetEntity objBorderBlockEnt, varPick, vbCr &
"Pick any part of the border"
If Err <> 0 Then
Err.Clear
With ThisDrawing.Utility
.prompt vbLf & " Oops, I think you missed"
.GetString False, vbLf & " Press Enter to try again or ESC
to Chicken Out"
If Err <> 0 Then
Exit Sub
End If
End With
GoTo SelectAgain
End If

Set objBorderBlockRef = objBorderBlockEnt
If objBorderBlockRef Is Nothing Then
ThisDrawing.Utility.prompt vbCr & "That was not a block try
again"
GoTo SelectAgain
End If

' Get Attribute Data

varAttribute = objBorderBlockRef.GetAttributes

For intI = LBound(varAttribute) To UBound(varAttribute)
Debug.Print varAttribute(intI).TagString &
varAttribute(intI).TextString
Select Case varAttribute(intI).TagString
Case "DRG_NO"
varAttribute(intI).TextString = strFileName
Case "DRG_NO_TOP"
varAttribute(intI).TextString = strDrawingNumberTop
Case "TITLE1"
varAttribute(intI).TextString = strTitleLine1
End Select
Next

Stewart Mills



jmcadres wrote:

> I'd like to populate the attribute in a titleblock with the DWGNAME
> system variable. SHould I be posting to the LISP discussion group?
0 Likes