The active camera is set to the one which is selected in the UI. Here is some code which will determine whether a real camera, simulation, or no camera is the active camera. No camera is the case when there is no real camera attached and the simulation is turned off.
This code requires a reference to MediaCy.IQL.Capture.Manager.
Imports MediaCy.IQL.Capture.Manager
Public Module Module1
Function IsCameraSimulation(Optional ByRef noCamera As Boolean = False) As Boolean
Dim captObj As IMcCaptureManagerDevice2
With Capture.CaptureCommands.GetDeviceObject(Nothing)
.Run()
captObj = .Output.Value
End With
If captObj Is Nothing Then noCamera = True
If captObj IsNot Nothing AndAlso captObj.Information.DeviceName.Contains("Capture Simulation") Then Return True
Return False
End Function
Sub WhichCamera()
Dim cameraSim As Boolean = False
Dim cameraNone As Boolean = False
cameraSim = IsCameraSimulation(cameraNone)
ThisApplication.Output.Show()
If cameraSim Then
ThisApplication.Output.PrintMessage("Capture Simulation is the active camera")
ElseIf cameraNone Then
ThisApplication.Output.PrintMessage("There is no currently active camera")
Else
ThisApplication.Output.PrintMessage("There is a real camera active")
End If
End Sub
End Module
Answers
The active camera is set to the one which is selected in the UI. Here is some code which will determine whether a real camera, simulation, or no camera is the active camera. No camera is the case when there is no real camera attached and the simulation is turned off.
This code requires a reference to MediaCy.IQL.Capture.Manager.
Imports MediaCy.IQL.Capture.Manager Public Module Module1 Function IsCameraSimulation(Optional ByRef noCamera As Boolean = False) As Boolean Dim captObj As IMcCaptureManagerDevice2 With Capture.CaptureCommands.GetDeviceObject(Nothing) .Run() captObj = .Output.Value End With If captObj Is Nothing Then noCamera = True If captObj IsNot Nothing AndAlso captObj.Information.DeviceName.Contains("Capture Simulation") Then Return True Return False End Function Sub WhichCamera() Dim cameraSim As Boolean = False Dim cameraNone As Boolean = False cameraSim = IsCameraSimulation(cameraNone) ThisApplication.Output.Show() If cameraSim Then ThisApplication.Output.PrintMessage("Capture Simulation is the active camera") ElseIf cameraNone Then ThisApplication.Output.PrintMessage("There is no currently active camera") Else ThisApplication.Output.PrintMessage("There is a real camera active") End If End Sub End Module