simplytar
2005-01-14, 03:00 PM
Hello,
I am a VB newby. Below is a snippet of my program written in VB6, in which I need to
capture the attributes from a block that I know the name of: the block's name
is "TRACKER". I know how to capture the attributes with user input (as shown below),
but I need to capture the attributes with NO user input: ie, no picking the block.
I am looping through numerous drawings to update this block
using VB6 and Acad 2002. I have read through numerous postings and help
files and have not seen such an example - ie: with no user input.
Any help would be appreciated.
Thanks,
Todd-
Public Sub UpdateTrackingInfo()
'Open drawing to process - I am actually looping through multiple drawings and
'processing them - no problem here.
objThisDrawing.Open List2.List(ii)
'Variables for the Block, Attributes and picked point
Dim CurrBlk As AcadBlockReference
Dim CurrAtts As Variant
Dim pt As Variant
'Variables For the Loop Only
Dim strAttributes As String
Dim I As Integer
'Hide the form
frmAutoAtt.Hide
'Max the drawing window
objThisDrawing.WindowState = acMax
'Max the AutoCAD application
objThisDrawing.Application.WindowState = acMax
'Make AutoCAD active
AppActivate "Autocad"
'Pick the block you want to display attributes for
objThisDrawing.Utility.GetEntity CurrBlk, pt, "Pick a Block to display information..."
'THE ABOVE LINE IS WHERE MY ISSUE IS... I DON'T WANT TO PICK THE
'BLOCK. I KNOW THE NAME OF THE BLOOCK - It's NAME IS "TRACKER".
'I JUST WANT TO CAPTURE THE ATTRIBUTES IN "TRACKER" WITHOUT
'ANY USER INPUT.
'Move the attributes from the block to the Variant
CurrAtts = CurrBlk.GetAttributes
'Clear the variable
strAttributes = ""
'Move the attribute tags and values into an array
For I = LBound(CurrAtts) To UBound(CurrAtts)
strAttributes = strAttributes + "Tag: " + CurrAtts(I).TagString + " Value: " + CurrAtts(I).TextString + vbCrLf
Next
'Minimize AutoCAD
objThisDrawing.Application.WindowState = acMin
'Display the Atts and values in a msgbox
MsgBox "The Name of the Block you selected is: " + CurrBlk.Name + "." & vbCrLf + _
"It has the Following Attribute Tags and Values:" & _
vbCrLf & strAttributes
'Show the Attribute form
frmAutoAtt.Show
I am a VB newby. Below is a snippet of my program written in VB6, in which I need to
capture the attributes from a block that I know the name of: the block's name
is "TRACKER". I know how to capture the attributes with user input (as shown below),
but I need to capture the attributes with NO user input: ie, no picking the block.
I am looping through numerous drawings to update this block
using VB6 and Acad 2002. I have read through numerous postings and help
files and have not seen such an example - ie: with no user input.
Any help would be appreciated.
Thanks,
Todd-
Public Sub UpdateTrackingInfo()
'Open drawing to process - I am actually looping through multiple drawings and
'processing them - no problem here.
objThisDrawing.Open List2.List(ii)
'Variables for the Block, Attributes and picked point
Dim CurrBlk As AcadBlockReference
Dim CurrAtts As Variant
Dim pt As Variant
'Variables For the Loop Only
Dim strAttributes As String
Dim I As Integer
'Hide the form
frmAutoAtt.Hide
'Max the drawing window
objThisDrawing.WindowState = acMax
'Max the AutoCAD application
objThisDrawing.Application.WindowState = acMax
'Make AutoCAD active
AppActivate "Autocad"
'Pick the block you want to display attributes for
objThisDrawing.Utility.GetEntity CurrBlk, pt, "Pick a Block to display information..."
'THE ABOVE LINE IS WHERE MY ISSUE IS... I DON'T WANT TO PICK THE
'BLOCK. I KNOW THE NAME OF THE BLOOCK - It's NAME IS "TRACKER".
'I JUST WANT TO CAPTURE THE ATTRIBUTES IN "TRACKER" WITHOUT
'ANY USER INPUT.
'Move the attributes from the block to the Variant
CurrAtts = CurrBlk.GetAttributes
'Clear the variable
strAttributes = ""
'Move the attribute tags and values into an array
For I = LBound(CurrAtts) To UBound(CurrAtts)
strAttributes = strAttributes + "Tag: " + CurrAtts(I).TagString + " Value: " + CurrAtts(I).TextString + vbCrLf
Next
'Minimize AutoCAD
objThisDrawing.Application.WindowState = acMin
'Display the Atts and values in a msgbox
MsgBox "The Name of the Block you selected is: " + CurrBlk.Name + "." & vbCrLf + _
"It has the Following Attribute Tags and Values:" & _
vbCrLf & strAttributes
'Show the Attribute form
frmAutoAtt.Show