Skip to content
Snippets Groups Projects
Commit c83c17a9 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Added more logging, bugfix

parent 04beb57d
No related branches found
No related tags found
No related merge requests found
......@@ -42,13 +42,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
......
......@@ -20,9 +20,9 @@
#define GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX 0x9049
/*Paths*/
/*HOME*/
#define RESOURCEPATH "C:\\Users\\engel\\repos\\arm-designer\\resources\\"
//#define RESOURCEPATH "C:\\Users\\engel\\repos\\arm-designer\\resources\\"
/*ZYGOTE*/
//#define RESOURCEPATH "C:\\Users\\Pascal\\repos\\arm-designer\\resources\\"
#define RESOURCEPATH "C:\\Users\\Pascal\\repos\\arm-designer\\resources\\"
class ArmDesigner {
public:
ArmDesigner();
......
......@@ -171,10 +171,10 @@ void ArmDesigner::gui_draw_controller_window_() {
std::for_each(selected_nodes_.begin(), selected_nodes_.end(), [&](const auto& n){selection_indices.push_back(n.first);});
std::for_each(selection_indices.begin(), selection_indices.end(), [&](const auto& i){selection_reps.push_back(gui_params_.segments_repetitions[i]);});
//log
std::string logstring = "Saving AutoCAD script " + RESOURCEPATH + std::string("designs\\saved\\") + gui_params_.segment_save_sc_path + " for segments ";
std::string logstring = std::string("Saving AutoCAD script ") + std::string(RESOURCEPATH) + std::string("designs\\saved\\") + gui_params_.segment_save_sc_path + std::string(" for segments ");
std::for_each(selection_indices.begin(), selection_indices.end(), [&](const auto& i){logstring += std::to_string(i) + " ";});
//save
segments_.save_ac(RESOURCEPATH + std::string("designs\\autocad_scripts\\") + gui_params_.segment_save_sc_path, selection_indices, selection_reps);
segments_.save_ac(RESOURCEPATH + std::string("designs\\autocad_scripts\\") + gui_params_.segment_save_ac_path, selection_indices, selection_reps);
}
else{
gui_params_.log_messages.push_back("Saving AC Failure: Select one or more Segments to save.");
......
......@@ -73,6 +73,7 @@ bool Segment::save_sc(std::string filename, int reps) const {
std::string Segment::get_autocad_script(int reps) const {
std::string printstr = "";
float multiplier = 1000.f; //dxf/gds units are weird, this is what was used in previous samples
for(size_t k = 0; k < reps; ++k){
float rot_angle = k * 2. * M_PI / reps;
for(size_t i = 0; i < pts_.size(); ++i){
......@@ -92,8 +93,8 @@ std::string Segment::get_autocad_script(int reps) const {
float x1 = cos * m[0] - sin * m[1];
float y1 = sin * m[0] + cos * m[1];
printstr += "line\n";
printstr += std::to_string(x0) + ", " + std::to_string(y0) + "\n";
printstr += std::to_string(x1) + ", " + std::to_string(y1) + "\n";
printstr += std::to_string(multiplier * x0) + "," + std::to_string(multiplier * y0) + "\n";
printstr += std::to_string(multiplier * x1) + "," + std::to_string(multiplier * y1) + "\n";
printstr += "\n"; //stop line drawing. potentially could just chain a single line per hole.
}
}
......
......@@ -67,8 +67,8 @@ bool Segments::save_ac(std::string filename, std::vector<size_t> selection, std:
return false;
}
else{
for(auto i: selection){
outfile << segms_[i].get_autocad_script(reps[i]);
for (size_t i = 0; i < selection.size(); ++i) {
outfile << segms_[selection[i]].get_autocad_script(reps[i]);
}
outfile.close();
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment