Mesh is not orientated
Hello, when I generate mesh for .step file using gmsh.exe from downloaded binaries generated mesh is orientated but when I am trying to generate mesh using GMSH binaries and tutorial t20.cpp I get non-orientated mesh although I am using exactly the same settings I have in gmsh application. I export settings to file from application and read them after initialization because I don't know how to specify path to gmsh configuration file. I would appreciate any help. Thank you. My code:__
gmsh::initialize();
gmsh::model::add("test");
std::vector<std::pair<int, int> > v;
// my code for applying settings
for (auto const& parameter : parameters) {
if (parameter.type == MesherParameterType::String)
gmsh::option::setString(parameter.name, parameter.value);
else if (parameter.type == MesherParameterType::Number)
gmsh::option::setNumber(parameter.name, stoi(parameter.value));
}
try {
gmsh::model::occ::importShapes(in, v);
}
catch (...) {
gmsh::finalize();
throw new std::exception("Could not load file.");
}
double xmin, ymin, zmin, xmax, ymax, zmax;
gmsh::model::occ::getBoundingBox(v[0].first, v[0].second, xmin, ymin, zmin,
xmax, ymax, zmax);
int N = 5;
std::string dir = "X";
bool surf = true;
double dx = (xmax - xmin);
double dy = (ymax - ymin);
double dz = (zmax - zmin);
double L = (dir == "X") ? dz : dx;
double H = (dir == "Y") ? dz : dy;
std::vector<std::pair<int, int> > s;
s.push_back({ 2, gmsh::model::occ::addRectangle(xmin, ymin, zmin, L, H) });
if (dir == "X")
gmsh::model::occ::rotate({ s[0] }, xmin, ymin, zmin, 0, 1, 0, -M_PI / 2);
else if (dir == "Y")
gmsh::model::occ::rotate({ s[0] }, xmin, ymin, zmin, 1, 0, 0, M_PI / 2);
double tx = (dir == "X") ? dx / N : 0;
double ty = (dir == "Y") ? dy / N : 0;
double tz = (dir == "Z") ? dz / N : 0;
gmsh::model::occ::translate({ s[0] }, tx, ty, tz);
std::vector<std::pair<int, int> > tmp;
for (int i = 1; i < N - 1; i++) {
gmsh::model::occ::copy({ s[0] }, tmp);
s.push_back(tmp[0]);
gmsh::model::occ::translate({ s.back() }, i * tx, i * ty, i * tz);
}
std::vector<std::pair<int, int> > ov;
std::vector<std::vector<std::pair<int, int> > > ovv;
gmsh::model::occ::fragment(v, s, ov, ovv);
gmsh::model::occ::getEntities(tmp, 2);
gmsh::model::occ::remove(tmp, true);
gmsh::model::occ::synchronize();
gmsh::model::mesh::generate(3);
gmsh::write("result.stl");