/// <summary> /// 输出IO /// </summary> /// <param name="xeRoot"></param> /// <param name="robotStdPoint"></param> bool WriteOutIO(XmlElement xeRoot, RobotStdPoint robotStdPoint) { try { Point4D p_OutIO = robotStdPoint.P_OutIO; XmlElement xeOutIO = CreateNewXe(xeRoot, "OutIO"); xeRoot.AppendChild(xeOutIO); bool enable = p_OutIO.DblValue1 == -1 ? false : true; WriteAttribute(xeOutIO, "Enable", enable.ToString()); WriteAttribute(xeOutIO, "IO", p_OutIO.DblValue2.ToString()); WriteAttribute(xeOutIO, "WaitTime", p_OutIO.DblValue3.ToString()); WriteAttribute(xeOutIO, "Annotation", p_OutIO.Annotation.ToString()); Point4D p_OutVaccum = robotStdPoint.P_OutVaccum; XmlElement xOutVaccum = CreateNewXe(xeRoot, "OutVaccum"); xeRoot.AppendChild(xOutVaccum); TypeVaccumRobot_enum typeVaccumRobot_e = (TypeVaccumRobot_enum)(p_OutVaccum.DblValue1 - 1); WriteAttribute(xOutVaccum, "Vaccum", typeVaccumRobot_e.ToString()); TypeBlowRobot_enum typeBlowRobot_e = (TypeBlowRobot_enum)(p_OutVaccum.DblValue2 - 1); WriteAttribute(xOutVaccum, "Blow", typeBlowRobot_e.ToString()); WriteAttribute(xOutVaccum, "WaitTime", p_OutVaccum.DblValue3.ToString()); WriteAttribute(xOutVaccum, "Annotation", p_OutVaccum.Annotation.ToString()); return(true); } catch (Exception ex) { return(false); } }
Point4D ReadOutVaccum(XmlElement xeRoot) { try { Point4D point = new Point4D(); string vaccum = ReadChildAttributeStr(xeRoot, "OutVaccum", "Vaccum", "Stay"); TypeVaccumRobot_enum typeVaccumRobot_e = (TypeVaccumRobot_enum)Enum.Parse(typeof(TypeVaccumRobot_enum), vaccum); point.DblValue1 = (int)typeVaccumRobot_e + 1; string blow = ReadChildAttributeStr(xeRoot, "OutVaccum", "Blow", "Stay"); TypeBlowRobot_enum typeBlowRobot_e = (TypeBlowRobot_enum)Enum.Parse(typeof(TypeBlowRobot_enum), blow); point.DblValue2 = (int)typeBlowRobot_e + 1; point.DblValue3 = ReadChildAttributeInt(xeRoot, "OutVaccum", "WaitTime"); string annotation = ReadChildAttributeStr(xeRoot, "OutVaccum", "Annotation"); point.NameClass = "OutVaccum"; return(point); } catch (Exception ex) { return(null); } }