Help with G4ExtrudedSolid

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_10.1.p03
_Operating System:_Centos7
Compiler/Version: 4.8.5
_CMake Version:_3.17.5

I can’t work out how to use G4ExtrudedSolid. Whatever I try it fails with the message “making facets failed”. A simple example to get me started would help. This is what I have tried.
float stepDepth=171.35;
float stepY=167.0+stepDepth;
float stepX=260.0;
G4TwoVector off1{0.0,0.0};
G4TwoVector off2{0.0,0.0};
std::vector polygon{{0.0,0.0},{0.0,stepY},{stepX,stepY},{0.0,stepY},{0.0,0.0}};
auto step=new G4ExtrudedSolid(“Step”,polygon,stepHalfLength,off1,1.0,off2,1.0);


Try:

std::vector polygon{{0.0,0.0},{0.0,stepY},{stepX,stepY},{stepX,0.0},{0.0,0.0}};

No difference. I get the same error message.

It works if I take of the final {0,0}

double stepHalfLength=925./2.0;
float stepDepth=171.35;
float stepY=167.0+stepDepth;
float stepX=260.0;
G4TwoVector off1{0.0,0.0};
G4TwoVector off2{0.0,0.0};
std::vector<G4TwoVector>  polygon{{0.0,0.0},{0.0,stepY},{stepX,stepY},{stepX,0.0}};
auto step=new G4ExtrudedSolid("Step",polygon,stepHalfLength,off1,1.0,off2,1.0);

Correct. In a polygon, the last point is connected with the first one. Before deleting, point {0,0} was duplicated. This caused a problem with polygon triangulation. The problem was fixed in Geant4 10.03. So, I would recommend you to migrate to recent version of Geant4.