*Nate Hunter
Message 1 of 1 (81 Views)

Selection Sets & Attributs with .NET

81 Views, 0 Replies
01-18-2006 01:53 PM
I am trying to grab titleblock attributes, cycle through the titleblocks and
clear the attribute. Meaning if the user typed someting in I won't to make
sure nothing is in the attribute. I could do this in VB6 but with .NET I am
struggling. The only thing I am thinking is wrong is my variable Attrib is
and Object and in VB6 it was a variant. The other thing I think might be
wrong is the SStitle.Item(j).Update() at the bottom of the code.

Does anyone have any ideas??

Here is my code:
Dim intCode(2) As Integer, varValue(2) As Object, Attrib As Object
Dim SStitle As Autodesk.AutoCAD.Interop.AcadSelectionSet
intCode(0) = 0 : varValue(0) = "INSERT"
intCode(1) = 2 : varValue(1) = "Sheet Text " & strTitle
intCode(2) = 8 : varValue(2) = "A-Tblk-Text"
On Error Resume Next
SStitle = ThisDrawing.SelectionSets.Add("TitleBlock") 'make a new selection
If Err.Number Then 'if the selection set already exists this will handle it
Err.Clear() 'clear the error flag
SStitle = ThisDrawing.SelectionSets.Add("TitleBlock") 'use the existing
'On Error GoTo errReport
End If
SStitle.Clear() 'clear out the selection set
SStitle.Select(Autodesk.AutoCAD.Interop.Common.AcSelect.acSelectionSetAll, ,
, intCode, varValue) 'make the selection based on the filters
For j = 0 To SStitle.Count - 1
Attrib = SStitle.Item(j).GetAttributes() 'Get the attributes from the
strTitleDesc = UCase(txtTitle.Text)
If Attrib(0).TextString = strShtName Then
If optClearText.Checked = True Then
For k = 2 To 14
Attrib(k).TextString = " "
Next k
next j
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.