MCPcopy Create free account
hub / github.com/SpectacularAI/sdk / runPythonVisualizer

Function runPythonVisualizer

cpp/common/visualization/visualizer.cpp:71–100  ·  view source on GitHub ↗

Runs Python visualization using system()

Source from the content-addressed store, hash-verified

69
70// Runs Python visualization using system()
71bool runPythonVisualizer(const VisualizerArgs &args) {
72 std::pair<int, int> r = tryParseResolution(args.resolution);
73
74 // Create a temporary Python script
75 std::ofstream tempFile("spectacularAI_temp_visualizer.py");
76 tempFile << pythonScript;
77 tempFile.close();
78
79 std::stringstream ss;
80 ss << " spectacularAI_temp_serialization";
81 ss << " --resolution " << r.first << "x" << r.second;
82 ss << " --fps " << args.targetFps;
83 if (args.fullScreen)
84 ss << " --fullScreen";
85 if (!args.recordWindow.empty())
86 ss << " --recordWindow " << args.recordWindow;
87 if (args.voxelSize > 0)
88 ss << " --voxel " << args.voxelSize;
89 if (args.colorOnly)
90 ss << " --color";
91
92 // Execute the Python script using system()
93 std::string pythonCommand = "python spectacularAI_temp_visualizer.py " + ss.str();
94 int result = system(pythonCommand.c_str());
95
96 // Delete the temporary Python script
97 std::remove("spectacularAI_temp_visualizer.py");
98
99 return result == 0;
100}
101
102} // anonymous namespace
103

Callers 1

runMethod · 0.85

Calls 2

emptyMethod · 0.80
tryParseResolutionFunction · 0.70

Tested by

no test coverage detected