.NET

Reply
*Nate Hunter
Message 1 of 1 (83 Views)

Selection Sets & Attributs with .NET

83 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
set
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
titleblock
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
SStitle.Item(j).Update()
next j
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!