hi all
in this code
Private Function MYSelectionSet(Type As MyType, Name As String) As SelectionSet Dim acSelFtr As SelectionFilter If Type = MyType.Block Then acSelFtr = New SelectionFilter({New TypedValue(DxfCode.BlockName, Name)}) Else acSelFtr = New SelectionFilter({New TypedValue(DxfCode.Start, Name)}) End If MYSelectionSet = Ed.GetSelection(acSelFtr).Value End Function <CommandMethod("tst")> _ Public Sub testing() Dim MySel As SelectionSet = MYSelectionSet(MyType.Block, "AMR.LEVEL") Dim Tr As Transaction = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction() If MySel IsNot Nothing Then For Each BlKID In MySel.GetObjectIds() Dim BlkRef As BlockReference = Tr.GetObject(BlKID, OpenMode.ForWrite)
' What can i write here to access for BlkRef Attributes
Next End If Tr.Commit() End Sub
i need to access BlkRef Attributes (read & write) values
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
Once you have in instance of a BlockReference class, you can just loop through its AttributeCollecction property. If you examined the BlockReference class in Object Browser, it would have been fairly obvious.
Code would be like:
For Each objId As ObjectId in BlkRef.AttributeCollection
Dim attRef As Attributereference=Tr.GetObject(objId, OpenMode.ForWrite)
Select Case attRef.Tag.ToUpper()
Case "AAA"
attRef="XXX"
Case "BBB"
attRef="YYY"
...
End Select
Next
Norman Yuan
You can refer the below link to update block atrributes
http://through-the-interface.typepad.com/through_the_interface/2007/07/updating-a-spec.html
Can't find what you're looking for? Ask the community or share your knowledge.