I have a question related to rotationally symmetric geometries.
Suppose I want to construct a cylinder in 3D by revolving a rectangle with radius R=.1 (in x-direction) and height H=1 (in y-direction) around the y-axis defined by the points (0,0,0) and (0,1,0).
Attached you find a simple test which should do that in principle.
However, I have two problems:
Somehow I have to interchange the intuitive definitions of H and R. Why is that? Or, phrased differently: In which working plane am I defining the SplineCurve2D()?
The SplineCurve2d has it’s own local coordinate system, lets say the coordinates in this system are denoted by (x’,y’). The defined spline is always rotated around this x’-axis!!
Now you can map the local coordinates to your 3d coordinate system. When you define the revolution object you define the axis of rotation by two points. This means your point (0’,0’) is mapped to the first point and the x’-axis is pointing in the direction of the second point.
The meshing fails for me as well. Sounds like the algorithm has problems to find the special points to start the meshing. I’ll have to look into that.
Shifting the points which define the axis revolution might help for now. The following setting works for me.
H = 1 # why not H=1 here?
R = 0.1 # why not R=.1 here?
pnts = [ (0,0), (0,R), (H,R), (H,0) ]
segs = [ (0,1), (1,2), (2,3), (3,0) ]
for pnt in pnts:
spline.AddPoint(*pnt)
for seg in segs:
spline.AddSegment(*seg)
rev = Revolution(Pnt(0,1.2,0), Pnt(0,0.4,0), spline)
Which kind of geometry would you like to define? I’m surprised that the cylinder causes problems. I already used it to define way more complicated geometries and did not have these problems.
Thank you very much, Christoph, for your reply!
My problem concerning the coordinate system is now resolved
Actually, I would like to be able to define a geometry, where, for example, one side is defined by a quadratic spline. I attached an example where I defined something resembling a flower vase
Surprisingly, the meshing works for this example.
So why it fails for the cylinder example above, I have no idea.
if you do not close your 2d spline, it is assumed that the start point and the end point lie on the x’-axis.
So in your case, it seems to be the best way is to leave it open.
I had a quick look at the code and having a connection on the x’-axis could make problems.