示例#1
0
        public void setBlockPropCurrent(CScriptFEMM femm, double dCurrent, double dMeshSize)
        {
            CPoint blockPoint = null;

            blockPoint = this.Face.getBlockPoint();

            if (blockPoint == null)
            {
                CNotice.printLogID("NBPF");
                return;
            }

            string strMaterialName = this.m_strMaterialName;

            string strCircuit = NodeName + "_current";

            if (CurrentDirection == EMCurrentDirection.OUT)
            {
                dCurrent = -dCurrent;
            }

            femm.addCircuitProp(strCircuit, dCurrent);

            femm.setBlockProp(blockPoint, strMaterialName, dMeshSize, strCircuit, 0, MovingPart, Turns);
        }
示例#2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            /// 완벽한 입력인 상태에서만 Draw 및 저장이 가능한다.
            if (isInputDataOK() == false)
            {
                DialogResult = DialogResult.Cancel;
                return;
            }

            if (PartType == EMKind.COIL && FaceType == EMFaceType.POLYGON)
            {
                if (false == isRectangleShapeInPopup())
                {
                    if (CSettingData.m_emLanguage == EMLanguage.Korean)
                    {
                        CNotice.noticeWarning("Coil 의 형상이 직사각형이 아닙니다.\nCoil 지정을 취소합니다.");
                    }
                    else
                    {
                        CNotice.noticeWarning("The shape of the Coil is not rectangular.\n.Cancels the Coil assignment.");
                    }

                    DialogResult = DialogResult.Cancel;
                    return;
                }
            }

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

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

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

            FormMain formMain = ((FormMain)this.Owner);

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

            m_strPartName = textBoxPartName.Text;

            // 문제가 없으면 정상 종료를 리턴한다.
            DialogResult = DialogResult.OK;
        }
示例#3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.m_faceType != EMFaceType.POLYGON)
            {
                CNotice.printLogID("TBOA");
                return;
            }

            this.addPointControl(new CPointUI(), true, this.panelPointControl);
        }
示例#4
0
        /// <summary>
        /// FEMM 에 Face 를 그린다.
        ///
        /// FEMM 에 형상을 그릴 때는 절대좌표를 사용해야 한다.
        /// </summary>
        /// <param name="femm">FEMM</param>
        /// <param name="emMoving">Line 의 Group 를 결정하기 위한 동작부 여부</param>
        public bool drawFace(CScriptFEMM femm, EMMoving emMoving = EMMoving.FIXED)
        {
            double x1, y1, x2, y2;
            bool   bDirectionArc = false;

            if (m_listRelativePoint.Count < MIN_POINT_COUNT)
            {
                CNotice.printLogID("YATT2");
                return(false);
            }

            /// 매번 생성하는 Property 이기 때문에
            /// LineList 는 새로운 List에  담는 동작 한번만 호출하고, 사용은 새로운 List 를 사용한다.
            List <CPoint> listAbsolutePoint = new List <CPoint>();

            listAbsolutePoint = AbsolutePointList;

            // Face 에 저장될 때는 Rectangle 도 4개의 직선으로 저장되기 때문에
            // Face 를 그릴 때는 모두 다각형으로 취급한다.
            for (int i = 0; i < listAbsolutePoint.Count; i++)
            {
                // 마지막 Point 만 제외한다.
                if (i < listAbsolutePoint.Count - 1)
                {
                    x1 = listAbsolutePoint[i].X;
                    y1 = listAbsolutePoint[i].Y;
                    x2 = listAbsolutePoint[i + 1].X;
                    y2 = listAbsolutePoint[i + 1].Y;
                }
                // 마지막 선은 끝점과 첫점을 있는다
                else
                {
                    x1 = listAbsolutePoint[i].X;
                    y1 = listAbsolutePoint[i].Y;
                    x2 = listAbsolutePoint[0].X;
                    y2 = listAbsolutePoint[0].Y;
                }

                if (listAbsolutePoint[i].LineKind == EMLineKind.ARC)
                {
                    bDirectionArc = (listAbsolutePoint[i].DirectionArc == EMDirectionArc.BACKWARD ? true : false);
                    femm.drawArc(x1, y1, x2, y2, bDirectionArc, emMoving);
                }
                else
                {
                    femm.drawLine(x1, y1, x2, y2, emMoving);
                }
            }

            return(true);
        }
示例#5
0
        public static bool checkPreviousFEMM()
        {
            try
            {
                // FEMM 설치 메인 디렉토리를 얻어낸다.
                string strFEMMDirName = Path.GetDirectoryName(CSettingData.m_strFemmExeFileFullName);
                strFEMMDirName = strFEMMDirName.Remove(strFEMMDirName.IndexOf("bin"));

                // readme.txt 의 첫 줄을 읽어낸다.
                string strReadmeFileFullName = Path.Combine(strFEMMDirName, "readme.txt");

                CReadFile readFile       = new CReadFile();
                string    strVersionFEMM = readFile.getLine(strReadmeFileFullName, 1);      // 내용 : FEMM 4.2 12Jan2016

                // readme.txt 에서 FEMM 4.2 버전의 Build 날짜를 읽어낸다.
                char[]   separators = { ' ' };
                string[] strArray;
                strArray = strVersionFEMM.Split(separators, StringSplitOptions.None);
                string strVersionDate = strArray[2];                                        // 내용 : 12Jan2016

                if (strVersionDate.Length < 9)
                {
                    CNotice.printLogID("TWAP4");
                    return(false);
                }

                DateTime currentDataTime = new DateTime();
                DateTime limitDataTime   = new DateTime();

                limitDataTime   = Convert.ToDateTime("24Sep2017");
                currentDataTime = Convert.ToDateTime(strVersionDate);

                // 24Sep2017 보다 이전 버전이면 true 를 리턴한다.
                if (currentDataTime < limitDataTime)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                return(false);
            }
        }
示例#6
0
        public void setBlockProp(CScriptFEMM femm, double dMeshSize)
        {
            CPoint blockPoint = null;

            blockPoint = this.Face.getBlockPoint();

            if (blockPoint == null)
            {
                CNotice.printLogID("NBPF");
                return;
            }

            string strMaterialName = this.m_strMaterialName;

            femm.setBlockProp(blockPoint, strMaterialName, dMeshSize, "none", 0, MovingPart, 0);
        }
示例#7
0
        public void drawDesign(CScriptFEMM femm)
        {
            foreach (CDataNode node in GetNodeList)
            {
                if (node.GetType().BaseType.Name == "CShapeParts")
                {
                    CShapeParts nodeParts = (CShapeParts)node;

                    if (null != nodeParts.Face)
                        nodeParts.Face.drawFace(femm, nodeParts.MovingPart);
                    else
                        CNotice.printLogID("YATT1");
                }
            }

            femm.zoomFit();
        }
示例#8
0
        /// <summary>
        /// Face 의 형상 정보가 없는 경우 호출되는 생성자로
        /// 툴바의 파트 생성 버튼을 사용할 때 호출되는 생성자이다.
        /// </summary>
        public PopupShape(EMFaceType drawType, EMKind emKind)
        {
            InitializeComponent();

            m_strPartName = string.Empty;
            m_partType    = emKind;

            m_bCreatePopupWindow = true;

            textBoxBaseX.Text = "0.0";
            textBoxBaseY.Text = "0.0";

            switch (m_partType)
            {
            case EMKind.COIL:
                labelPartName.Text = "Coil Name :";
                this.Text          = "Add Coil";
                break;

            case EMKind.MAGNET:
                labelPartName.Text = "Magnet Name :";
                this.Text          = "Add Magnet";
                break;

            case EMKind.STEEL:
                labelPartName.Text = "Steel Name :";
                this.Text          = "Add Steel";
                break;

            default:
                CNotice.printLogID("TPTI");
                return;
            }

            // 콤보박스 데이터는 파라메터로 넘어오는 대로 강제로 지정한다.
            comboBoxFaceType.SelectedItem = drawType.ToString();
            comboBoxNodeType.SelectedItem = m_partType.ToString();

            /// 코일의 경우는 코일계산 때문에 Rectangle 로 고정을 해야 한다.
            if (emKind == EMKind.COIL)
            {
                comboBoxFaceType.Enabled = false;
            }

            comboBoxNodeType.Enabled = false;
        }
示例#9
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();
        }
示例#10
0
        /// <summary>
        /// 다각형의 포인트를 저장한다.
        /// </summary>
        /// <param name="listPoint"></param>
        /// <returns></returns>
        public bool setPolygonPoints(List <CPoint> listPoint)
        {
            if (listPoint.Count < MIN_POINT_COUNT)
            {
                CNotice.printLogID("YATT");
                return(false);
            }

            m_listRelativePoint.Clear();

            m_emFaceType = EMFaceType.POLYGON;

            foreach (CPoint point in listPoint)
            {
                m_listRelativePoint.Add(point);
            }

            return(true);
        }
示例#11
0
        public void setBlockProp(CScriptFEMM femm, double dMeshSize)
        {
            CPoint blockPoint = null;

            blockPoint = this.Face.getBlockPoint();

            if (blockPoint == null)
            {
                CNotice.printLogID("NBPF");
                return;
            }

            string strMaterialName = this.m_strMaterialName;

            double dMagnetAngle = 0;

            switch (emMagnetDirection)
            {
            case EMMagnetDirection.RIGHT:
                dMagnetAngle = 0;
                break;

            case EMMagnetDirection.UP:
                dMagnetAngle = 90;
                break;

            case EMMagnetDirection.LEFT:
                dMagnetAngle = 180;
                break;

            case EMMagnetDirection.DOWN:
                dMagnetAngle = 270;
                break;

            default:
                break;
            }

            femm.setBlockProp(blockPoint, strMaterialName, dMeshSize, "none", dMagnetAngle, MovingPart, 0);
        }
示例#12
0
        public bool initialShapeDesignValue()
        {
            if (Face == null)
            {
                CNotice.printLogID("YATT3");
                return(false);
            }

            double minX = 0;
            double maxX = 0;
            double minY = 0;
            double maxY = 0;

            Face.getMinMaxX(ref minX, ref maxX);
            Face.getMinMaxY(ref minY, ref maxY);

            Height        = maxY - minY;
            InnerDiameter = minX * 2.0f;
            OuterDiameter = maxX * 2.0f;

            return(true);
        }
示例#13
0
        public bool loadSettingFromFile()
        {
            string strAppDataPath     = Environment.GetEnvironmentVariable("APPDATA");
            string strSettingFilePath = Path.Combine(strAppDataPath, "DoSA-2D");

            string strSettingFileFullName = Path.Combine(strSettingFilePath, "setting.ini");


            // CSettingData.ProgramDirectory 가 초기화 되어 있어야 한다.
            if (m_manageFile.isExistFile(strSettingFileFullName) == false)
            {
                CNotice.noticeWarningID("TCFD");
                return(false);
            }

            try
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(CSettingDataClone));
                StreamReader  reader        = new StreamReader(strSettingFileFullName);

                CSettingDataClone settingDataClone = new CSettingDataClone();
                settingDataClone = (CSettingDataClone)xmlSerializer.Deserialize(reader);

                settingDataClone.copyCloneToSettingData();

                reader.Close();

                // 혹시 데이터의 오류는 발생하더라도 하나만 오류가 발생한다.
                // 따라서 다른 항목까지 다시 설정하지 않도록 오류가 있는 데이터라도 파일에서 읽어드림과 동시에 창에 입력해 둔다.
                uploadSettingData();
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                CNotice.printLogID("AEOW");
            }

            return(true);
        }
示例#14
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.STEEL)
            {
                CNotice.printLogID("YATT6");
                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("TIAP5");
                        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;

                    // CSteel
                    case "Material":
                        if (CMaterialListInFEMM.isSteelInList(arrayString[1]) == true)
                        {
                            m_strMaterialName = arrayString[1];
                        }
                        else
                        {
                            // 현재의 버전에서 사용할 수 없는 재질이 존재한다면 공백으로 처리하고
                            // 동작 중에 공백을 사용해서 재질이 초기화 되지 않음을 확인한다.
                            m_strMaterialName = "";
                        }
                        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);
        }
示例#15
0
        // Base Point 와 상대좌표로 좌표값이 저장되는 Face 가 생성된다.
        public CFace makeFaceInPopup()
        {
            try
            {
                CFace face = new CFace();

                face.BasePoint.X = Double.Parse(textBoxBaseX.Text);
                face.BasePoint.Y = Double.Parse(textBoxBaseY.Text);

                if (FaceType == EMFaceType.RECTANGLE)
                {
                    if (ListPointUI.Count != 2)
                    {
                        CNotice.printLogID("TATP1");
                        return(null);
                    }

                    double x1, y1, x2, y2;

                    x1 = Double.Parse(ListPointUI[0].StrCoordX);
                    y1 = Double.Parse(ListPointUI[0].StrCoordZ);
                    x2 = Double.Parse(ListPointUI[1].StrCoordX);
                    y2 = Double.Parse(ListPointUI[1].StrCoordZ);

                    face.setRectanglePoints(x1, y1, x2, y2);
                }
                else
                {
                    if (ListPointUI.Count < 4)
                    {
                        CNotice.printLogID("TANM");
                        return(null);
                    }

                    // PartType 가 코일이고 Polygon 형상을 가지고 있는 경우라면 (DXF로 읽어드리고 코일로 지정하는 경우)
                    // Rectangle 로 바꾸어 저장한다.
                    // 만약, Retangle 조건이 아니라면 지나쳐서 Polygon 으로 저장한다.
                    if (PartType == EMKind.COIL)
                    {
                        CFace retFace = makeRectangleFaceInPopup();

                        if (retFace != null)
                        {
                            return(retFace);
                        }
                    }

                    List <CPoint> listPoint = new List <CPoint>();

                    foreach (CPointUI pointControl in ListPointUI)
                    {
                        // 매번 신규로 생성을 해야 한다.
                        CPoint point = new CPoint();

                        point.X = Double.Parse(pointControl.StrCoordX);
                        point.Y = Double.Parse(pointControl.StrCoordZ);

                        if (pointControl.IsArc == true)
                        {
                            point.LineKind = EMLineKind.ARC;
                        }
                        else
                        {
                            point.LineKind = EMLineKind.STRAIGHT;
                        }

                        if (pointControl.IsArcDirection == true)
                        {
                            point.DirectionArc = EMDirectionArc.BACKWARD;
                        }
                        else
                        {
                            point.DirectionArc = EMDirectionArc.FORWARD;
                        }

                        listPoint.Add(point);
                    }

                    face.setPolygonPoints(listPoint);
                }

                return(face);
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                return(null);
            }
        }
示例#16
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.NON_KIND)
            {
                CNotice.printLog("NON_KIND 가 아닌 객체가 CNonKind 로 열리려고 한다.");
                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('=');

                    /// 각 줄의 String 배열은 항상 2개이여야 한다.
                    if (arrayString.Length != 2)
                    {
                        CNotice.printLog("Non-Kind 데이터에 문제가 있습니다.");
                        return(false);
                    }

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

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

                    // Non Kind 는 CNode 의 정보와 CShapParts 의 Face 정보만 필요하기 때문에
                    // 나머지 정보는 저장하지 않는다.
                    //
                    // CShapeParts
                    //case "MovingParts":
                    //    MovingPart = (EMMoving)Enum.Parse(typeof(EMMoving), arrayString[1]);
                    //    break;

                    default:
                        break;
                    }
                }

                // Shape 정보가 있는 경우만 m_face 를 생성하고 읽기 작업을 진행한다.
                if (listShapeLines.Count > 0)
                {
                    m_face = new CFace();

                    if (m_face == null)
                    {
                        CNotice.printLogID("IIAT");
                    }
                    else
                    {
                        m_face.readObject(listShapeLines);
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                return(false);
            }

            return(true);
        }
示例#17
0
        private bool isInputDataOK()
        {
            /// 1. 입력값 확인
            ///
            if (textBoxPartName.Text.Length == 0)
            {
                CNotice.noticeWarningID("PEAP");
                return(false);
            }

            for (int i = 0; i < ListPointUI.Count; i++)
            {
                if (ListPointUI[i].StrCoordX.Trim().Length == 0)
                {
                    CNotice.noticeWarningID("PETC");
                    return(false);
                }

                if (ListPointUI[i].StrCoordZ.Trim().Length == 0)
                {
                    CNotice.noticeWarningID("PETC");
                    return(false);
                }
            }

            string strX1, strY1, strX2, strY2;

            /// 동일한 좌표값이 점이 중복으로 있는 경우
            for (int i = 0; i < ListPointUI.Count - 1; i++)
            {
                for (int j = i + 1; j < ListPointUI.Count; j++)
                {
                    strX1 = ListPointUI[i].StrCoordX.Trim();
                    strY1 = ListPointUI[i].StrCoordZ.Trim();
                    strX2 = ListPointUI[j].StrCoordX.Trim();
                    strY2 = ListPointUI[j].StrCoordZ.Trim();

                    if (strX1 == strX2 && strY1 == strY2)
                    {
                        CNotice.noticeWarningID("TATP");
                        return(false);
                    }
                }
            }

            /// 파트 초기 생성때는 m_strPartName = string.Empty 로 PopupShape 객체를 생성하고,
            /// 파트 수정 때는 m_strPartName 에 이름을 넣어서  PopupShape 객체를 생성하기 때문에 파트의 수정인지를 m_strPartName 로 파악한다.
            if (m_strPartName.Length == 0)
            {
                /// [문제]
                ///  - Form 에서는 Parent를 사용할 수 없어 Owner 속성을 사용하지만
                ///    종종 Owner 가 null 로 넘어오는 문제가 발생한다.
                /// [해결]
                ///  - PopupShape 창을 생성하기 전에 Owner 속성을 FormMain 으로 초기화 해 두어야
                ///    확실하게 FormMain 을 얻을 수 있다.
                FormMain formMain = ((FormMain)this.Owner);

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

                if (true == formMain.m_design.isExistNode(textBoxPartName.Text))
                {
                    CNotice.noticeWarningID("TPAE");
                    return(false);
                }
            }

            return(true);
        }
示例#18
0
        public void designCoil()
        {
            if (InnerDiameter <= 0.0f)
            {
                CNotice.noticeWarningID("TIDV");
                return;
            }

            if (OuterDiameter <= 0.0f)
            {
                CNotice.noticeWarningID("TODV");
                return;
            }

            if (OuterDiameter <= InnerDiameter)
            {
                CNotice.noticeWarningID("ODSB");
                return;
            }

            if (Height <= 0.0f)
            {
                CNotice.noticeWarningID("CHVI");
                return;
            }

            if (CopperDiameter <= 0.0f)
            {
                CNotice.noticeWarningID("ETCD");
                return;
            }

            if (HorizontalCoefficient <= 0.0f)
            {
                CNotice.noticeWarningID("ETVF");
                return;
            }

            if (VerticalCoefficient <= 0.0f)
            {
                CNotice.noticeWarningID("ETVF2");
                return;
            }

            if (ResistanceCoefficient <= 0.0f)
            {
                CNotice.noticeWarningID("ETVF1");
                return;
            }

            try
            {
                //*****************************************************************************
                // 수식계산에서 발생하는 예외처리를 하라.
                //*****************************************************************************
                double dCoilAvgDiameter = (InnerDiameter + OuterDiameter) / 2.0f;
                double dWidth           = Math.Abs(OuterDiameter - InnerDiameter) / 2.0f;

                // 동선경을 선택해서 WireDiameter 가 설정이 되지 않는 경우 여기서 자동 계산한다.
                if (WireDiameter == 0.0f)
                {
                    WireDiameter = calculateWireDiameter();
                }

                int iHorizontal_N = (int)((1 / HorizontalCoefficient) * (dWidth / WireDiameter));
                int iVirtical_N   = (int)((1 / VerticalCoefficient) * (Height / WireDiameter));

                // 수평 적층 수가 짝수가 아니면 한층을 뺀다. (짝수 정렬만 가능하다)
                if (iHorizontal_N % 2 != 0)
                {
                    iHorizontal_N -= 1;
                }

                this.Turns           = iHorizontal_N * iVirtical_N;
                this.TurnsOfOneLayer = iVirtical_N;
                this.Layers          = iHorizontal_N;

                double dWireLength_Meter = Math.PI * this.Turns * dCoilAvgDiameter / 1000.0;

                // IEC 317, 단위 저항 보간
                double res_a = 0.0, res_b = 0.0, res_c = 0.0;

                // 온도 계수
                double dTemperatureCoefficient = 0.004041f;

                if (m_strMaterialName == "Copper")
                {
                    // IEC 317, 단위 저항 보간
                    res_a = 0.021771473f;
                    res_b = 0.99730833f;
                    res_c = -1.9999322f;

                    // 온도 계수
                    dTemperatureCoefficient = 0.00393f;
                }
                // 두가지 밖에 없어서 알루미늄의 경우이다.
                else if (m_strMaterialName == "Aluminum")
                {
                    // IEC 317, 단위 저항 보간
                    res_a = 0.036438f;
                    res_b = 0.981116f;
                    res_c = -1.995774f;

                    // 온도 계수
                    dTemperatureCoefficient = 0.004308f;
                }
                else
                {
                    CNotice.printLogID("TIAP1");
                    return;
                }


                double dResistancePerMeter = res_a * (Math.Pow(res_b, CopperDiameter) * Math.Pow(CopperDiameter, res_c));

                Resistance_20 = dResistancePerMeter * dWireLength_Meter * ResistanceCoefficient;

                Resistance = Resistance_20 * (1 + dTemperatureCoefficient * (Temperature - 20.0f));
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
            }
        }
示例#19
0
        /// <summary>
        /// Face 의 형상 정보가 있는 경우 호출되는 생성자로
        /// TreeView 에서 파트를 더블클릭할때 호출되는 생성자이다.
        /// </summary>
        public PopupShape(string partName, CFace face, EMKind emKind)
        {
            InitializeComponent();

            m_strPartName = partName;
            m_partType    = emKind;

            m_bCreatePopupWindow = false;

            try
            {
                switch (m_partType)
                {
                case EMKind.COIL:
                    labelPartName.Text = "Coil Name :";
                    this.Text          = "Change Coil";
                    break;

                case EMKind.MAGNET:
                    labelPartName.Text = "Magnet Name :";
                    this.Text          = "Change Magnet";
                    break;

                case EMKind.STEEL:
                    labelPartName.Text = "Steel Name :";
                    this.Text          = "Change Steel";
                    break;

                case EMKind.NON_KIND:
                    labelPartName.Text = "Part Name";
                    this.Text          = "Change Part";
                    break;

                default:
                    CNotice.printLogID("TPTI");
                    return;
                }

                if (face == null)
                {
                    CNotice.printLogID("CTPS1");
                    return;
                }

                textBoxBaseX.Text = face.BasePoint.X.ToString();
                textBoxBaseY.Text = face.BasePoint.Y.ToString();

                if (face.getPointCount() < MIN_POLYGON_CONTROL_COUNT)
                {
                    CNotice.printLogID("CTPS");
                    return;
                }

                /// 파트이름을 표시만하고 수정을 하지 못하게 한다.
                textBoxPartName.Text = partName;

                if (face.FaceType == EMFaceType.RECTANGLE)
                {
                    // 설정과 동시에 이벤트가 호출되고
                    // 이벤트함수에서 FaceType 가 지정되면서 Popup 창의 형태와 UserControl 이 초기화 된다.
                    comboBoxFaceType.SelectedItem = EMFaceType.RECTANGLE.ToString();

                    this.ListPointUI[0].StrCoordX = face.RelativePointList[0].X.ToString();
                    this.ListPointUI[0].StrCoordZ = face.RelativePointList[0].Y.ToString();

                    this.ListPointUI[1].StrCoordX = face.RelativePointList[2].X.ToString();
                    this.ListPointUI[1].StrCoordZ = face.RelativePointList[2].Y.ToString();
                }
                else if (face.FaceType == EMFaceType.POLYGON)
                {
                    // 설정과 동시에 이벤트가 호출되고
                    // 이벤트함수에서 FaceType 가 지정되면서 Popup 창의 형태와 UserControl 이 초기화 된다.
                    comboBoxFaceType.SelectedItem = EMFaceType.POLYGON.ToString();

                    for (int i = 0; i < face.getPointCount(); i++)
                    {
                        // 기본 생성 Control 수 보다 작을 때는 있는 Control 에 데이터를 담고
                        // 클 때는 Control 를 생성하면서 데이터를 담은다.
                        if (i >= MIN_POLYGON_CONTROL_COUNT)
                        {
                            this.addPointControl(new CPointUI(), true, this.panelPointControl);
                        }

                        this.ListPointUI[i].StrCoordX = face.RelativePointList[i].X.ToString();
                        this.ListPointUI[i].StrCoordZ = face.RelativePointList[i].Y.ToString();

                        if (face.RelativePointList[i].LineKind == EMLineKind.ARC)
                        {
                            this.ListPointUI[i].IsArc = true;
                        }
                        else
                        {
                            this.ListPointUI[i].IsArc = false;
                        }

                        if (face.RelativePointList[i].DirectionArc == EMDirectionArc.BACKWARD)
                        {
                            this.ListPointUI[i].IsArcDirection = true;
                        }
                        else
                        {
                            this.ListPointUI[i].IsArcDirection = false;
                        }
                    }
                }
                else
                {
                    CNotice.printLogID("UAWF");
                    return;
                }

                /// 수정을 할때는 형상 과 Node Type 변경을 못하도록 한다.
                comboBoxFaceType.Enabled = false;

                comboBoxNodeType.SelectedItem = m_partType.ToString();

                if (m_partType != EMKind.NON_KIND)
                {
                    comboBoxNodeType.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
            }
        }
示例#20
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.COIL)
            {
                CNotice.printLogID("YATT7");
                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('=');


                    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;

                    // CCoil
                    case "Material":
                        if (CMaterialListInFEMM.isCoilWIreInList(arrayString[1]) == true)
                        {
                            m_strMaterialName = arrayString[1];
                        }
                        else
                        {
                            // 현재의 버전에서 사용할 수 없는 재질이 존재한다면 공백으로 처리하고
                            // 동작 중에 공백을 사용해서 재질이 초기화 되지 않음을 확인한다.
                            m_strMaterialName = "";
                        }
                        break;

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

                    case "Turns":
                        Turns = Convert.ToInt16(arrayString[1]);
                        break;

                    case "Resistance":
                        Resistance = Convert.ToDouble(arrayString[1]);
                        break;

                    case "Resistance_20":
                        Resistance_20 = Convert.ToDouble(arrayString[1]);
                        break;

                    case "Layers":
                        Layers = Convert.ToInt16(arrayString[1]);
                        break;

                    case "TurnsOfOneLayer":
                        TurnsOfOneLayer = Convert.ToInt16(arrayString[1]);
                        break;

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

                    case "InnerDiameter":
                        InnerDiameter = Convert.ToDouble(arrayString[1]);
                        break;

                    case "OuterDiameter":
                        OuterDiameter = Convert.ToDouble(arrayString[1]);
                        break;

                    case "Height":
                        Height = Convert.ToDouble(arrayString[1]);
                        break;

                    case "CopperDiameter":
                        CopperDiameter = Convert.ToDouble(arrayString[1]);
                        break;

                    case "WireDiameter":
                        WireDiameter = Convert.ToDouble(arrayString[1]);
                        break;

                    case "Temperature":
                        Temperature = Convert.ToDouble(arrayString[1]);
                        break;

                    case "HorizontalCoefficient":
                        HorizontalCoefficient = Convert.ToDouble(arrayString[1]);
                        break;

                    case "VerticalCoefficient":
                        VerticalCoefficient = Convert.ToDouble(arrayString[1]);
                        break;

                    case "ResistanceCoefficient":
                        ResistanceCoefficient = Convert.ToDouble(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);
        }
示例#21
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);
        }
示例#22
0
        private bool isInputDataOK()
        {
            try
            {
                // 빈칸 확인으로 null 비교를 사용하지 말라. (.Length == 0 나 "" 를 사용하라)
                if (textBoxName.Text.Length == 0)
                {
                    CNotice.noticeWarningID("PEAN");
                    return(false);
                }

                /// Design 생성이다.
                if (m_strNewKind == "Design")
                {
                    // 디자인을 무조건 프로그램 작업디렉토리에 생성하는 것으로 한다.
                    // 따라서 디자인을 생성할 때의 적용버튼 임으로 작업 디렉토리는 프로그램 작업 디렉토리를 사용하고 있다.
                    List <string> listDirectories = m_manageFile.getDirectoryList(CSettingData.m_strCurrentWorkingDirPath);

                    // 소문자로 비교하기 위해서 임시로 사용한다.
                    string strOldTempName, strNewTempName;

                    foreach (string directoryName in listDirectories)
                    {
                        // 디렉토리 경로에 GetFileName 을 사용하면 가장 마지막 디렉토리가 넘어온다.
                        strOldTempName = Path.GetFileName(directoryName).ToLower();
                        strNewTempName = m_strName.ToLower();

                        if (strOldTempName == strNewTempName)
                        {
                            // 신규 디자인 이름이 기존 디자인과 겹칠때 기존 디자인을 삭제하는 것은 위험성이 따른다.
                            // 그래서 아래의 동작을 중지한다.
                            //
                            // 기존 디자인이 이미 존재할 때 삭제하고 새롭게 시작할지를 물어 온다
                            //DialogResult ret = CNotice.noticeWarningOKCancelID("TSDA", "W");

                            //if (ret == DialogResult.OK)
                            //{
                            //    m_manageFile.deleteDirectory(directoryName);
                            //    return true;
                            //}
                            //else
                            //    return false;

                            if (CSettingData.m_emLanguage == EMLanguage.Korean)
                            {
                                CNotice.noticeWarning("동일한 이름의 Design 이 이미 존재 합니다.\n다른 디자인명을 사용해 주세요.");
                            }
                            else
                            {
                                CNotice.noticeWarning("A design with the same name already exists.\nPlease use a different design name.");
                            }

                            return(false);
                        }
                    }
                }
                /// Test 들의 생성이다.
                else
                {
                    /// 호출할 때 Owner 를 FormMain 으로 초기화 해야 확실하게 얻을 수 있다.
                    FormMain formMain = ((FormMain)this.Owner);

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

                    if (true == formMain.m_design.isExistNode(textBoxName.Text))
                    {
                        CNotice.noticeWarningID("IIAE");
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                return(false);
            }

            return(true);
        }
示例#23
0
        public bool attachDefault(string strTestFullName, CPoint pointBoundaryBlock)
        {
            CReadFile   readFile   = new CReadFile();
            CManageFile manageFile = new CManageFile();

            List <string> listString = new List <string>();
            string        strLine    = string.Empty;

            char[]   separators = { ' ', '\t' };
            string[] strArray;

            string strFileName         = Path.GetFileNameWithoutExtension(strTestFullName);
            string strTempFileFullName = Path.Combine(Path.GetDirectoryName(strTestFullName), strFileName + "_temp.fem");

            if (manageFile.isExistFile(strTestFullName) == false)
            {
                CNotice.printLogID("NFFF");
                return(false);
            }
            else
            {
                File.Move(strTestFullName, strTempFileFullName);
            }

            StreamWriter writeFile    = new StreamWriter(strTestFullName);
            int          iNumBlock    = 0;
            int          nCountBlock  = 0;
            bool         bBlockLabels = false;

            try
            {
                readFile.getAllLines(strTempFileFullName, ref listString);

                for (int i = 0; i < listString.Count; i++)
                {
                    strLine = listString[i];

                    strArray = strLine.Split(separators, StringSplitOptions.None);

                    if (strArray[0] == "[NumBlockLabels]")
                    {
                        iNumBlock    = Int32.Parse(strArray[2]);
                        nCountBlock  = 0;
                        bBlockLabels = true;

                        writeFile.WriteLine(strLine);

                        /// 구분 Label 행은 건너 뛴다.
                        continue;
                    }

                    if (bBlockLabels == true)
                    {
                        if (pointBoundaryBlock.X == Double.Parse(strArray[0]) && pointBoundaryBlock.Y == Double.Parse(strArray[1]))
                        {
                            if (strArray.Length != 9)
                            {
                                CNotice.printLogID("TWAP2");
                                return(false);
                            }

                            /// dettach block setting
                            strArray[8] = "2";
                            strLine     = string.Empty;

                            foreach (string str in strArray)
                            {
                                strLine += str + '\t';
                            }
                        }

                        nCountBlock++;

                        if (nCountBlock >= iNumBlock)
                        {
                            bBlockLabels = false;
                        }
                    }

                    writeFile.WriteLine(strLine);
                }

                File.Delete(strTempFileFullName);
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                writeFile.Close();
                return(false);
            }

            writeFile.Close();
            return(true);
        }
示例#24
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);
            }
        }
示例#25
0
        /// <summary>
        /// 형상 입력때나 수정때 형상을 다시 그린다
        ///  - 수정 부품만 빼고 타 부품들은 다시 그리고, 수정 부품은 창에 기록된 값을 그린다.
        /// </summary>
        /// <param name="pointControl">좌표점 PointControl</param>
        /// <param name="bRedraw">형상 수정이 없어도 강제로 ARC 변경때 강제로 수정함</param>
        internal void drawTemporaryFace(CPointUI pointControl, bool bRedraw = false)
        {
            try
            {
                /// [문제]
                ///  - Form 에서는 Parent를 사용할 수 없어 Owner 속성을 사용하지만
                ///    종종 Owner 가 null 로 넘어오는 문제가 발생한다.
                /// [해결]
                ///  - PopupShape 창을 생성하기 전에 Owner 속성을 FormMain 으로 초기화 해 두어야
                ///    확실하게 FormMain 을 얻을 수 있다.
                FormMain formMain = ((FormMain)this.Owner);

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

                CScriptFEMM femm = formMain.m_femm;

                CDataNode nodeParts = formMain.m_design.getNode(m_strPartName);

                /// 0. 해당 좌표점의 수정이 있었는지를 판단한다.
                ///  - 수정이 있는 경우만 다시 그리기 위해서이다.
                bool retCheck = false;

                /// 초기 생성때는 이전 nodeParts 가 없음으로 사용하지 않고, 기존 노드의 수정때만 사용한다.
                if (nodeParts != null)
                {
                    /// 좌표 Control 에 빈칸이 존재하는 지를 확인함
                    for (int i = 0; i < ListPointUI.Count; i++)
                    {
                        /// 해당 좌표점만 비교한다.
                        /// 만약, Parts 의 모든 좌표점을 비교하면 다른 좌표점이 수정되었을때 나머지 좌표점의 수정이 없어도 다시 그리기가 된다.
                        if (ListPointUI[i] == pointControl)
                        {
                            if (((CShapeParts)nodeParts).Face.RelativePointList[i].X != Double.Parse(ListPointUI[i].StrCoordX.Trim()))
                            {
                                retCheck = true;
                            }

                            if (((CShapeParts)nodeParts).Face.RelativePointList[i].Y != Double.Parse(ListPointUI[i].StrCoordZ.Trim()))
                            {
                                retCheck = true;
                            }
                        }
                    }
                }

                // Arc 관련 이벤트 호출이면 강제로 다시그리기를 한다.
                if (bRedraw == true)
                {
                    retCheck = true;
                }

                if (retCheck == true)
                {
                    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);
                            }
                        }
                    }
                }

                /// 2. 현재 수정중이거나 생성중인 Face 의 형상 그리기
                retCheck = true;

                /// 좌표 Control 에 빈칸이 존재하는 지를 확인함
                for (int i = 0; i < ListPointUI.Count; i++)
                {
                    if (ListPointUI[i].StrCoordX.Trim().Length == 0)
                    {
                        retCheck = false;
                    }

                    if (ListPointUI[i].StrCoordZ.Trim().Length == 0)
                    {
                        retCheck = false;
                    }
                }

                double dBase_X, dBase_Y;
                dBase_X = dBase_Y = 0;

                dBase_X = Double.Parse(textBoxBaseX.Text.Trim());
                dBase_Y = Double.Parse(textBoxBaseY.Text.Trim());

                // 모든 데이터가 입력된 경우는 폐곡선의 정상적인 Face 를 그린다.
                if (retCheck == true)
                {
                    CFace faceTemp = makeFaceInPopup();

                    if (null != faceTemp)
                    {
                        faceTemp.drawFace(femm);
                    }
                    else
                    {
                        CNotice.printLogID("TSWN");
                    }
                }
                // 모든 데이터가 아직 입력되지 않은 상태는 입력중인 데이터만으로 그림을 그린다.
                else
                {
                    double dP1_X, dP1_Y, dP2_X, dP2_Y;

                    bool bArc, bArcDirection;

                    dP1_X = dP1_Y = dP2_X = dP2_Y = 0;
                    bArc  = bArcDirection = false;

                    for (int i = 0; i < ListPointUI.Count; i++)
                    {
                        retCheck = true;

                        if (ListPointUI[i].StrCoordX.Trim().Length == 0)
                        {
                            retCheck = false;
                        }
                        else
                        {
                            dP1_X = Double.Parse(ListPointUI[i].StrCoordX.Trim()) + dBase_X;
                        }

                        if (ListPointUI[i].StrCoordZ.Trim().Length == 0)
                        {
                            retCheck = false;
                        }
                        else
                        {
                            dP1_Y = Double.Parse(ListPointUI[i].StrCoordZ.Trim()) + dBase_Y;
                        }

                        /// X, Y 값이 모두 입력된 Point Control 인 경우
                        if (retCheck == true)
                        {
                            if (i == 0)
                            {
                                /// 사각형, 다각형 모두 적용된다.
                                femm.drawPoint(dP1_X, dP1_Y);
                            }
                            else
                            {
                                if (this.FaceType == EMFaceType.RECTANGLE)
                                {
                                    CNotice.printLogID("ATTW");
                                }
                                /// 다각형만 적용된다.
                                /// 만약 사각형의 경우 i = 1 까지 모두 채워지면 모두 입력된 상태로 if 문의 위에처 처리되기 때문이다.
                                bArc          = ListPointUI[i].IsArc;
                                bArcDirection = ListPointUI[i].IsArcDirection;

                                if (bArc == true)
                                {
                                    femm.drawArc(dP2_X, dP2_Y, dP1_X, dP1_Y, bArcDirection);
                                }
                                else
                                {
                                    femm.drawLine(dP2_X, dP2_Y, dP1_X, dP1_Y);
                                }
                            }

                            // 이번 점을 이전 점으로 저장한다.
                            dP2_X = dP1_X;
                            dP2_Y = dP1_Y;
                        }
                        /// 채워지지 않은 좌표값을 발견하면 바로 빠져 나간다
                        else
                        {
                            break;
                        }
                    }
                }

                /// 선택된 좌표점을 붉은 색으로 표시한다.
                ///
                /// Base X, Y 변경 할때나 Leave 이벤트는 제외해야 함으로 null 을 넘겨오도록 되어 있다.
                if (pointControl != null)
                {
                    /// XY 값 모두 들어 있는 경우에만 표시를 한다.
                    if (pointControl.StrCoordX != "" && pointControl.StrCoordZ != "")
                    {
                        CPoint selectedPoint = new CPoint();

                        selectedPoint.X = Double.Parse(pointControl.StrCoordX) + dBase_X;
                        selectedPoint.Y = Double.Parse(pointControl.StrCoordZ) + dBase_Y;

                        femm.clearSelected();

                        femm.selectPoint(selectedPoint);
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
            }
        }
示例#26
0
        public static bool isSettingDataOK(bool bOpenNoticeDialog = true)
        {
            bool bCheck = false;

            bCheck = m_manageFile.isExistFile(m_strFemmExeFileFullName);
            if (bCheck == false)
            {
                if (bOpenNoticeDialog == true)
                {
                    CNotice.noticeWarningID("TEFD");
                }
                else
                {
                    CNotice.printLogID("TEFD");
                }

                return(false);
            }

            bCheck = m_manageFile.isExistDirectory(m_strBaseWorkingDirPath);

            if (bCheck == false)
            {
                if (bOpenNoticeDialog == true)
                {
                    CNotice.noticeWarningID("TDWD");
                }
                else
                {
                    CNotice.printLogID("TDWD");
                }

                return(false);
            }

            bCheck = m_manageFile.isExistDirectory(m_strProgramDirPath);

            if (bCheck == false)
            {
                if (bOpenNoticeDialog == true)
                {
                    CNotice.noticeWarningID("TIAP2");
                }
                else
                {
                    CNotice.printLogID("TIAP2");
                }

                return(false);
            }

            if (m_dMeshLevelPercent <= 0.05f)
            {
                if (bOpenNoticeDialog == true)
                {
                    CNotice.noticeWarningID("TMSL");
                }
                else
                {
                    CNotice.printLogID("TMSL");
                }

                return(false);
            }

            return(true);
        }