Exemplo n.º 1
0
        private void buttonFitAll_Click(object sender, EventArgs e)
        {
            FormMain formMain = ((FormMain)this.Owner);

            if (formMain == null)
            {
                CNotice.printLogID("CNGM");
                return;
            }

            // FEMM 을 최상위로 올린다.
            CProgramFEMM.showFEMM();

            // 혹시 FEMM 의 화면이 닫힌 경우 FEMM 의 화면을 복원합니다.
            formMain.reopenFEMM();

            formMain.m_femm.zoomFit();
        }
Exemplo n.º 2
0
        public void buttonDraw_Click(object sender, EventArgs e)
        {
            try
            {
                /// 완벽한 입력인 상태에서만 Draw 가 가능한다.
                bool retOK = isInputDataOK();

                if (retOK == false)
                {
                    return;
                }

                /// [문제]
                ///  - Form 에서는 Parent를 사용할 수 없어 Owner 속성을 사용하지만
                ///    종종 Owner 가 null 로 넘어오는 문제가 발생한다.
                /// [해결]
                ///  - PopupShape 창을 생성하기 전에 Owner 속성을 FormMain 으로 초기화 해 두어야
                ///    확실하게 FormMain 을 얻을 수 있다.
                FormMain formMain = ((FormMain)this.Owner);

                if (formMain == null)
                {
                    CNotice.printLogID("CNGM");
                    return;
                }

                /// 형상 유효성 확인을 위해 임시로 생성한다.
                ///
                CFace faceTemp = makeFaceInPopup();

                if (faceTemp == null)
                {
                    CNotice.noticeWarningID("TWAP1");
                    return;
                }

                if (false == faceTemp.isShapeOK())
                {
                    CNotice.printLogID("TWAP3");
                    return;
                }

                CScriptFEMM femm = formMain.m_femm;

                femm.deleteAll();

                /// 1. 작업 중인 Face 를 제외하고 형상 그리기
                foreach (CDataNode node in formMain.m_design.GetNodeList)
                {
                    if (node.GetType().BaseType.Name == "CShapeParts")
                    {
                        if (node.NodeName != m_strPartName)
                        {
                            ((CShapeParts)node).Face.drawFace(femm);
                        }
                    }
                }

                // FEMM 을 최상위로 올린다.
                CProgramFEMM.showFEMM();

                // 혹시 FEMM 의 화면이 닫힌 경우 FEMM 의 화면을 복원합니다.
                formMain.reopenFEMM();

                /// 2. 작업중인 Face 형상 그리기
                faceTemp.drawFace(femm);
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
            }
        }
Exemplo n.º 3
0
        // 코일에 대한 문자열 라인을 넘겨 받아서 코일 객체를 초기화 한다.
        public bool readObject(List <string> listStringLines)
        {
            CReadFile readFile = new CReadFile();
            string    strTemp;

            string[] arrayString;

            List <string> listInformationLines = new List <string>();
            List <string> listShapeLines       = new List <string>();

            bool bShapeLine = false;

            if (KindKey != EMKind.MAGNET)
            {
                CNotice.printLogID("YATT5");
                return(false);
            }

            try
            {
                // Shape 라인과 정보 라인을 분리한다.
                foreach (string strLine in listStringLines)
                {
                    if (readFile.isEndLine(strLine) == "Shape")
                    {
                        bShapeLine = false;
                    }

                    if (bShapeLine == true)
                    {
                        listShapeLines.Add(strLine);
                    }
                    else
                    {
                        if (readFile.isBeginLine(strLine) == "Shape")
                        {
                            bShapeLine = true;
                        }
                        else
                        {
                            listInformationLines.Add(strLine);
                        }
                    }
                }

                // 정보 라인을 처리한다.
                foreach (string strLine in listInformationLines)
                {
                    strTemp = strLine.Trim('\t');

                    arrayString = strTemp.Split('=');

                    if (arrayString.Length != 2)
                    {
                        CNotice.noticeWarningID("TIAP4");
                        return(false);
                    }

                    switch (arrayString[0])
                    {
                    // CNode
                    case "NodeName":
                        NodeName = arrayString[1];
                        break;

                    case "KindKey":
                        KindKey = (EMKind)Enum.Parse(typeof(EMKind), arrayString[1]);
                        break;

                    // CParts
                    case "MovingParts":
                        MovingPart = (EMMoving)Enum.Parse(typeof(EMMoving), arrayString[1]);
                        break;

                    // CMagnet
                    case "Material":

                        m_strMaterialName = arrayString[1];

                        // FEMM (21Apr2019)에서 NdFeB 40 MGOe 빠져 있어서 호환이 되지 않아 강제로 N40 으로 변경한다.
                        // 추후에 FEMM 에 NdFeB 40 MGOe 가 Legacy 로 추가되면 아래의 코드를 삭제하라.
                        if (CProgramFEMM.getYearFEMM() >= 2019)
                        {
                            if (m_strMaterialName == "NdFeB 40 MGOe")
                            {
                                m_strMaterialName = "N40";
                            }
                        }

                        if (CMaterialListInFEMM.isMagnetlInList(m_strMaterialName) == false)
                        {
                            // 현재의 버전에서 사용할 수 없는 재질이 존재한다면 공백으로 처리하고
                            // 동작 중에 공백을 사용해서 재질이 초기화 되지 않음을 확인한다.
                            m_strMaterialName = "";
                        }

                        break;

                    case "MagnetDirection":
                        emMagnetDirection = (EMMagnetDirection)Enum.Parse(typeof(EMMagnetDirection), arrayString[1]);
                        break;

                    default:
                        break;
                    }
                }

                // Shape 정보가 있는 경우만 m_face 를 생성하고 읽기 작업을 진행한다.
                if (listShapeLines.Count > 0)
                {
                    m_face = new CFace();
                    m_face.readObject(listShapeLines);
                }
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                return(false);
            }

            return(true);
        }