Beispiel #1
0
        protected override void WriteAuto(CompInfoTemp c, int autoBufferNo, ref string scripts)
        {
            bool LL, RL;

            LL = c.content.ContainsKey(KeyWordDef.LL);
            RL = c.content.ContainsKey(KeyWordDef.RL);
            if (LL || RL)
            {
                int index = CompManager.GetBufferIndex(autoBufferNo, scripts);
                int count = CompManager.GetBufferIndex(autoBufferNo, scripts);
                List <Dictionary <string, string> > autoDictList = new List <Dictionary <string, string> >()
                {
                    new Dictionary <string, string>()
                    {
                        { "#AxisNo#", GetAxisNo(c).ToString() },
                        { "@RL", RL ? c.content[KeyWordDef.RL] : "#RL" },
                        { "@LL", LL ? c.content[KeyWordDef.LL] : "#LL" },
                        { "#RightLimit#", RL ? "" : "!" },
                        { "#LeftLimit#", LL ? "" : "!" },
                    }
                };
                string repeatKeyWord = "LimitRepeat";
                TextFunctions.AppendMultiRepeat(ref scripts, repeatKeyWord, autoDictList, index, count);
            }
        }
Beispiel #2
0
        protected override void WriteComp(CompInfoTemp c, int compBufferNo, List <int> homeBufferNo, ref string scripts)
        {
            string CHM = c.content[KeyWordDef.HM];

            if (!CHM.Contains("D"))
            {
                TextFunctions.AppendMultiRepeat(
                    ref scripts,
                    "SingleAxisHome",
                    new List <Dictionary <string, string> >()
                {
                    new Dictionary <string, string>()
                    {
                        { "#AxisNo#", GetAxisNo(c).ToString() },
                        { "#NAME#", GetAxisName(c, false) },
                        { "@HG", GetHomeBufferNo(c, homeBufferNo).ToString() },
                    }
                },
                    CompManager.GetBufferIndex(compBufferNo, scripts),
                    CompManager.GetBufferCount(compBufferNo, scripts)
                    );
            }
            bool CN = int.Parse(c.content[KeyWordDef.CN]) > 0 ? true : false;

            if (!CN)
            {
                return;
            }
            int index = GetHomeIndex(c, homeBufferNo, scripts);
            int count = GetHomeCount(c, homeBufferNo, scripts);

            List <Dictionary <string, string> > compDictList = new List <Dictionary <string, string> >()
            {
                new Dictionary <string, string>()
                {
                    { "#AxisNo#", GetAxisNo(c).ToString() },
                    { "#BCNo#", compBufferNo.ToString() },
                    { "@CS", c.content[KeyWordDef.CS] },
                    { "@CT", c.content[KeyWordDef.CT] },
                    { "@CND", c.content[KeyWordDef.CND] },
                    { "#NAME#", GetAxisName(c, false) },
                    { "@HG", GetHomeBufferNo(c, homeBufferNo).ToString() },
                }
            };
            string repeatKeyWord = "CompRepeat";

            TextFunctions.AppendMultiRepeat(ref scripts, repeatKeyWord, compDictList, index, count);
            index = CompManager.GetBufferIndex(compBufferNo, scripts);
            count = CompManager.GetBufferCount(compBufferNo, scripts);
            TextFunctions.AppendMultiRepeat(ref scripts, repeatKeyWord, compDictList, index, count);
            index = CompManager.GetBufferIndex(ST.DEF, scripts);
            TextFunctions.AppendMultiRepeat(ref scripts, repeatKeyWord, compDictList, index);
        }
Beispiel #3
0
        protected override void WriteLaser(CompInfoTemp c, int laserBufferNo, ref string scripts)
        {
            int index = CompManager.GetBufferIndex(laserBufferNo, scripts);
            int count = CompManager.GetBufferCount(laserBufferNo, scripts);

            List <Dictionary <string, string> > LCMDictList = new List <Dictionary <string, string> >()
            {
                new Dictionary <string, string>()
                {
                    { "#AxisNo#", (c.axisStart + 3).ToString() },
                }
            };
            string repeatKeyWord = "LaserRepeat_LCM_" + c.content[KeyWordDef.LM];

            TextFunctions.AppendMultiRepeat(ref scripts, repeatKeyWord, LCMDictList, index, count);
        }
Beispiel #4
0
        protected override void WriteAuto(CompInfoTemp c, int autoBufferNo, ref string scripts)
        {
            int index = CompManager.GetBufferIndex(autoBufferNo, scripts);
            int count = CompManager.GetBufferIndex(autoBufferNo, scripts);
            List <Dictionary <string, string> > autoDictList;

            autoDictList = new List <Dictionary <string, string> >()
            {
                c.content.ToDictionary(k => '@' + k.Key, v => v.Value)
            };
            autoDictList.First().Add("#AxisNo#", c.axisStart.ToString());
            string repeatKeyWord = "CANRepeat";

            TextFunctions.AppendMultiRepeat(ref scripts, repeatKeyWord, autoDictList, index, count);

            base.WriteAuto(c, autoBufferNo, ref scripts);
        }
Beispiel #5
0
        protected override void WriteAuto(CompInfoTemp c, int autoBufferNo, ref string scripts)
        {
            ParseTopo(c.content[KeyWordDef.TOP]);
            //Write IO Config
            string KeyWord    = "IORepeat";
            int    startIndex = CompManager.GetBufferIndex(ST.AUTO, scripts);
            List <Dictionary <string, string> > IODictList = GenerateDictList(c, out int IIndex, out int OIndex);

            IODictList = IODictList.OrderByDescending(d => d["#IOType#"]).Select((d, i) =>
            {
                if (i != 0)
                {
                    d.Remove("#StartIndex#");
                }
                return(d);
            }).ToList();
            CheckIndexes(IODictList);
            TextFunctions.AppendMultiRepeat(ref scripts, KeyWord, IODictList, startIndex);

            Dictionary <string, string> OADict = new Dictionary <string, string>
            {
                { "OA1", "BeforeUnstopRepeat" },
                { "OA2", "DuringEMGRepeat" },
                { "OA3", "EscapeEMGRepeat" },
            };

            foreach (var kv in OADict)
            {
                if (c.content.ContainsKey(kv.Key))
                {
                    KeyWord    = kv.Value;
                    IODictList = GetOADictList(c, kv.Key);
                    TextFunctions.AppendMultiRepeat(ref scripts, KeyWord, IODictList, startIndex);
                }
            }

            if (!c.content.ContainsKey("EMG"))
            {
                c.content.Add("EMG", "EMG");
            }
            TextFunctions.ReplaceSingle(ref scripts, c.content, startIndex);
            TextFunctions.AppendMultiNoRepeat(ref scripts, c.content, startIndex);
        }
Beispiel #6
0
        protected virtual void WriteAutoSingle(CompInfoTemp c, int autoBufferNo, ref string scripts)
        {
            bool MU    = int.Parse(c.content[KeyWordDef.MU]) > 0 ? true : false;
            int  index = CompManager.GetBufferIndex(autoBufferNo, scripts);
            int  count = CompManager.GetBufferIndex(autoBufferNo, scripts);
            List <Dictionary <string, string> > autoDictList;

            if (MU)
            {
                autoDictList = new List <Dictionary <string, string> >()
                {
                    new Dictionary <string, string>()
                    {
                        { "#AxisNo#", GetAxisNo(c).ToString() },
                    }
                };
                string repeatKeyWord = "CommutRepeat";
                TextFunctions.AppendMultiRepeat(ref scripts, repeatKeyWord, autoDictList, index, count);
            }

            base.WriteAuto(c, autoBufferNo, ref scripts);
        }
Beispiel #7
0
        protected virtual int GetHomeCount(CompInfoTemp c, List <int> homeBufferNo, string scripts)
        {
            int count = CompManager.GetBufferCount(GetHomeBufferNo(c, homeBufferNo), scripts);

            return(count);
        }
Beispiel #8
0
        protected virtual int GetHomeIndex(CompInfoTemp c, List <int> homeBufferNo, string scripts)
        {
            int HGIndex = CompManager.GetBufferIndex(GetHomeBufferNo(c, homeBufferNo), scripts);

            return(HGIndex);
        }