creating target in RS
I am trying to create a tag in RS using C# i have used below code
Code:
Code:
Station station = Project.ActiveProject as Station;
// Add target.
station.ActiveTask.Targets.Add(P5);
Error:
Error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
station was null.
Could someone support me to fix this?
Thanks!
Sugumar V
Could someone support me to fix this?
Thanks!
Sugumar V
0
Answers
-
I am not a C# programmer - looking at what the error is you may not have a station open in RobotStudio?
The other thing is you would get a RAPID error if you created a Robtarget just called P5 - it needs to have all the data a Robtarget requires eg position (x,y,z), orientation (Q1,Q2,Q3,Q4), etc1 -
Hello,You can stop your debugger just before the line and look if your station is well initialized and your P5.☑️2024 - RobotStudio® User Group1
-
Thanks for the information!
I am not able to access the active station from robot studio (using Robot Studio 2023).
when i run and execute the code Active station is null.
but i have the active station in Rbot studio running.
so, could someone suggest the reason for this error in the code!
Thanks!
0 -
Do you have a virtual controller running in your station?0
-
I have tried with both virtual controller running and stopped, but the result is the same for both the caes(Active station = null).
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings