VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1 REPLY 1
Reply
Message 1 of 2
Kevin.Sturmer
2400 Views, 1 Reply

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

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.

1 REPLY 1
Message 2 of 2
Hallex
in reply to: Kevin.Sturmer

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost