public void setBlockProp(CPoint point, string strMaterial, double dMeshsize, string strCircuit, double dMagnetAngle, EMMoving emMoving, int nTurns) { string strCommand; try { /// mode 변경 없이도 동작은 한다. strCommand = "mi_seteditmode(\"blocks\")"; sendCommand(strCommand); strCommand = "mi_addblocklabel(" + point.m_dX + "," + point.m_dY + ")"; sendCommand(strCommand); strCommand = "mi_selectlabel(" + point.m_dX + "," + point.m_dY + ")"; sendCommand(strCommand); int nGroup; if (emMoving == EMMoving.MOVING) { nGroup = MOVING_GROUP_NUM; } else { nGroup = 0; } strMaterial = "\"" + strMaterial + "\""; strCircuit = "\"" + strCircuit + "\""; strCommand = "mi_setblockprop(" + strMaterial + ",0," + dMeshsize.ToString() + "," + strCircuit + "," + dMagnetAngle.ToString() + "," + nGroup.ToString() + "," + nTurns.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_clearselected()"; sendCommand(strCommand); // editmode 를 group 으로 바꾸어서 FEMM 마우스 동작을 막는다. lockEdit(); } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
/// <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); }
public void drawLine(double x1, double y1, double x2, double y2, EMMoving emMoving = EMMoving.FIXED) { string strCommand; float fX1, fY1, fX2, fY2; fX1 = (float)x1; fY1 = (float)y1; fX2 = (float)x2; fY2 = (float)y2; try { /// Line 을 추가한다 strCommand = "mi_addnode(" + fX1.ToString() + "," + fY1.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_addnode(" + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_addsegment(" + fX1.ToString() + "," + fY1.ToString() + "," + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); /// 그룹을 지정하는 경우만 변경을 한다. if (emMoving == EMMoving.MOVING) { /// 그룹 설정 /// - Point 의 선택이 좌표계산 없이 바로 가능함 /// - 또한 Point 만 그룹을 지정해도 이동이 가능하기 때문에 Point 만 설정함 strCommand = "mi_selectnode(" + fX1.ToString() + "," + fY1.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_selectnode(" + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_setgroup(" + MOVING_GROUP_NUM.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_clearselected()"; sendCommand(strCommand); } } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
public void drawLine(CLine line, EMMoving emMoving = EMMoving.FIXED) { string strCommand; float fX1, fY1, fX2, fY2; fX1 = (float)line.m_startPoint.X; fY1 = (float)line.m_startPoint.Y; fX2 = (float)line.m_endPoint.X; fY2 = (float)line.m_endPoint.Y; try { strCommand = "mi_addnode(" + fX1.ToString() + "," + fY1.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_addnode(" + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_addsegment(" + fX1.ToString() + "," + fY1.ToString() + "," + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); /// 그룹을 지정하는 경우만 변경을 한다. if (emMoving == EMMoving.MOVING) { /// 그룹 설정 /// - Point 의 선택이 좌표계산 없이 바로 가능함 /// - 또한 Point 만 그룹을 지정해도 이동이 가능하기 때문에 Point 만 설정함 strCommand = "mi_selectnode(" + fX1.ToString() + "," + fY1.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_selectnode(" + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_setgroup(" + MOVING_GROUP_NUM.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_clearselected()"; sendCommand(strCommand); } } catch (Exception ex) { CNotice.printLog(ex.Message); return; } }
public void drawArc(double x1, double y1, double x2, double y2, bool bDirectionArcBackword, EMMoving emMoving = EMMoving.FIXED) { string strCommand; float fX1, fY1, fX2, fY2; fX1 = (float)x1; fY1 = (float)y1; fX2 = (float)x2; fY2 = (float)y2; try { strCommand = "mi_addnode(" + fX1.ToString() + "," + fY1.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_addnode(" + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); if (bDirectionArcBackword == true) { strCommand = "mi_addarc(" + fX2.ToString() + "," + fY2.ToString() + "," + fX1.ToString() + "," + fY1.ToString() + "," + "90, 1)"; sendCommand(strCommand); } else { strCommand = "mi_addarc(" + fX1.ToString() + "," + fY1.ToString() + "," + fX2.ToString() + "," + fY2.ToString() + "," + "90, 1)"; sendCommand(strCommand); } /// 그룹을 지정하는 경우만 변경을 한다. if (emMoving == EMMoving.MOVING) { /// 그룹 설정 /// - Point 의 선택이 좌표계산 없이 바로 가능함 /// - 또한 Point 만 그룹을 지정해도 이동이 가능하기 때문에 Point 만 설정함 strCommand = "mi_selectnode(" + fX1.ToString() + "," + fY1.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_selectnode(" + fX2.ToString() + "," + fY2.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_setgroup(" + MOVING_GROUP_NUM.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_clearselected()"; sendCommand(strCommand); } } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
protected CParts() { // 초기값은 고정된 것으로 가정함 this.MovingPart = EMMoving.FIXED; }
public CShapeParts() { // 초기값은 고정된 것으로 가정함 this.MovingPart = EMMoving.FIXED; }