Hello,
Using RobotStudio Api I would like to open an existing station and Start a smiluation. Ideally with RobotStudio UI visible, and recording.
I am using the following powershell script:
Add-Type -Path “C:\Program Files (x86)\ABB\RobotStudio 2024\bin\ABB.Robotics.RobotStudio.dll”
Add-Type -Path “C:\Program Files (x86)\ABB\RobotStudio 2024\bin\ABB.Robotics.RobotStudio.Stations.dll”
[ABB.Robotics.RobotStudio.RobotStudioAPI]::Initialize(“C:\Program Files (x86)\ABB\RobotStudio 2024\Bin”)
$station = [ABB.Robotics.RobotStudio.Stations.Station]::Load(“D:\01_Projects\digital-twin\Station\Station.rsstnx”,$false)
[ABB.Robotics.RobotStudio.Project]::ActiveProject =$station
[ABB.Robotics.RobotStudio.Stations.Simulator]::ActiveConfiguration #To check there is an active sim config
[ABB.Robotics.RobotStudio.Stations.Simulator]::StartAsync()
But in this last line i receive the following error:
Id : 22051
Exception : System.AggregateException: One or more errors occurred. —> System.NullReferenceException: Object reference not set to an instance of an object.
at ABB.Robotics.RobotStudio.Stations.Simulator.d__59.MoveNext()
— End of inner exception stack trace —
—> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at ABB.Robotics.RobotStudio.Stations.Simulator.d__59.MoveNext()<—
I guess probably my approach is incorrect. So I would really appreciate if you could please provide me some tips.
Thank you!