|
@@ -16,8 +16,15 @@
|
|
|
|
|
|
const char* openScadBase =
|
|
const char* openScadBase =
|
|
"$fn = 100;\n"
|
|
"$fn = 100;\n"
|
|
|
|
+ "use </tmp/threads_2.5.scad>\n"
|
|
"module optiTrackPointBase(translation, rotation, length, radius) {\n"
|
|
"module optiTrackPointBase(translation, rotation, length, radius) {\n"
|
|
"translate(translation) rotate(rotation) cylinder(length, radius, radius, false);\n"
|
|
"translate(translation) rotate(rotation) cylinder(length, radius, radius, false);\n"
|
|
|
|
+ "}\n"
|
|
|
|
+ "module steamVrTrackPointBase(translation, rotation, length) {\n"
|
|
|
|
+ "translate(translation) rotate(rotation) {\n"
|
|
|
|
+ "cylinder(length, 3.5, 3.5, false);\n"
|
|
|
|
+ "translate([0, 0, length]) english_thread(diameter=1/4, threads_per_inch=20, length=0.393701);\n"
|
|
|
|
+ "}\n"
|
|
"}\n";
|
|
"}\n";
|
|
|
|
|
|
bool OpenScadRenderer::openScadAvailable() {
|
|
bool OpenScadRenderer::openScadAvailable() {
|
|
@@ -40,3 +47,18 @@ void OpenScadRenderer::renderOptiTrack(std::vector<OptiTrackPoint*> points) {
|
|
std::string command = openScadPath + " -o " + std::filesystem::temp_directory_path().u8string() + fileDelimiter + "trackpointapp_render_optitrack.3mf " + std::filesystem::temp_directory_path().u8string() + fileDelimiter + "trackpointapp_export_optitrack.scad";
|
|
std::string command = openScadPath + " -o " + std::filesystem::temp_directory_path().u8string() + fileDelimiter + "trackpointapp_render_optitrack.3mf " + std::filesystem::temp_directory_path().u8string() + fileDelimiter + "trackpointapp_export_optitrack.scad";
|
|
system(command.c_str());
|
|
system(command.c_str());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void OpenScadRenderer::renderSteamVRTrack(std::vector<SteamVRTrackPoint*> points) {
|
|
|
|
+ std::ofstream scadFile;
|
|
|
|
+ scadFile.open(std::filesystem::temp_directory_path().u8string() + fileDelimiter + "trackpointapp_export_steamvrtrack.scad");
|
|
|
|
+ scadFile << openScadBase;
|
|
|
|
+ scadFile << "import(\"trackpointapp_export.3mf\");\n";
|
|
|
|
+ for (SteamVRTrackPoint* point: points) {
|
|
|
|
+ osg::Vec3 translation = point->getTranslation();
|
|
|
|
+ osg::Vec3 rotation = point->getRotation();
|
|
|
|
+ scadFile << "steamVrTrackPointBase([" << translation.x() << "," << translation.y() << "," << translation.z() << "], [" << rotation.x() << "," << rotation.y() << "," << rotation.z() << "], " << point->getLength() << ");\n";
|
|
|
|
+ }
|
|
|
|
+ scadFile.close();
|
|
|
|
+ std::string command = openScadPath + " -o " + std::filesystem::temp_directory_path().u8string() + fileDelimiter + "trackpointapp_render_steamvrtrack.3mf " + std::filesystem::temp_directory_path().u8string() + fileDelimiter + "trackpointapp_export_steamvrtrack.scad";
|
|
|
|
+ system(command.c_str());
|
|
|
|
+}
|