急急急 由块名得到块中的所有属性
急急急 由块名得到块中的所有属性 '===================================<BR> '===================================<BR> '========如果有属性修改任务=========<BR> '===================================<BR> '===================================<BR> DoEvents<BR> fileright = False<BR> If Check7.Value = 1 Then<BR> If dwgfile.ActiveSpace = acModelSpace Then<BR> For Each obj In dwgfile.ModelSpace<BR> cadmessage.Label7.Caption = "正在进行属性修改: 查找目标块块 " & mainblock & " 当前 " & obj.ObjectName<BR> <BR> If obj.ObjectName = "AcDbBlockReference" Then<BR> If obj.Name = mainblock Then<BR> fileright = True<BR> cadmessage.Label7.Caption = "正在进行属性修改: 已找到 " & mainblock & " 当前正属性修改中。。。"<BR> objatts = obj.GetAttributes<BR> For m = LBound(objatts) To UBound(objatts)<BR> For n = 0 To Combo6.ListCount - 1<BR> If objatts(m).TagString = Combo6.List(n) Then<BR> If Combo8.List(n) <> "" Then<BR> If Combo8.List(n) = "null" Or Combo8.List(n) = "NULL" Then<BR> objatts(m).TextString = ""<BR> Exit For<BR> Else<BR> objatts(m).TextString = Combo8.List(n)<BR> Exit For<BR> End If<BR> End If<BR> End If<BR> Next n<BR> Next m<BR> End If<BR> End If<BR> Next obj<BR> End If<BR> <BR> <BR> If dwgfile.ActiveSpace = acPaperSpace Then<BR> For Each obj In dwgfile.PaperSpace<BR> cadmessage.Label7.Caption = "正在进行属性修改: 查找目标块块 " & mainblock & " 当前 " & obj.ObjectName<BR> If obj.ObjectName = "AcDbBlockReference" Then<BR> If obj.Name = mainblock Then<BR> fileright = True<BR> cadmessage.Label7.Caption = "正在进行属性修改: 已找到 " & mainblock & " 当前正属性修改中。。。"<BR> objatts = obj.GetAttributes<BR> For m = LBound(objatts) To UBound(objatts)<BR> For n = 0 To Combo6.ListCount - 1<BR> If objatts(m).TagString = Combo6.List(n) Then<BR> If Combo8.List(n) <> "" Then<BR> If Combo8.List(n) = "null" Or Combo8.List(n) = "NULL" Then<BR> objatts(m).TextString = ""<BR> Else<BR> objatts(m).TextString = Combo8.List(n)<BR> End If<BR> End If<BR> End If<BR> Next n<BR> Next m<BR> End If<BR> End If<BR> Next obj<BR> End If<BR> End If<BR> If fileright = False Then<BR> Open VB.App.path & "\errlogolgj.txt" For Append As #1<BR> Print #1, "*********************************************************************************"<BR> Print #1, "打开文件出错:" & opendwgfile<BR> Print #1, "属性修改未完成!未发现目标块 <" & mainblock & ">"<BR> Print #1, Now<BR> Print #1, "*********************************************************************************"<BR> Close #1<BR> End If<BR> fileright = False<BR> <BR> '===================================<BR> '===================================<BR> '========如果有文件名修改任务=======<BR> '===================================<BR> '===================================<BR> DoEvents<BR> If Check10.Value = 1 Then<BR> newdwgname = ""<BR> '判断但前图形是否在模型空间中<BR> If dwgfile.ActiveSpace = acModelSpace Then<BR> '查早目标块<BR> For Each obj In dwgfile.ModelSpace<BR> '显示进程<BR> cadmessage.Label7.Caption = "正在进行文件名提取: 查找目标块块 " & mainblock & " 当前 " & obj.ObjectName<BR> '首先判断块类型是否为块属性<BR> If obj.ObjectName = "AcDbBlockReference" Then<BR> '再判断是否为要查找的目标块<BR> If obj.Name = mainblock Then<BR> fileright = True<BR> '显示进程<BR> cadmessage.Label7.Caption = "正在进行文件名提取: 已找到 " & mainblock & " 当前正属性提取中。。。"<BR> '获取块属性集<BR> objatts = obj.GetAttributes<BR> For z = 1 To 20<BR> If newfilename(z) <> "" Then<BR> If Mid(newfilename(z), 1, 5) = "const" Then<BR> const1 = Right(newfilename(z), (Len(newfilename(z)) - 5))<BR> newdwgname = newdwgname & const1<BR> Else<BR> For m = LBound(objatts) To UBound(objatts)<BR> If objatts(m).TagString = newfilename(z) Then<BR> newdwgname = newdwgname & objatts(m).TextString<BR> Exit For<BR> End If<BR> Next m<BR> End If<BR> End If<BR> Next z<BR> <BR> Exit For<BR> End If<BR> <BR> End If<BR> Next obj<BR> End If<BR> If dwgfile.ActiveSpace = acPaperSpace Then<BR> '查早目标块<BR> For Each obj In dwgfile.PaperSpace<BR> '显示进程<BR> cadmessage.Label7.Caption = "正在进行文件名提取: 查找目标块块 " & mainblock & " 当前 " & obj.ObjectName<BR> '首先判断块类型是否为块属性<BR> If obj.ObjectName = "AcDbBlockReference" Then<BR> '再判断是否为要查找的目标块<BR> If obj.Name = mainblock Then<BR> '显示进程<BR> fileright = True<BR> cadmessage.Label7.Caption = "正在进行文件名提取: 已找到 " & mainblock & " 当前正属性提取中。。。"<BR> '获取块属性集<BR> objatts = obj.GetAttributes<BR> For z = 1 To 20<BR> If newfilename(z) <> "" Then<BR> If Mid(newfilename(z), 1, 5) = "const" Then<BR> const1 = Right(newfilename(z), (Len(newfilename(z)) - 5))<BR> newdwgname = newdwgname & const1<BR> Else<BR> For m = LBound(objatts) To UBound(objatts)<BR> If objatts(m).TagString = newfilename(z) Then<BR> newdwgname = newdwgname & objatts(m).TextString<BR> Exit For<BR> End If<BR> Next m<BR> End If<BR> End If<BR> Next z<BR> <BR> Exit For<BR> End If<BR> <BR> End If<BR> Next obj<BR> End If<BR>
页:
[1]