I tried to change attribute value using the API. According to what I read in Visual Basic, I was able to edit and attribute values correctly. But the drawing does not should the updated values. Instead shows previous values.
The only way I was able to show the updated values is by exploding the block and then making the block again. Anyone one has any idea why? I am new to draftsight API. Any help is appreciated. Thank you.
'Get selected entities and update attribute value
For index As Integer = 0 To count - 1
Dim entityType As dsObjectType_e
Dim selectedEntity As BlockInstance = dsSelectionMgr.GetSelectedObject(dsSelectionSetType_e.dsSelectionSetType_Previous, index, entityType)
dsBlkDefinition = selectedEntity.GetBlockDefinition
dsVarAttrDefinitions = dsBlkDefinition.GetAttributeDefinitions
Dim attributeName As String
Dim attributeValue As String
For attIndex = LBound(dsVarAttrDefinitions) To UBound(dsVarAttrDefinitions)
dsAttrDefinition = dsVarAttrDefinitions(attIndex)
attributeName = dsAttrDefinition.Name
attributeValue = dsAttrDefinition.Value
If attributeName = "LINE" Then
dsAttrDefinition.Value = "1111"
End If
Next
Next