Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

HTML
<script id="awrscript" type="text/awrscript">
    Function highlight_schematic(s As String, e As String, typ As Integer)
    Dim sc As Schematic
    Dim sy As SystemDiagram
    Dim el As Element
    Dim w As Window
    Dim wds() As Window

    'get array of windows
    For i = 1 To MWOffice.Windows.Count
        If i = 1 Then
            ReDim wds(0)
            Set wds(0) = MWOffice.Windows(i)
        Else
            ReDim Preserve wds(i-1)
            Set wds(i-1) = MWOffice.Windows(i)
        End If
    Next i


    If typ = 1 Then'schematic
        If Project.Schematics.Exists(s) Then
            Set sc = Project.Schematics(s)
            found = 0
            For i = 0 To UBound(wds)
                If window_doc(wds(i).Caption) = sc.Name Then
                    If wds(i).Type = 9 Then 'schematic
                        Set w = wds(i)
                        w.Activate
                        w.WindowState=mwWS_Maximized
                        found = 1
                    End If
                End If
            Next i
            If found = 0 Then
                Set w = sc.NewWindow
            End If
            'get view number
            tmp = w.Caption
            tks = Split(tmp,":")
            If UBound(tks) = 0 Then
                vn = 1
            Else
                vn=CInt(tks(1))
            End If
            If sc.Elements.Exists(e) Then
                Set el = sc.Elements(e)
                el.Selected=True
                sc.Views(vn).ZoomSelected
                sc.Views(vn).ZoomOut
            End If
        End If
    ElseIf typ = 2 Then 'system diagram
        If Project.SystemDiagrams.Exists(s) Then
            Set sy = Project.SystemDiagrams(s)
            found = 0
            For i = 0 To UBound(wds)
                If window_doc(wds(i).Caption) = sy.Name Then
                    If wds(i).Type = 12 Then 'schematic
                        Set w = wds(i)
                        w.Activate
                        w.WindowState=mwWS_Maximized
                        found = 1
                    End If
                End If
            Next i
            If found = 0 Then
                Set w = sy.NewWindow
            End If
            'get view number
            tmp = w.Caption
            tks = Split(tmp,":")
            If UBound(tks) = 0 Then
                vn = 1
            Else
                vn=CInt(tks(1))
            End If
            If sy.Elements.Exists(e) Then
                Set el = sy.Elements(e)
                el.Selected=True
                sy.Views(vn).ZoomSelected
                sy.Views(vn).ZoomOut
            End If
        End If
    End If
End Function
Function window_doc(s As String) As String
    tks = Split(s,":")
    tks2 = Split(tks(0),"(")
    window_doc = tks2(0)
End Function
Function parse_check() As String

    dnt = Project.DataFiles("Project_Errors").DataAsText
    tks = Split(dnt,vbLf)
    'make hmtl
    'If no tab, his h3
    'If tab, use p but need To use the header To Get Type, 1=sch, 2=sys, 3 other For Now.
    html = "["
    start = True

    For i = 1 To UBound (tks) 'skip first line
        'Debug.Print tks(i)
        'section titles, but skip
        If Trim(tks(i)) = "" Then 'skip blanks

        ElseIf Left(tks(i),1) <> vbTab Then'found header, start new top level object.
            Select Case tks(i)
            Case "Checking for Obsolete Circuit Models:"
                typ = 1
            Case "Checking for Obsolete System Models:"
                typ=2
            Case "Checking for _FREQ in Output Equations:"
                typ=3 'could open up this window, not done yet.
            Case "Checking Layout Settings:"
                typ=3 'could get access to this dialog box, would be a new case.
            Case "Checking Layout Parameters Precision:"
                typ=1
            Case "Checking for Models Connected with Mismatched Widths:"
                typ=1
            Case "Checking for Shorted Elements:"
                typ=1
            Case "Checking for Open Nodes:"
                typ=1
            Case "Checking for Overlapping Elements:"
                typ=1
            Case "Checking for GDSII Formatted Layers in Drawing Layer List:"
                typ=3
            Case "Checking if Project PDKs Need Updates:"
                typ=3
            Case Else
                typ = 3
            End Select

            'html = html & "<h3>" & Replace(tks(i),":","") & "</h3>" & vbCrLf
            If InStr(tks(i),"Check time") Then
                'html = html & "{""Text"":""" &  tks(i) & """}"

                If start = True Then 'see if the first object, otherwise need to close it down
                    start=False
                Else
                    html = html & "] },"
                End If
                html = html & "{""Text"":""" &  tks(i) & """}"
            Else
                If start = True Then 'see if the first object, otherwise need to close it down
                    start=False
                Else
                    html = html & "] },"
                End If
                html = html & "{""Text"":""" &  tks(i) & """, ""errors"": ["
            End If
            'need to not have comma at the end.

        Else 'means not header, use type to see if can find schematic/system diagram
            If typ = 1 Or typ = 2  Then
                tks2 = Split(tks(i),":")
                s = Trim(Split(tks2(1),",")(0))
                e = Trim(Split(tks2(2)," ")(1))
                e = Replace(e,",","") 'one check has comma aftter element.
   				'html = html & "<p id=""mwo_highligt"" onclick=""runAwrScript('highlight_schematic','" & s & "','" & e & "','" & 1 & "')"">" & tks(i) & "</p>" & vbCrLf
                html = html & "{""doc"":""" & s & """,""elem"":""" & e & """,""type"":""" & typ & """,""msg"":""" & Replace(tks(i),vbTab,"")& """}"
                'determine next line if it is another error or new category to get array separator right
                If Left(tks(i+1),1) = vbTab Then
                    html = html & ","
                End If
                'needs a comma between items but not at the end
            Else
                'just print messages here and the type.
                html = html & "{""type"":""" & typ & """,""msg"":""" & Replace(tks(i),vbTab,"")& """}"
                If Left(tks(i+1),1) = vbTab Then
                    html = html & ","
                End If
            End If
        End If
    Next i
    html = html & "  ]" 'end of json object at top level.
    parse_check= html
End Function
</script> 

...