Create new Station RobotStudio SDK
vedo
✭
Hi,
I want to create with visual Studio a new Station in RobotStudo. So the problem is, it function to create a new one, but if it opens the new Station there is no graphic window where I can see my Graphic Components like a Box or something else and I don't know how to put a new view in my Station.
Can someone Help me? I am at beginning to learn RobotStudio SDK
My Code is this
using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;
I want to create with visual Studio a new Station in RobotStudo. So the problem is, it function to create a new one, but if it opens the new Station there is no graphic window where I can see my Graphic Components like a Box or something else and I don't know how to put a new view in my Station.
Can someone Help me? I am at beginning to learn RobotStudio SDK
My Code is this
using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using ABB.Robotics.Math;
using ABB.Robotics.RobotStudio;
using ABB.Robotics.RobotStudio.Environment;
using ABB.Robotics.RobotStudio.Stations;
using RobotStudio.API.Internal;
using ABB.Robotics.RobotStudio.Stations.Forms;
using System.IO;
using System.Drawing;
using System.Threading;
using ABB.Robotics.RobotStudio;
using ABB.Robotics.RobotStudio.Environment;
using ABB.Robotics.RobotStudio.Stations;
using RobotStudio.API.Internal;
using ABB.Robotics.RobotStudio.Stations.Forms;
using System.IO;
using System.Drawing;
using System.Threading;
namespace LokalenUrsprungVeraendern
{
{
public class Class1
{
private static void AddinMain()
{
Project.UndoContext.BeginUndoStep("CameraProperties");
try
{
// Set the active project as our station.
Station station = Station.ActiveStation;
// If there is no active project...
if (station == null)
{
// ...create a new one.
station = new Station();
station.ActiveTask = station.DefaultTask;
Project.ActiveProject = station;
}
// Create a Camera.
Camera myCam = new Camera();
// Set the camera to look at a specific point.
myCam.LookAt = new Vector3(0, 0, 0);
myCam.LookAt = new Vector3(0, 0, 0);
// Set the camera to view from a specific point.
myCam.LookFrom = new Vector3(10, 10, 10);
myCam.LookFrom = new Vector3(10, 10, 10);
// Fix the camera to this point.
myCam.LockRotate = 0.0;
myCam.LockTranslate = 0.0;
myCam.LockZoom = 0.0;
myCam.LockRotate = 0.0;
myCam.LockTranslate = 0.0;
myCam.LockZoom = 0.0;
// Add it to the stations camera collection.
station.Cameras.Add(myCam);
// Sync the current view to the camera view.
GraphicControl.ActiveGraphicControl.SyncCamera(myCam, true, 0);
station.Cameras.Add(myCam);
// Sync the current view to the camera view.
GraphicControl.ActiveGraphicControl.SyncCamera(myCam, true, 0);
// Use the camera as the true camera.
// This make sure that the constraints on the movement kicks in.
GraphicControl.ActiveGraphicControl.Camera = myCam;
// This make sure that the constraints on the movement kicks in.
GraphicControl.ActiveGraphicControl.Camera = myCam;
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
}
}
}
}
0
Comments
-
station = new Station();station.ActiveTask = station.DefaultTask;Project.ActiveProject = station;// Creates new viewer in the stationGraphicControl gc = new GraphicControl();gc.RootObject = station;Camera cam = new Camera();cam.LookFrom = new Vector3(10, 10, 10);gc.Camera = cam;gc.ShowFloor = true;gc.ShowUCSGrid = true;0
-
while compilation this command: Station station = Station.ActiveStation; makes this error this error : System.TypeInitializationExceptionHResult=0x80131534Message=The type initializer for 'ABB.Robotics.RobotStudio.Stations.Station' threw an exception.Inner Exception 1:ReflectionTypeLoadException: Unable to load one or more of the requested types.Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
This means that the connection with RobotStudio through SDK was not established. What is the solution for that?
I appreciate any help!0 -
Hi,
i am facing the same error right now.
could you please let me know if you gt any answer for this query.
Thanks!
0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings