/// <summary> /// Initializes a new instance of the Work Object class by duplicating an existing Work Object instance. /// </summary> /// <param name="workObject"> The Work Object instance to duplicate. </param> /// <param name="duplicateMesh"> Specifies whether the meshes should be duplicated. </param> public WorkObject(WorkObject workObject, bool duplicateMesh = true) { _referenceType = workObject.ReferenceType; _name = workObject.Name; _plane = new Plane(workObject.Plane); _userFrame = new Plane(workObject.UserFrame); _globalPlane = new Plane(workObject.GlobalWorkObjectPlane); _userFrameOrientation = workObject.UserFrameOrientation; _orientation = workObject.Orientation; _robotHold = workObject.RobotHold; _fixedFrame = workObject.FixedFrame; if (workObject.ExternalAxis == null) { _externalAxis = null; } else if (duplicateMesh == true) { _externalAxis = workObject.ExternalAxis.DuplicateExternalAxis(); } else { _externalAxis = workObject.ExternalAxis.DuplicateExternalAxisWithoutMesh(); } }
/// <summary> /// Initializes a new instance of the Work Object class with a fixed work object. /// </summary> /// <param name="name"> The work object name, must be unique. </param> /// <param name="plane"> The work object coordinate system. </param> public WorkObject(string name, Plane plane) { _referenceType = ReferenceType.PERS; _name = name; _plane = plane; _externalAxis = null; _robotHold = false; _userFrame = Plane.WorldXY; Initialize(); }
/// <summary> /// Initializes a new instance of the Work Object class with the default work object wobj0. /// </summary> public WorkObject() { _referenceType = ReferenceType.PERS; _name = "wobj0"; _plane = Plane.WorldXY; _externalAxis = null; _robotHold = false; _userFrame = Plane.WorldXY; Initialize(); }
private Plane _globalPlane; // global work object plane #endregion #region (de)serialization /// <summary> /// Protected constructor needed for deserialization of the object. /// </summary> /// <param name="info"> The SerializationInfo to extract the data from. </param> /// <param name="context"> The context of this deserialization. </param> protected WorkObject(SerializationInfo info, StreamingContext context) { // int version = (int)info.GetValue("Version", typeof(int)); // <-- use this if the (de)serialization changes _referenceType = (ReferenceType)info.GetValue("Reference Type", typeof(ReferenceType)); _name = (string)info.GetValue("Name", typeof(string)); _plane = (Plane)info.GetValue("Plane", typeof(Plane)); _externalAxis = (ExternalAxis)info.GetValue("External Axis", typeof(ExternalAxis)); _robotHold = (bool)info.GetValue("Robot Hold", typeof(bool)); _userFrame = (Plane)info.GetValue("User Frame", typeof(Plane)); Initialize(); }