The procedure for requesting AWR support has changed. Please read all about the new AWR product support process.
Page tree
Skip to end of metadata
Go to start of metadata
 Function awrGetActiveSchematic As Schematic
  Dim sch As Schematic
  Dim w As Window
  If Not (Project.Schematics Is Nothing) And Not (Project.Schematics.ActiveSchematic Is Nothing) Then
    Set sch = Project.Schematics.ActiveSchematic
    ' unfortunately this does not tell us if the active window is a schematic or a layout.  ActiveSchematic will
    ' return the schematic for a layout if a layout window is active so we need to make sure the active window
    ' is actually a schematic
    For Each w In sch.Windows
      If w.Active=True And w.Type<>mwWT_Schematic Then
        'active window is not a schematic
        Set sch=Nothing
      End If
    Next w

    If Not (sch Is Nothing)  Then
      Set awrGetActiveSchematic = sch
    End If
  End If
End Function