public static bool loadProcessOfFEMM() { try { if (checkFEMMInMemory() != true) { m_FEMM = new ActiveFEMMClass(); if (m_FEMM == null) { return(false); } else { return(true); } } return(true); } catch (Exception ex) { CNotice.printLog(ex.Message); return(false); } }
public static void moveFEMM(int iPosX, int iPosY, int iSizeX = 500, int iSizeY = 900) { try { Process[] processList = Process.GetProcessesByName("femm"); if (processList.Length > 1) { CNotice.noticeWarningID("OOFP"); return; } if (processList.Length != 1) { return; } Process femmProcess = processList[0]; Thread.Sleep(100); MoveWindow(femmProcess.MainWindowHandle, iPosX, iPosY, iSizeX, iSizeY, true); } catch (Exception ex) { CNotice.printLog(ex.Message); return; } }
private void buttonDrawingGuide_Click(object sender, EventArgs e) { string strHelpFileFullName; CultureInfo ctInfo = Thread.CurrentThread.CurrentCulture; if (ctInfo.Name == "en-US") { strHelpFileFullName = Path.Combine(CSettingData.m_strProgramDirPath, "Help", "Drawing_Guide_ENG.pdf"); } else if (ctInfo.Name == "ko-KR") { strHelpFileFullName = Path.Combine(CSettingData.m_strProgramDirPath, "Help", "Drawing_Guide_KOR.pdf"); } else { return; } if (m_manageFile.isExistFile(strHelpFileFullName) == false) { if (CSettingData.m_emLanguage == EMLanguage.Korean) { CNotice.noticeWarning("도움말 파일이 존재하지 않습니다.\nDoSA 디렉토리 > Help > Drawing_Guide_KOR.pdf 를 확인하세요."); } else { CNotice.noticeWarning("Help file does not exist.\nPlease check DoSA Directory > Help > Drawing_Guide_ENG.pdf."); } return; } System.Diagnostics.Process.Start(strHelpFileFullName); }
// 파일스트림 객체에 코일 정보를 기록한다. // override 를 꼭 사용해야 가상함수가 아니라 현 함수가 호출된다. public override bool writeObject(StreamWriter writeStream, int nLevel) { try { CWriteFile writeFile = new CWriteFile(); writeFile.writeBeginLine(writeStream, "Non-Kind", nLevel); // CNode writeFile.writeDataLine(writeStream, "NodeName", NodeName, nLevel + 1); writeFile.writeDataLine(writeStream, "KindKey", KindKey, nLevel + 1); // Non Kind 는 CNode 의 정보와 CShapParts 의 Face 정보만 필요하기 때문에 // 나머지 정보는 저장하지 않는다. // // CShapeParts //writeFile.writeDataLine(writeStream, "MovingParts", MovingPart, nLevel + 1); // CFace if (Face != null) { Face.writeObject(writeStream, nLevel + 1); } writeFile.writeEndLine(writeStream, "Non-Kind", nLevel); } catch (Exception ex) { CNotice.printLog(ex.Message); return(false); } return(true); }
// 파일스트림 객체에 코일 정보를 기록한다. // override 를 꼭 사용해야 가상함수가 아니라 현 함수가 호출된다. public override bool writeObject(StreamWriter writeStream, int nLevel) { try { CWriteFile writeFile = new CWriteFile(); writeFile.writeBeginLine(writeStream, "Magnet", nLevel); // CNode writeFile.writeDataLine(writeStream, "NodeName", NodeName, nLevel + 1); writeFile.writeDataLine(writeStream, "KindKey", KindKey, nLevel + 1); // CParts writeFile.writeDataLine(writeStream, "MovingParts", MovingPart, nLevel + 1); // CMagnet writeFile.writeDataLine(writeStream, "Material", m_strMaterialName, nLevel + 1); writeFile.writeDataLine(writeStream, "MagnetDirection", emMagnetDirection, nLevel + 1); // CFace if (Face != null) { Face.writeObject(writeStream, nLevel + 1); } writeFile.writeEndLine(writeStream, "Magnet", nLevel); } catch (Exception ex) { CNotice.printLog(ex.Message); return(false); } return(true); }
public void setBlockPropCurrent(CScriptFEMM femm, double dCurrent, double dMeshSize) { CPoint blockPoint = null; blockPoint = this.Face.getBlockPoint(); if (blockPoint == null) { CNotice.printTraceID("NBPF"); return; } string strMaterialName = this.m_strMaterial; string strCircuit = NodeName + "_current"; if (CurrentDirection == EMCurrentDirection.OUT) { dCurrent = -dCurrent; } femm.addCircuitProp(strCircuit, dCurrent); femm.setBlockProp(blockPoint, strMaterialName, dMeshSize, strCircuit, 0, MovingPart, Turns); }
// 파일스트림 객체에 코일 정보를 기록한다. // override 를 꼭 사용해야 가상함수가 아니라 현 함수가 호출된다. public override bool writeObject(StreamWriter writeStream) { try { CWriteFile writeFile = new CWriteFile(); writeFile.writeBeginLine(writeStream, "Steel", 2); // CNode writeFile.writeDataLine(writeStream, "NodeName", NodeName, 3); writeFile.writeDataLine(writeStream, "KindKey", m_kindKey, 3); // CParts writeFile.writeDataLine(writeStream, "MovingParts", MovingPart, 3); // CSteel writeFile.writeDataLine(writeStream, "Material", m_strMaterial, 3); // CFace //if (Face != null) //{ // Face.writeObject(writeStream); //} writeFile.writeEndLine(writeStream, "Steel", 2); } catch (Exception ex) { CNotice.printTrace(ex.Message); return(false); } return(true); }
// 파일스트림 객체에 코일 정보를 기록한다. // override 를 꼭 사용해야 가상함수가 아니라 현 함수가 호출된다. public override bool writeObject(StreamWriter writeStream, int nLevel) { try { CWriteFile writeFile = new CWriteFile(); writeFile.writeBeginLine(writeStream, "ForceTest", nLevel); // CNode writeFile.writeDataLine(writeStream, "NodeName", NodeName, nLevel + 1); writeFile.writeDataLine(writeStream, "KindKey", KindKey, nLevel + 1); // CTest writeFile.writeDataLine(writeStream, "MeshSizePercent", MeshSizePercent, nLevel + 1); // CForceTest writeFile.writeDataLine(writeStream, "Voltage", Voltage, nLevel + 1); writeFile.writeDataLine(writeStream, "Current", Current, nLevel + 1); writeFile.writeDataLine(writeStream, "MovingStroke", MovingStroke, nLevel + 1); writeFile.writeEndLine(writeStream, "ForceTest", nLevel); } catch (Exception ex) { CNotice.printLog(ex.Message); return(false); } return(true); }
public void openDesign(string strExperimentFullName) { string strCommand; //------------------------------------------------------------- // 아주 중요 //------------------------------------------------------------- // // 디렉토리에 들어있는 \\ 기호는 FEMM 에서 인식하지 못한다. // 따라서 디렉토리안의 \\ 기호를 / 기호로 변경한다 strExperimentFullName = strExperimentFullName.Replace("\\", "/"); //------------------------------------------------------------- strExperimentFullName = "\"" + strExperimentFullName + "\""; try { /// nodes, segments, arcsegments, blocks, group strCommand = "open(" + strExperimentFullName + ")"; sendCommand(strCommand); } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
public static void showFEMM() { Process[] processList = Process.GetProcessesByName("femm"); if (processList.Length > 1) { CNotice.noticeWarningID("OOFP"); return; } if (processList.Length != 1) { return; } Process femmProcess = processList[0]; Thread.Sleep(100); // 윈도우가 최소화 되어 있다면 활성화 시킨다 ShowWindowAsync(femmProcess.MainWindowHandle, SW_SHOWNORMAL); // 윈도우에 포커스를 줘서 최상위로 만든다 SetForegroundWindow(femmProcess.MainWindowHandle); }
// 파일스트림 객체에 코일 정보를 기록한다. // override 를 꼭 사용해야 가상함수가 아니라 현 함수가 호출된다. public override bool writeObject(StreamWriter writeStream) { try { CWriteFile writeFile = new CWriteFile(); writeFile.writeBeginLine(writeStream, "ForceExperiment", 2); // CNode writeFile.writeDataLine(writeStream, "NodeName", NodeName, 3); writeFile.writeDataLine(writeStream, "KindKey", m_kindKey, 3); // CExperiment writeFile.writeDataLine(writeStream, "MeshSizePercent", MeshSizePercent, 3); // CForceExperiment writeFile.writeDataLine(writeStream, "Voltage", Voltage, 3); writeFile.writeDataLine(writeStream, "Current", Current, 3); writeFile.writeDataLine(writeStream, "MovingStroke", MovingStroke, 3); writeFile.writeEndLine(writeStream, "ForceExperiment", 2); } catch (Exception ex) { CNotice.printTrace(ex.Message); return(false); } return(true); }
private void buttonSolenoidGuide_Click(object sender, EventArgs e) { string strHelpFileFullName; CultureInfo ctInfo = Thread.CurrentThread.CurrentCulture; if (ctInfo.Name == "en-US") { strHelpFileFullName = Path.Combine(CSettingData.m_strProgramDirName, "Help", "Solenoid_Sample_ENG.pdf"); } else if (ctInfo.Name == "ko-KR") { strHelpFileFullName = Path.Combine(CSettingData.m_strProgramDirName, "Help", "Solenoid_Sample_KOR.pdf"); } else { return; } if (m_manageFile.isExistFile(strHelpFileFullName) == false) { CNotice.noticeWarningID("HFDN1"); return; } System.Diagnostics.Process.Start(strHelpFileFullName); }
/// <summary> /// 그룹 선택을 통해 모든 객체들을 삭제한다. /// </summary> public void deleteAll() { string strCommand; try { /// 기본 그룹을 삭제한다. strCommand = "mi_selectgroup(" + 0.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_deleteselected()"; sendCommand(strCommand); /// 이동 그룹을 삭제한다. strCommand = "mi_selectgroup(" + MOVING_GROUP_NUM.ToString() + ")"; sendCommand(strCommand); strCommand = "mi_deleteselected()"; sendCommand(strCommand); refreshView(); } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
public bool loadSettingFromFile() { string strAppDataPath = Environment.GetEnvironmentVariable("APPDATA"); string strSettingFilePath = Path.Combine(strAppDataPath, "DoSA-Open_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(); } catch (Exception ex) { CNotice.printTrace(ex.Message); CNotice.printTraceID("AEOW"); } return(true); }
private void buttonDonation_Click(object sender, EventArgs e) { string target; if (CSettingData.m_emLanguage == EMLanguage.Korean) { target = "http://www.solenoid.or.kr/index_dosa_donation_kor.html"; } else { target = "http://www.solenoid.or.kr/index_dosa_donation_eng.html"; } try { System.Diagnostics.Process.Start(target); } catch (System.ComponentModel.Win32Exception noBrowser) { if (noBrowser.ErrorCode == -2147467259) { CNotice.printTrace(noBrowser.Message); } } catch (System.Exception other) { CNotice.printTrace(other.Message); } }
public void selectPoint(CPoint selectPoint) { string strCommand; try { /// nodes, segments, arcsegments, blocks, group strCommand = "mi_seteditmode(\"nodes\")"; sendCommand(strCommand); strCommand = "mi_selectnode(" + selectPoint.m_dX + "," + selectPoint.m_dY + ")"; sendCommand(strCommand); /// editmode 를 group 으로 바꾸어서 FEMM 마우스 동작을 막는다. /// - refreshView() 전에 실행해야 한다. lockEdit(); /// refresh 를 꼭 해야 색상이 변한다 refreshView(); } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
private bool getMeshNodeCoordinate(string strMeshFileFullName, ref List <double> listDataX, ref List <double> listDataY, ref List <double> listDataZ) { CReadFile readFile = new CReadFile(); List <string> listBlockLines = new List <string>(); List <double> listColumnData = new List <double>(); try { readFile.readBlock(strMeshFileFullName, ref listBlockLines, "$Nodes", "$EndNodes"); foreach (string strLine in listBlockLines) { CParsing.getDataInAllLine(strLine, ref listColumnData, ' '); // 3개의 데이터일때만 좌표 데이터 이다. if (listColumnData.Count == 3) { listDataX.Add(listColumnData[0]); listDataY.Add(listColumnData[1]); listDataZ.Add(listColumnData[2]); } listColumnData.Clear(); } } catch (Exception ex) { CNotice.printTrace(ex.Message); return(false); } return(true); }
// 파일스트림 객체에 코일 정보를 기록한다. // override 를 꼭 사용해야 가상함수가 아니라 현 함수가 호출된다. public override bool writeObject(StreamWriter writeStream) { try { CWriteFile writeFile = new CWriteFile(); writeFile.writeBeginLine(writeStream, "Magnet", 2); // CNode writeFile.writeDataLine(writeStream, "NodeName", NodeName, 3); writeFile.writeDataLine(writeStream, "KindKey", m_kindKey, 3); // CParts writeFile.writeDataLine(writeStream, "MovingParts", MovingPart, 3); // CMagnet writeFile.writeDataLine(writeStream, "Material", m_strMaterial, 3); writeFile.writeDataLine(writeStream, "Hc", Hc, 3); writeFile.writeDataLine(writeStream, "Br", Br, 3); writeFile.writeDataLine(writeStream, "MagnetPlane", emMagnetPlane, 3); writeFile.writeDataLine(writeStream, "MagnetAngle", MagnetAngle, 3); writeFile.writeEndLine(writeStream, "Magnet", 2); } catch (Exception ex) { CNotice.printTrace(ex.Message); return(false); } return(true); }
public bool calcShapeSize(string strMeshFileFuleName) { List <double> listDataX = new List <double>(); List <double> listDataY = new List <double>(); List <double> listDataZ = new List <double>(); try { getMeshNodeCoordinate(strMeshFileFuleName, ref listDataX, ref listDataY, ref listDataZ); m_dMinX = listDataX.Min(); m_dMaxX = listDataX.Max(); m_dMinY = listDataY.Min(); m_dMaxY = listDataY.Max(); m_dMinZ = listDataZ.Min(); m_dMaxZ = listDataZ.Max(); } catch (Exception ex) { CNotice.printTrace(ex.Message); return(false); } return(true); }
//將選取的對象加入黑名單 public string intoblacklist(int memberid, string blackreason) { var goblacklist = CMemberFactory.fn會員查詢().FirstOrDefault(g => g.fMemberId == memberid); if (goblacklist.fIsBanned == true)//判斷是否已經是黑名單 避免重複加入黑名單 { ViewBag.blacklist = "此會員已是黑名單會員"; return("已是黑名單成員"); } else { goblacklist.fIsBanned = true; CMemberFactory.fn會員更新(goblacklist); CBlackListFactory.fn黑名單新增(new CBlackList() { fLockDateTime = DateTime.UtcNow.AddHours(08), fMemberId = memberid, fReason = blackreason }); CNotice c = new CNotice(); c.fNoticeDatetime = DateTime.Now; c.fNoticeContent = "此帳號因發言屢次違規已被設為黑名單,期間內無法針對商品進行留言"; c.fCategoryType = "管理員"; c.fLink = "超連結"; c.fMemberId = goblacklist.fMemberId; CNoticeFactory.fn通知訂單訊息新增(c); return("黑名單更新成功!"); } }
private void buttonDonation_Click(object sender, EventArgs e) { string target; if (CSettingData.m_emLanguage == EMLanguage.Korean) { target = "https://solenoid.or.kr/direct_kor.php?address=https://solenoid.or.kr/openactuator/dosa_donation_kor.htm"; } else { target = "https://solenoid.or.kr/direct_eng.php?address=https://solenoid.or.kr/openactuator/dosa_donation_eng.htm"; } try { System.Diagnostics.Process.Start(target); } catch (System.ComponentModel.Win32Exception noBrowser) { if (noBrowser.ErrorCode == -2147467259) { CNotice.printLog(noBrowser.Message); } } catch (System.Exception other) { CNotice.printLog(other.Message); } }
public CScriptFEMM() { try { m_strBC = "\"" + "BC" + "\""; string strCommand; /// FEMM 이 실행되지 않은 상태에서 sendCommand 만 호출하면 FEMM 이 실행된다. /// 그런데 newdocument(0) 란 명령어로 FEMM 을 실행 시키면 실행과 동시에 Document 가 만들어질 때 문제가 발생한다. /// 이를 해결하기 위해서 아래와 같이 FEMM 프로세스를 먼저 호출하고 Document 를 연다 CProgramFEMM.loadProcessOfFEMM(); // 스크립트 생성과 동시에 전자기장 모델를 시작한다. strCommand = "newdocument(0)"; sendCommand(strCommand); strCommand = "mi_probdef(0,\"millimeters\",\"axi\")"; sendCommand(strCommand); //strCommand = "mi_setgrid(0.5,\"cart\")"; strCommand = "mi_hidegrid()"; sendCommand(strCommand); } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
public ActionResult ToInsert(string datas) { var scores = JsonSerializer.Deserialize <Score[]>(datas); foreach (var i in scores) { CProductRank rank = new CProductRank(); rank.fRank = i.score; rank.fComment = i.message; rank.fSubmitDataTime = DateTime.UtcNow.AddHours(08); rank.fDetailOrderIId = i.id; CProductRankFactory.fn評價新增(rank); var a = CDetailOrderFactory.fn訂單明細查詢().Where(n => n.fDetailOrderIId == i.id).ToList(); CNotice c = new CNotice(); c.fCategoryType = "評價留言"; c.fLink = "超連結"; c.fNoticeDatetime = DateTime.UtcNow.AddHours(08); c.fMemberId = a.Single().fMemberSellerId; c.fNoticeContent = "您的" + a.Single().fName + "以新增評價"; CNoticeFactory.fn通知訂單訊息新增(c); } return(new ApiResult()); }
public void saveAs(string strExperimentFullName) { string strCommand; try { //------------------------------------------------------------- // 아주 중요 //------------------------------------------------------------- // // 디렉토리에 들어있는 \\ 기호는 FEMM 에서 인식하지 못한다. // 따라서 디렉토리안의 \\ 기호를 / 기호로 변경한다 strExperimentFullName = strExperimentFullName.Replace("\\", "/"); //------------------------------------------------------------- strExperimentFullName = "\"" + strExperimentFullName + "\""; strCommand = "mi_saveas(" + strExperimentFullName + ")"; sendCommand(strCommand); } catch (Exception ex) { CNotice.printTrace(ex.Message); return; } }
public bool saveSettingToFile() { string strAppDataPath = Environment.GetEnvironmentVariable("APPDATA"); string strSettingFilePath = Path.Combine(strAppDataPath, "DoSA-Open_2D"); string strSettingFileFullName = Path.Combine(strSettingFilePath, "setting.ini"); try { XmlSerializer xmlSerializer = new XmlSerializer(typeof(CSettingDataClone)); StreamWriter writer = new StreamWriter(strSettingFileFullName); // Static 객체는 XML Serialize 가 불가능해서 일반 Clone 객체에 복사를 하고 Serialize 를 하고 있다. CSettingDataClone settingData = new CSettingDataClone(); settingData.copySettingDataToClone(); xmlSerializer.Serialize(writer, settingData); writer.Close(); } catch (Exception ex) { CNotice.printTrace(ex.Message); } return(true); }
public static bool isOpenedWindow() { Process[] processList = Process.GetProcessesByName("femm"); if (processList.Length > 1) { CNotice.noticeWarningID("OOFP"); return(false); } if (processList.Length != 1) { return(false); } Process femmProcess = processList[0]; // Window 닫혀 있으면 Main Window Handle 값이 null 이다. if (femmProcess.MainWindowTitle != "") { return(true); } else { return(false); } }
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(); }
public ActionResult NoticeOK(CNotice aNotice) { ViewBag.theWriter = aNotice.theWriter; ViewBag.theTitle = aNotice.theTitle; ViewBag.theContent = aNotice.theContent; ViewBag.theDate = aNotice.theDate.ToString("yyyy.MM.dd"); return(View(aNotice)); }
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; }
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); } }