mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	WIP: prusa-gcodeviewer command line wrapper to start the PrusaSlicer
in standalone G-code viewer mode. Linux and OSX stuff will follow.
This commit is contained in:
		
							parent
							
								
									ac9e1e8e4a
								
							
						
					
					
						commit
						08580a9b18
					
				
					 6 changed files with 52 additions and 1 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								resources/icons/PrusaSlicer-gcodeviewer.ico
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								resources/icons/PrusaSlicer-gcodeviewer.ico
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 111 KiB | 
|  | @ -92,6 +92,7 @@ endif() | |||
| # Create a slic3r executable | ||||
| # Process mainfests for various platforms. | ||||
| configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/PrusaSlicer.rc.in ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc @ONLY) | ||||
| configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/PrusaSlicer-gcodeviewer.rc.in ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer-gcodeviewer.rc @ONLY) | ||||
| configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/PrusaSlicer.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.manifest @ONLY) | ||||
| configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) | ||||
| if (WIN32) | ||||
|  | @ -161,12 +162,22 @@ if (WIN32) | |||
|     add_executable(PrusaSlicer_app_console PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc) | ||||
|     # Generate debug symbols even in release mode. | ||||
|     if (MSVC) | ||||
|     target_link_options(PrusaSlicer_app_console PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>") | ||||
|         target_link_options(PrusaSlicer_app_console PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>") | ||||
|     endif () | ||||
|     target_compile_definitions(PrusaSlicer_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE) | ||||
|     add_dependencies(PrusaSlicer_app_console PrusaSlicer) | ||||
|     set_target_properties(PrusaSlicer_app_console PROPERTIES OUTPUT_NAME "prusa-slicer-console") | ||||
|     target_link_libraries(PrusaSlicer_app_console PRIVATE boost_headeronly) | ||||
| 
 | ||||
|     add_executable(PrusaSlicer_app_gcodeviewer WIN32 PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer-gcodeviewer.rc) | ||||
|     # Generate debug symbols even in release mode. | ||||
|     if (MSVC) | ||||
|         target_link_options(PrusaSlicer_app_gcodeviewer PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>") | ||||
|     endif () | ||||
|     target_compile_definitions(PrusaSlicer_app_gcodeviewer PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE -DSLIC3R_WRAPPER_GCODEVIEWER) | ||||
|     add_dependencies(PrusaSlicer_app_gcodeviewer PrusaSlicer) | ||||
|     set_target_properties(PrusaSlicer_app_gcodeviewer PROPERTIES OUTPUT_NAME "prusa-gcodeviewer") | ||||
|     target_link_libraries(PrusaSlicer_app_gcodeviewer PRIVATE boost_headeronly) | ||||
| endif () | ||||
| 
 | ||||
| # Link the resources dir to where Slic3r GUI expects it | ||||
|  |  | |||
|  | @ -101,6 +101,7 @@ int CLI::run(int argc, char **argv) | |||
|         std::find(m_transforms.begin(), m_transforms.end(), "cut") == m_transforms.end() && | ||||
|         std::find(m_transforms.begin(), m_transforms.end(), "cut_x") == m_transforms.end() && | ||||
|         std::find(m_transforms.begin(), m_transforms.end(), "cut_y") == m_transforms.end(); | ||||
|     bool 							start_as_gcodeviewer = false; | ||||
|      | ||||
|     const std::vector<std::string> &load_configs		= m_config.option<ConfigOptionStrings>("load", true)->values; | ||||
| 
 | ||||
|  | @ -521,6 +522,9 @@ int CLI::run(int argc, char **argv) | |||
|                     << " (" << print.total_extruded_volume()/1000 << "cm3)" << std::endl; | ||||
| */ | ||||
|             } | ||||
|         } else if (opt_key == "gcodeviewer") { | ||||
|         	start_gui = true; | ||||
|         	start_as_gcodeviewer = true; | ||||
|         } else { | ||||
|             boost::nowide::cerr << "error: option not supported yet: " << opt_key << std::endl; | ||||
|             return 1; | ||||
|  |  | |||
|  | @ -221,6 +221,11 @@ int wmain(int argc, wchar_t **argv) | |||
|     std::vector<wchar_t*> argv_extended; | ||||
|     argv_extended.emplace_back(argv[0]); | ||||
| 
 | ||||
| #ifdef SLIC3R_WRAPPER_GCODEVIEWER | ||||
|     wchar_t gcodeviewer_param[] = L"--gcodeviewer"; | ||||
|     argv_extended.emplace_back(gcodeviewer_param); | ||||
| #endif /* SLIC3R_WRAPPER_GCODEVIEWER */ | ||||
| 
 | ||||
| #ifdef SLIC3R_GUI | ||||
|     // Here one may push some additional parameters based on the wrapper type.
 | ||||
|     bool force_mesa = false; | ||||
|  |  | |||
|  | @ -3530,6 +3530,12 @@ CLIActionsConfigDef::CLIActionsConfigDef() | |||
|     def->cli = "export-gcode|gcode|g"; | ||||
|     def->set_default_value(new ConfigOptionBool(false)); | ||||
| 
 | ||||
|     def = this->add("gcodeviewer", coBool); | ||||
|     def->label = L("G-code viewer"); | ||||
|     def->tooltip = L("Visualize an already sliced and saved G-code"); | ||||
|     def->cli = "gcodeviewer"; | ||||
|     def->set_default_value(new ConfigOptionBool(false)); | ||||
| 
 | ||||
|     def = this->add("slice", coBool); | ||||
|     def->label = L("Slice"); | ||||
|     def->tooltip = L("Slice the model as FFF or SLA based on the printer_technology configuration value."); | ||||
|  |  | |||
							
								
								
									
										25
									
								
								src/platform/msw/PrusaSlicer-gcodeviewer.rc.in
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/platform/msw/PrusaSlicer-gcodeviewer.rc.in
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| 1 VERSIONINFO | ||||
| FILEVERSION @SLIC3R_RC_VERSION@ | ||||
| PRODUCTVERSION @SLIC3R_RC_VERSION@ | ||||
| { | ||||
|  BLOCK "StringFileInfo" | ||||
|  { | ||||
|   BLOCK "040904E4" | ||||
|   { | ||||
|    VALUE "CompanyName", "Prusa Research" | ||||
|    VALUE "FileDescription", "@SLIC3R_APP_NAME@ G-code Viewer" | ||||
|    VALUE "FileVersion", "@SLIC3R_BUILD_ID@" | ||||
|    VALUE "ProductName", "@SLIC3R_APP_NAME@ G-code Viewer" | ||||
|    VALUE "ProductVersion", "@SLIC3R_BUILD_ID@" | ||||
|    VALUE "InternalName", "@SLIC3R_APP_NAME@ G-code Viewer" | ||||
|    VALUE "LegalCopyright", "Copyright \251 2016-2020 Prusa Research, \251 2011-2018 Alessandro Ranelucci" | ||||
|    VALUE "OriginalFilename", "prusa-gcodeviewer.exe" | ||||
|   } | ||||
|  } | ||||
|  BLOCK "VarFileInfo" | ||||
|  { | ||||
|    VALUE "Translation", 0x409, 1252 | ||||
|  } | ||||
| } | ||||
| 2 ICON "@SLIC3R_RESOURCES_DIR@/icons/PrusaSlicer-gcodeviewer.ico" | ||||
| 1 24 "PrusaSlicer.manifest"  | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv