.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Modify a selected attribute value in a block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello,
I am trying to modify an attribute value in a block which I can select it on screen. The question is: when selecting the block, if the entity I pick is an attribute part of the block, can I get the attribute's tag? What I am trying to do is to update a revision block, changing one particular value but the attribute's tag it is not the same it can be different from drawing to drawing.
Thanks for your suggestions.
E.G.
Re: Modify a selected attribute value in a block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You can use Editor.GetNestedEntity() to allow user to directly pick an AttributeReference inside a BlockReference. Then update the Attributereference
Re: Modify a selected attribute value in a block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Yuan,
About the getnestedentity()
My situation:
I'm standing in paperspace. This has one vp.
Can i use the above method to select an entity in the vp wich i've not opend. So i need to select an entity(drawn in modelspace) while standing in paperspace. I need the to get xrecord information so i can automate my annotation.
Hope you understand my problem.
Otherwise please let me know.
Kind regard,
Irvin
Re: Modify a selected attribute value in a block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks Norman,
it solved my problem.
E.G.
Re: Modify a selected attribute value in a block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
class keyThumper<T> : Lazy<T>; another Swamper
I do not endorse the social media app links below![]()
Re: Modify a selected attribute value in a block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Here is the sample code(might need some adjusment): whatever text I have in the clipboard I'll paste it into attribute:
<CommandMethod("44")> _
Public Sub UpdateAttributeValue()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
Dim rs As PromptNestedEntityResult = ed.GetNestedEntity(vbLf & "Select attribute: ")
Dim sTemp As String = String.Empty
sTemp = My.Computer.Clipboard.GetText
If sTemp = String.Empty Then
MsgBox("There is no text in clipboard. Please copy some..")
Return
End If
If rs.Status = PromptStatus.OK Then
Dim oid As ObjectId = rs.ObjectId
Using tr As Transaction = doc.TransactionManager.StartTransaction()
Dim ent As Entity = DirectCast(tr.GetObject(oid, OpenMode.ForRead), Entity)
If TypeOf ent Is AttributeReference Then
Dim attref As AttributeReference = DirectCast(ent, AttributeReference)
attref.UpgradeOpen()
attref.TextString = sTemp
End If
tr.Commit()
End Using
End If
End SubE.G.
