AutoCAD 2011 Batch Convert Field attribute to text attribute in blocks using VBA

AutoCAD 2011 Batch Convert Field attribute to text attribute in blocks using VBA

Anonymous
Not applicable
2,707 Views
1 Reply
Message 1 of 2

AutoCAD 2011 Batch Convert Field attribute to text attribute in blocks using VBA

Anonymous
Not applicable

I've got hundreds of files to convert. 

 

In VBA, how can I batch convert field attributes in blocks to text attributes while retaining the blocks?  Is there a simple way to univerally convert them all at onceusing VBA?  The plotted values for the fields must be retained, too.

 

Explode will not retain the value of the field.

Burst will not work as it explodes the blocks as well.

 

You can right-click on the field and slelct "Convert to text" from the RCM.  So I know that the process exists within CAD, just need to batch the process for a quantity of DWGs at a time - in VBA.

0 Likes
2,708 Views
1 Reply
Reply (1)
Message 2 of 2

Hallex
Advisor
Advisor

Try this trick on single attribute

Hint:

Sub Demo()

Dim att As AcadAttributeReference

Dim oEnt As Object

Dim pickPt As Variant, tmx As Variant, ctx As Variant
 
ThisDrawing.Utility.GetSubEntity oEnt, pickPt, tmx, ctx, vbCrLf & "Select attribute with field >>"
    
If TypeOf oEnt Is AcadAttributeReference Then

Set att = oEnt

Dim attvalue As String

attvalue = att.TextString

att.TextString = ""

att.TextString = attvalue

Else

MsgBox "Selected object is not an attributee reference: " & oEnt.ObjectName

Exit Sub

End If

End Sub

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes