Files
yiyezhqiu-refactored/tools/acceptance/probe_native_attributes.vbs
T

46 lines
2.2 KiB
Plaintext

Dim aProject, aStream, aComp, aAttr, aError
aProject = Application.GetProjectData().GetProjectFilePath()
If InStr(1, aProject, "\acceptance\native-20261010\", vbTextCompare) = 0 Then Err.Raise 999, "Acceptance", "Wrong host"
Set aStream = CreateObject("Scripting.FileSystemObject").CreateTextFile("C:\Users\ABS_Windows\AppData\Local\DxProductivity\acceptance\native-20261010\native-attribute-probe.txt", True, True)
aStream.WriteLine "PROJECT=" & aProject
Application.PushPath "1GPHY_RTL8211F", "", "GE_PHY_8211"
For Each aComp In ActiveView.Query(VDM_COMP, VD_ALL)
If CStr(aComp.UID) = "$5I2744" Or CStr(aComp.UID) = "$5I2942" Then
aStream.WriteLine "COMP=" & aComp.Refdes & " UID=" & aComp.UID
Call ARecord("symbolblock_type", "TypeName(aComp.SymbolBlock)")
Call ARecord("symbol_ref", "aComp.SymbolBlock.FindAttribute(""Ref Designator"").Value")
Call ARecord("symbol_attr_count", "aComp.SymbolBlock.Attributes.Count")
Call ARecord("value1", "aComp.FindAttribute(""Value1"").Value")
If CStr(aComp.UID) = "$5I2744" Then
On Error Resume Next
Set aAttr = aComp.FindAttribute("Value1")
Err.Clear
If aAttr Is Nothing Then
Set aAttr = aComp.AddAttribute("Value1=native-baseline", aComp.GetLocation().X, aComp.GetLocation().Y, 1)
aError = Err.Number
aStream.WriteLine "ADD2_ERROR=" & CStr(aError) & " " & Err.Description
Err.Clear
If aError <> 0 Then
Set aAttr = aComp.FindAttribute("Value1")
aStream.WriteLine "ADD4_ERROR=" & CStr(Err.Number) & " " & Err.Description
Err.Clear
End If
End If
On Error GoTo 0
Call ARecord("value1_after", "aComp.FindAttribute(""Value1"").Value")
End If
End If
Next
aStream.WriteLine "DONE"
aStream.Close
Sub ARecord(label, expression)
Dim value, number, description
On Error Resume Next
value = Eval(expression)
number = Err.Number
description = Err.Description
Err.Clear
aStream.WriteLine label & "=" & CStr(value) & " error=" & CStr(number) & " " & description
On Error GoTo 0
End Sub