0
$\begingroup$

I tried to generate 3 very simple cylinders, each other connected to it end, however the cylinder get connected to an unexistent point in space as the image shows:

enter image description here

It was supposed to each segment be 45º, 90º and 60º of inclination.

The code:

#include <gmsh.h>

int main(int argc, char **argv)
{

    gmsh::initialize();
    gmsh::option::setNumber("General.Terminal", 1);
    gmsh::model::add("t1");

    double lc = 1e-2;

    gmsh::model::occ::addPoint(0, 0, 0, lc, 0);
    gmsh::model::occ::addPoint(0.35, 0.35, 0, lc, 1);
    gmsh::model::occ::addPoint(0.35, 1.35, 0, lc, 2);
    gmsh::model::occ::addPoint(0.85, 2.21, 0, lc, 3);


    gmsh::model::occ::addCylinder(0, 0, 0, 0.35, 0.35, 0,       0.05f, -1);
    gmsh::model::occ::addCylinder(0.35, 0.35, 0, 0.35, 1.35, 0, 0.05f, -1);
    gmsh::model::occ::addCylinder(0.35, 1.35, 0, 0.85, 2.21, 0, 0.05f, -1);

    gmsh::model::occ::synchronize();
    gmsh::model::mesh::generate(3);
    gmsh::write("t1.msh");
    gmsh::finalize();


    return 0;
}
$\endgroup$
5
  • 2
    $\begingroup$ You should ask this on the gmsh specific forums. $\endgroup$ Mar 28, 2020 at 17:20
  • $\begingroup$ Did once, got no answer. $\endgroup$ Mar 28, 2020 at 17:25
  • 1
    $\begingroup$ The problem is that the people with gmsh knowledge who hang out here are, at best, a subset of those who hang out at the gmsh forums. If they don't respond there, they're unlikely to respond here. $\endgroup$ Mar 29, 2020 at 15:50
  • 2
    $\begingroup$ @WolfgangBangerth not necessarily true. I don't read gmsh forums/maillist except when I google something. It is debatable where it is best to ask a certain question first. One can certainly qualify GMSH as a niche software, and then it is off-topic, but those questions are often answered here, as lots of people use GMSH. $\endgroup$
    – Anton Menshov
    Apr 2, 2020 at 4:22
  • 1
    $\begingroup$ @AntonMenshov, I think that was a Meta discussion that never reached conclusion, though. $\endgroup$
    – nicoguaro
    Apr 2, 2020 at 21:27

1 Answer 1

1
$\begingroup$

I don't know gmsh, but I have an idea you could check.

How are the coordinates interpreted? If the coordinates are $x$ $y$ $z$, shouldn't the second cylinder be straight upwards, length one?

0,35 0,35 0    0,35, 1,35 0

Then the third cylinder would be correct.

All angles are absolute to the origin. Seeing only the image, it looks like you are off by the same value the first cylinder has.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.