Hi everybody,
I’m currently integrating an IronPython 2.7.1 console into RobotStudion 5.14.02 as an Addin. The first tests look very promising and it works so far, but during testing I stumbled over a null reference exception when calling the default constructor of a Part object after creating a new station.
System:
Windows 7 Ultimate N 64Bit
Assembly ABB.Robotics.RobotStudio.Stations, Version=5.14.4529.2039
I reproduced the same error in the C# part of my Addin by using this Code-Snippet:
Station station = Project.ActiveProject as Station;
if (station == null)
station = new Station();
station.ActiveTask = station.DefaultTask;
Project.ActiveProject = station;
}
Matrix4 box_origin = new Matrix4(Vector3.XVector, 0.0);
box_origin.Translate(0.5, 0, 0);
Vector3 box_size = new Vector3(0.1, 0.1, 0.1);
Part childPart = new Part();
..raises Exception:
System.NullReferenceException wurde nicht von Benutzercode behandelt.
Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source=ABB.Robotics.RobotStudio.Stations
StackTrace:
bei RobotStudio.API.Internal.PartDef..ctor(Boolean supportGeometry, Boolean createGfx)
bei RobotStudio.API.Internal.AssemblyModeler.CreateEmptyPart(Part part, Boolean supportGeometry, Boolean createGfx)
bei ABB.Robotics.RobotStudio.Stations.Part..ctor(Boolean supportGeometry, Boolean createGfx)
bei ABB.Robotics.RobotStudio.Stations.Part..ctor()
bei RobotStudioAddin.AddinMainClass.OnTest(Object sender, EventArgs e) in C:UsersRolf SeegerDocumentsRobotStudioAddInsRobotStudioAddinAddinMainClass.cs:Zeile 104.
bei Sheldon.Scripting.IronPython.IronPythonScriptingContext.DoTest() in C:UsersRolf SeegerDocumentsRobotStudioAddInsSheldonSheldonScriptingIronPythonIronPythonScriptingContext.cs:Zeile 45.
bei Microsoft.Scripting.Interpreter.ActionCallInstruction`1.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
InnerException:
I figured out that the station object’s TemporaryGraphics property has a null reference when running this Code-Snippet ?!
This is not the case when I open/create a station first and run the code aftwerwards.
What’s going on here? Any workarounds?
Any help is very much appreciated..
Thanks, in advance