# [GMSH] extrude rotation from arbitrary OpenCASCADE center

 Register Blogs Members List Search Today's Posts Mark Forums Read

February 2, 2022, 13:44
[GMSH] extrude rotation from arbitrary OpenCASCADE center
#1
Senior Member

Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 8
Hello everyone,

I'm trying to create a boundary around a cylinder in gmsh from a STEP file.
My idea is to extrude the seam line to generate a plane and afterwards revolute the plane around the cylinder axis. This approach is successfull as long as the center is precisely, but as soon as minor deviation are present the meshing crashes.

For simple models this works fine as I can cheat the axis to be in exact position, but for real geometries this center would not be in general positioned in a rounded number point. I've tried to add the considered by the CAD software for all the decimals available with success. I guess I need to use the exact position gmsh is using. I've seen that there is a property in gmsh which can be used for this (CenterOfMass), but I cannot make it work.

Code:
```SetFactory("OpenCASCADE");

Merge "Piece.step";

// Extrude the seam line
Extrude {2, 0, 0} {
Line{24}; Layers{3}; Recombine;
}

// First half
Extrude {{0, 0, 1}, {CenterOfMass Curve{19} }, Pi} {
Surface{22}; Layers{30}; Recombine;
}
// Second half
Extrude {{0, 0, 1}, {0,30,0}, Pi} {
Surface{27}; Layers{30}; Recombine;
}

Coherence;```
But it gives me a syntax error. I've been checking the gmsh documentation and CenterOfMass Curve|Surface|Volume {expression} is a valid expresion-list-item so it shall work. I've also tried to save it in an external variable:

Code:
```...

com() = CenterOfMass Curve {19};
Printf("",com());

Extrude {{0, 0, 1}, { com() }, Pi} {
Surface{22}; Layers{30}; Recombine;
}
...```
It prints me the center of mass on the Printf statement, but it gives me a syntax error when using it. Trying to manually introduce these coordinates lead to the same error.

Does anybody knows how to deal with this issue?
Attached Files
 Piece.zip (10.8 KB, 1 views)

 Tags expression-list, extrude, gmsh