Пример #1
0
        private void FormLoad(object sender, EventArgs e)
        {
            int selIndex       = -1;
            int count          = valueTable.Length;
            int registerdIndex = 0;

            for (int i = 0; i < count; i++)
            {
                if (((ulong)(valueTable[i]) & selectableLayer) == 0)
                {
                    continue;
                }
                if (valueTable[i] == layer)
                {
                    selIndex = registerdIndex;
                }
                string layerName = MbeLayer.GetLayerName(valueTable[i]);
                comboBoxLayer.Items.Add(layerName);
                registeredLayerValue[registerdIndex] = valueTable[i];
                registerdIndex++;
            }
            if (selIndex == -1)
            {
                selIndex = 0;
            }
            comboBoxLayer.SelectedIndex = selIndex;
        }
Пример #2
0
 public virtual void Flip(int hCenter)
 {
     for (int i = 0; i < posCount; i++)
     {
         int x = hCenter - (posArray[i].X - hCenter);
         int y = posArray[i].Y;
         posArray[i] = new Point(x, y);
     }
     Layer = MbeLayer.Flip(layer);
 }
Пример #3
0
 /// <summary>
 /// Mb3ファイルへメンバーの書き込み
 /// </summary>
 /// <param name="writeCE3"></param>
 /// <returns></returns>
 public virtual bool WrMb3Member(WriteCE3 writeCE3, Point origin)
 {
     writeCE3.WriteRecordString("LAYER", MbeLayer.GetLayerName(layer));
     for (int i = 0; i < posCount; i++)
     {
         writeCE3.WriteRecordInt(string.Format("XPOS{0}", i), posArray[i].X - origin.X);
         writeCE3.WriteRecordInt(string.Format("YPOS{0}", i), posArray[i].Y - origin.Y);
     }
     writeCE3.WriteRecordString("SIGNAME", signame);
     return(true);
 }
Пример #4
0
        /// <summary>
        /// Mb3ファイルの読み込み時のメンバーの解釈を行う
        /// </summary>
        /// <param name="str1">変数名または"+"で始まるブロックタグ</param>
        /// <param name="str2">変数値</param>
        /// <param name="readCE3">ブロック読み込み時に使うReadCE3クラス</param>
        /// <returns>正常終了時にReadCE3.RdStatus.NoErrorを返す</returns>
        public virtual ReadCE3.RdStatus RdMb3Member(string str1, string str2, ReadCE3 readCE3)
        {
            //ReadCE3.RdStatus result = ReadCE3.RdStatus.NoError;

            switch (str1)
            {
            case "LAYER":
                Layer = MbeLayer.GetLayerValue(str2);
                return(ReadCE3.RdStatus.NoError);

            case "SIGNAME":
                SigName = ReadCE3.DecodeCE3String(str2);
                return(ReadCE3.RdStatus.NoError);
            }

            if ((str1.Substring(1, 3) == "POS") && (str1.Length > 4))
            {
                string strIndex = str1.Substring(4);
                int    index;
                int    value;
                try {
                    index = Convert.ToInt32(strIndex);
                    value = Convert.ToInt32(str2);
                }
                catch (Exception) {
                    return(ReadCE3.RdStatus.FormatError);
                }
                if (str1[0] == 'X')
                {
                    SetXPos(value, index);
                    return(ReadCE3.RdStatus.NoError);
                }
                else if (str1[0] == 'Y')
                {
                    SetYPos(value, index);
                    return(ReadCE3.RdStatus.NoError);
                }
            }


            if (str1[0] == '+' && str1.Length >= 2)
            {
                string strSkipTo = "-" + str1.Substring(1);
                if (!readCE3.SkipTo(strSkipTo))
                {
                    return(ReadCE3.RdStatus.FileError);
                }
            }

            return(ReadCE3.RdStatus.NoError);
        }
Пример #5
0
        public override void Flip(int hCenter)
        {
            int x = hCenter - (posArray[0].X - hCenter);
            int y = posArray[0].Y;

            posArray[0] = new Point(x, y);
            int newStartAngle = 1800 - EndAngle;
            int newEndAngle   = 1800 - StartAngle;

            StartAngle = newStartAngle;
            EndAngle   = newEndAngle;
            SetupPosition();
            Layer = MbeLayer.Flip(layer);
        }
Пример #6
0
        public override void Flip(int hCenter)
        {
            int x = hCenter - (posArray[0].X - hCenter);
            int y = posArray[0].Y;

            posArray[0] = new Point(x, y);

            refNum.Flip(hCenter);
            if (contentsObj != null)
            {
                foreach (MbeObj obj in contentsObj)
                {
                    obj.Flip(hCenter);
                }
            }
            layer = MbeLayer.Flip(layer);
        }
Пример #7
0
 public static MbeLayer.LayerValue NewSelectLayer(MbeLayer.LayerValue oldLayer)
 {
     if ((SelectableLayer() & (ulong)oldLayer) != 0)
     {
         return(oldLayer);
     }
     else
     {
         if (MbeLayer.IsComponentSide(oldLayer))
         {
             return(MbeLayer.LayerValue.CMP);
         }
         else
         {
             return(MbeLayer.LayerValue.SOL);
         }
     }
 }
Пример #8
0
        protected CamOutResult GerberOutLayer(string path, MbeLayer.LayerValue layer)
        {
            CamOutResult result = new CamOutResult();

            result.code = CamOutResult.ResultCode.NOERROR;

            string       outpath      = Path.ChangeExtension(path, MbeLayer.GetLayerName(layer));
            StreamWriter streamWriter = null;

            try {
                streamWriter = new StreamWriter(outpath);
                int n;
                n = GerberHeaderStringArray.Length;
                for (int i = 0; i < n; i++)
                {
                    streamWriter.WriteLine(GerberHeaderStringArray[i]);
                }
                OutAdCode(streamWriter, layer);
                OutPlotData(streamWriter, layer);
                n = GerberFooterStringArray.Length;
                for (int i = 0; i < n; i++)
                {
                    streamWriter.WriteLine(GerberFooterStringArray[i]);
                }
            }
            catch (Exception) {
                result.code     = CamOutResult.ResultCode.FILEERROR;
                result.filename = Path.GetFileName(outpath);
                return(result);
            }
            finally {
                if (streamWriter != null)
                {
                    streamWriter.Close();
                }
            }
            return(result);
        }