Exemple #1
0
        public void drawDesign(CScriptFEMM femm)
        {
            CFace face = null;

            foreach (CNode node in NodeList)
            {
                if (node.GetType().BaseType.Name == "CParts")
                {
                    CParts nodeParts = (CParts)node;

                    face = nodeParts.Face;

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

            femm.zoomFit();
        }
Exemple #2
0
        public bool isDesignShapeOK(double dStroke = 0)
        {
            CFace  face      = null;
            bool   bError    = false;
            CParts nodeParts = null;

            // Moving Part 를 Stroke 만큼 이동시킨다.
            foreach (CNode node in NodeList)
            {
                if (node.GetType().BaseType.Name == "CParts")
                {
                    nodeParts = (CParts)node;

                    if (nodeParts.MovingPart == EMMoving.MOVING)
                    {
                        face = nodeParts.Face;
                        face.BasePoint.m_dY = face.BasePoint.m_dY + dStroke;
                    }
                }
            }

            if (isIntersectedAllLines() == true)
            {
                CNotice.noticeWarningID("LCBP");
                bError = true;
            }

            if (isContactedMovingParts() == true)
            {
                CNotice.noticeWarningID("IHOT");
                bError = true;
            }

            // Moving Part 를 Stroke 만큼 복원 시킨다.
            foreach (CNode node in NodeList)
            {
                if (node.GetType().BaseType.Name == "CParts")
                {
                    nodeParts = (CParts)node;

                    if (nodeParts.MovingPart == EMMoving.MOVING)
                    {
                        face = nodeParts.Face;
                        face.BasePoint.m_dY = face.BasePoint.m_dY - dStroke;
                    }
                }
            }

            if (bError == true)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #3
0
        private bool isContactedMovingParts()
        {
            List <CLine> listMovingPartLines = new List <CLine>();
            List <CLine> listFixedPartLines  = new List <CLine>();
            List <CLine> listAbsoluteLine    = null;
            CFace        face = null;

            foreach (CNode node in NodeList)
            {
                if (node.GetType().BaseType.Name == "CParts")
                {
                    CParts nodeParts = (CParts)node;

                    face = nodeParts.Face;

                    if (null != face)
                    {
                        listAbsoluteLine = face.AbsoluteLineList;

                        if (nodeParts.MovingPart == EMMoving.MOVING)
                        {
                            /// Moving Part 라인들을 하나의 Line List 에 담는다.
                            foreach (CLine line in listAbsoluteLine)
                            {
                                listMovingPartLines.Add(line);
                            }
                        }
                        else
                        {
                            /// Moving Part 라인들을 하나의 Line List 에 담는다.
                            foreach (CLine line in listAbsoluteLine)
                            {
                                listFixedPartLines.Add(line);
                            }
                        }
                    }
                }
            }

            CShapeTools shapeTools = new CShapeTools();

            for (int i = 0; i < listMovingPartLines.Count - 1; i++)
            {
                for (int j = i + 1; j < listFixedPartLines.Count; j++)
                {
                    if (true == shapeTools.isContacted(listMovingPartLines[i], listFixedPartLines[j]))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #4
0
        private bool isIntersectedAllLines()
        {
            List <CLine> listLineAll      = new List <CLine>();
            List <CLine> listAbsoluteLine = null;
            CFace        face             = null;

            foreach (CNode node in NodeList)
            {
                if (node.GetType().BaseType.Name == "CParts")
                {
                    CParts nodeParts = (CParts)node;

                    face = nodeParts.Face;

                    if (null != face)
                    {
                        listAbsoluteLine = face.AbsoluteLineList;

                        /// 모든 라인들을 하나의 Line List 에 담는다.
                        foreach (CLine line in listAbsoluteLine)
                        {
                            listLineAll.Add(line);
                        }
                    }
                }
            }

            CShapeTools shapeTools = new CShapeTools();

            for (int i = 0; i < listLineAll.Count - 1; i++)
            {
                for (int j = i + 1; j < listLineAll.Count; j++)
                {
                    if (true == shapeTools.isIntersected(listLineAll[i], listLineAll[j]))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #5
0
        public void getMaterial()
        {
            List <string> listMaterial = new List <string>();
            string        strMaterial  = "Air";
            CParts        nodeParts    = null;

            bool bCheck;

            //femm.getMaterial(strMaterial);
            listMaterial.Add(strMaterial);

            foreach (CNode node in NodeList)
            {
                bCheck = false;
                if (node.GetType().BaseType.Name == "CParts")
                {
                    nodeParts   = (CParts)node;
                    strMaterial = nodeParts.getMaterial();

                    /// 현 파트의 재료가 기존에 저장된 Material 과 겹치는지를 확인한다.
                    foreach (string strTemp in listMaterial)
                    {
                        if (strTemp == strMaterial)
                        {
                            bCheck = true;
                        }
                    }

                    // 겹치지 않는 재료만 추가한다.
                    if (bCheck == false)
                    {
                        listMaterial.Add(strMaterial);
                        //femm.getMaterial(nodeParts.getMaterial());
                    }
                }
            }
        }