public bool isDesignShapeOK(double dStroke = 0) { CFace face = null; bool bError = false; CShapeParts nodeParts = null; // Moving Part 를 Stroke 만큼 이동시킨다. foreach (CDataNode node in GetNodeList) { if (node.GetType().BaseType.Name == "CShapeParts") { nodeParts = (CShapeParts)node; if (nodeParts.MovingPart == EMMoving.MOVING) { face = nodeParts.Face; face.BasePoint.Y = face.BasePoint.Y + dStroke; } } } if (isIntersectedAllLines() == true) { CNotice.noticeWarningID("LCBP"); bError = true; } if (isContactedMovingParts() == true) { CNotice.noticeWarningID("IHOT"); bError = true; } // Moving Part 를 Stroke 만큼 복원 시킨다. foreach (CDataNode node in GetNodeList) { if (node.GetType().BaseType.Name == "CShapeParts") { nodeParts = (CShapeParts)node; if (nodeParts.MovingPart == EMMoving.MOVING) { face = nodeParts.Face; face.BasePoint.Y = face.BasePoint.Y - dStroke; } } } if (bError == true) return false; else return true; }
private bool isContactedMovingParts() { List<CLine> listMovingPartLines = new List<CLine>(); List<CLine> listFixedPartLines = new List<CLine>(); List<CLine> listAbsoluteLine = null; CFace face = null; foreach (CDataNode node in m_listDataNode) { if (node.GetType().BaseType.Name == "CShapeParts") { CShapeParts nodeParts = (CShapeParts)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; }
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(); }
private bool isIntersectedAllLines() { List<CLine> listLineAll = new List<CLine>(); List<CLine> listAbsoluteLine = null; CFace face = null; foreach (CDataNode node in m_listDataNode) { if (node.GetType().BaseType.Name == "CShapeParts") { CShapeParts nodeParts = (CShapeParts)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; }