AutoCAD开发5--批量修改dwg文件

    Dim files, path, filename

   

    path = ThisDrawing.Utility.GetString(True, "输入dwg文件所在路径:")

    'dwg文件路径

    

    If path = "" Then Return

    

    files = Dir(path & "*.dwg")


Dim text As AcadText Do While files <> "" '打开dwg文件 ThisDrawing.Application.Documents.Open (path & files) For Each e In ThisDrawing.ModelSpace '设置颜色为白色 e.color = 7 'Debug.Print e.ObjectName If e.ObjectName = "AcDbText" Then Set text = e If Left(text.TextString, 1) = "" Then text.Delete End If End If Next ThisDrawing.Save ThisDrawing.Close files = Dir() Loop

删除dwg文件中第一个字为“宗”的所有文字

你可能感兴趣的:(auto)