/// <summary> /// 输出PC /// </summary> /// <param name="xeRoot"></param> /// <param name="robotStdPoint"></param> bool WriteOutPC(XmlElement xeRoot, RobotStdPoint robotStdPoint) { try { Point4D p_OutPC = robotStdPoint.P_OutPC; XmlElement xeOutPC = CreateNewXe(xeRoot, "OutPC"); xeRoot.AppendChild(xeOutPC); bool enable = p_OutPC.DblValue1 == 1 ? true : false; WriteAttribute(xeOutPC, "Enable", enable.ToString()); TypeOutPCRobot_enum typeOutPCRobot_e = (TypeOutPCRobot_enum)(p_OutPC.DblValue2 - 1); WriteAttribute(xeOutPC, "Type", typeOutPCRobot_e.ToString()); WriteAttribute(xeOutPC, "CMD", p_OutPC.DblValue3.ToString()); WriteAttribute(xeOutPC, "NGIO", p_OutPC.DblValue4.ToString()); WriteAttribute(xeOutPC, "Annotation", p_OutPC.Annotation.ToString()); return(true); } catch (Exception ex) { return(false); } }
Point4D ReadOutPC(XmlElement xeRoot) { try { Point4D point = new Point4D(); bool enable = ReadChildAttributeBl(xeRoot, "OutPC", "Enable"); if (enable) { point.DblValue1 = 1; } else { point.DblValue1 = -1; } string type = ReadChildAttributeStr(xeRoot, "OutPC", "Type", "Camera1"); TypeOutPCRobot_enum TypeOutPCRobot_e = (TypeOutPCRobot_enum)Enum.Parse(typeof(TypeOutPCRobot_enum), type); point.DblValue2 = (int)TypeOutPCRobot_e + 1; point.DblValue3 = ReadChildAttributeInt(xeRoot, "OutPC", "CMD", 1); point.DblValue4 = ReadChildAttributeInt(xeRoot, "OutPC", "NGIO"); string annotation = ReadChildAttributeStr(xeRoot, "OutPC", "Annotation"); point.NameClass = "OutPC"; return(point); } catch (Exception ex) { return(null); } }