mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	ENH: support 3rd printer model
Change-Id: Ib8c2c846f73a6ac14339e1d0222204d7440de014
This commit is contained in:
		
							parent
							
								
									173b43d2bd
								
							
						
					
					
						commit
						e43f80e875
					
				
					 7 changed files with 71 additions and 16 deletions
				
			
		|  | @ -319,7 +319,12 @@ int DownPluginFrame::InstallPlugin() | |||
| 
 | ||||
| int DownPluginFrame::ShowPluginStatus(int status, int percent, bool &cancel) | ||||
| { | ||||
|     // TODO
 | ||||
|     static int nPercent = 0; | ||||
|     if (nPercent == percent)  | ||||
|         return 0; | ||||
| 
 | ||||
|     nPercent = percent; | ||||
| 
 | ||||
|     json m_Data = json::object(); | ||||
|     m_Data["status"] = status; | ||||
|     m_Data["percent"] = percent; | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ | |||
| 
 | ||||
| #include <boost/cast.hpp> | ||||
| #include <boost/lexical_cast.hpp> | ||||
| #include <boost/filesystem.hpp> | ||||
| 
 | ||||
| #include "MainFrame.hpp" | ||||
| #include <boost/dll.hpp> | ||||
|  | @ -850,25 +851,63 @@ int GuideFrame::LoadProfile() | |||
|         //} while (_findnext(handle, &findData) == 0); // 查找目录中的下一个文件
 | ||||
| 
 | ||||
|         // BBS: change directories by design
 | ||||
|         vendor_dir      = (boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR).make_preferred(); | ||||
|         rsrc_vendor_dir = (boost::filesystem::path(resources_dir()) / "profiles").make_preferred(); | ||||
| 
 | ||||
|         // BBS: add BBL as default
 | ||||
|         // BBS: add json logic for vendor bundle
 | ||||
|         auto bbl_bundle_path = (vendor_dir / PresetBundle::BBL_BUNDLE).replace_extension(".json"); | ||||
|         bbl_bundle_rsrc = false; | ||||
|         if (!boost::filesystem::exists(bbl_bundle_path)) { | ||||
|             bbl_bundle_path = (rsrc_vendor_dir / PresetBundle::BBL_BUNDLE).replace_extension(".json"); | ||||
|             bbl_bundle_rsrc = true; | ||||
|         } | ||||
|         BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(",  will load config from %1%.")% bbl_bundle_path; | ||||
|         //BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(",  will load config from %1%.") % bbl_bundle_path;
 | ||||
|         m_ProfileJson             = json::parse("{}"); | ||||
|         m_ProfileJson["model"]    = json::array(); | ||||
|         m_ProfileJson["machine"]  = json::array(); | ||||
|         m_ProfileJson["filament"] = json::object(); | ||||
|         m_ProfileJson["process"]  = json::array(); | ||||
| 
 | ||||
|         LoadProfileFamily(PresetBundle::BBL_BUNDLE, bbl_bundle_path.string()); | ||||
|         vendor_dir      = (boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR ).make_preferred(); | ||||
|         rsrc_vendor_dir = (boost::filesystem::path(resources_dir()) / "profiles").make_preferred(); | ||||
| 
 | ||||
|         // BBS: add BBL as default
 | ||||
|         // BBS: add json logic for vendor bundle
 | ||||
|         auto bbl_bundle_path = vendor_dir; | ||||
|         bbl_bundle_rsrc = false; | ||||
|         if (!boost::filesystem::exists((vendor_dir / PresetBundle::BBL_BUNDLE).replace_extension(".json"))) { | ||||
|             bbl_bundle_path = rsrc_vendor_dir; | ||||
|             bbl_bundle_rsrc = true; | ||||
|         } | ||||
| 
 | ||||
|         // intptr_t    handle;
 | ||||
|         //_finddata_t findData;
 | ||||
| 
 | ||||
|         //handle = _findfirst((bbl_bundle_path / "*.json").make_preferred().string().c_str(), &findData); // 查找目录中的第一个文件
 | ||||
|         // if (handle == -1) { return -1; }
 | ||||
| 
 | ||||
|         // do {
 | ||||
|         //    if (findData.attrib & _A_SUBDIR && strcmp(findData.name, ".") == 0 && strcmp(findData.name, "..") == 0) // 是否是子目录并且不为"."或".."
 | ||||
|         //    {
 | ||||
|         //        // cout << findData.name << "\t<dir>\n";
 | ||||
|         //    } else {
 | ||||
|         //        wxString strVendor = wxString(findData.name).BeforeLast('.');
 | ||||
|         //        LoadProfileFamily(w2s(strVendor), vendor_dir.make_preferred().string() + "\\"+ findData.name);
 | ||||
|         //    }
 | ||||
| 
 | ||||
|         //} while (_findnext(handle, &findData) == 0); // 查找目录中的下一个文件
 | ||||
| 
 | ||||
| 
 | ||||
|         string                                targetPath = bbl_bundle_path.make_preferred().string(); | ||||
|         boost::filesystem::path               myPath(targetPath); | ||||
|         boost::filesystem::directory_iterator endIter; | ||||
|         for (boost::filesystem::directory_iterator iter(myPath); iter != endIter; iter++) { | ||||
|             if (boost::filesystem::is_directory(*iter)) { | ||||
|                 //cout << "is dir" << endl;
 | ||||
|                 //cout << iter->path().string() << endl;
 | ||||
|             } else { | ||||
|                 //cout << "is a file" << endl;
 | ||||
|                 //cout << iter->path().string() << endl;
 | ||||
|                 wxString strVendor = wxString(iter->path().string()).BeforeLast('.'); | ||||
|                 strVendor          = strVendor.AfterLast( '\\'); | ||||
|                 strVendor          = strVendor.AfterLast('\/');           | ||||
| 
 | ||||
|                 LoadProfileFamily(w2s(strVendor), iter->path().string()); | ||||
|             } | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|         //LoadProfileFamily(PresetBundle::BBL_BUNDLE, bbl_bundle_path.string());
 | ||||
| 
 | ||||
|         const auto enabled_filaments = wxGetApp().app_config->has_section(AppConfig::SECTION_FILAMENTS) ? wxGetApp().app_config->get_section(AppConfig::SECTION_FILAMENTS) : std::map<std::string, std::string>(); | ||||
|         m_appconfig_new.set_vendors(*wxGetApp().app_config); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 zorro.zhang
						zorro.zhang