Cylindrical Surface

Hi, How do I find whether 'Geom_CylindricalSurface' is Hollow cylinder or Solid cylinder?? Shylesh

fhchina's picture

Write this code:

Handle(Geom_CylindricalSurface) aSurf = new ...
// Construct its bounding wire
TopoDS_Wire aWire = ...
TopoDS_Face aFace(aSurf, aWire);

hAISContext->Display(new AIS_Shape(aFace));

You can then rotate it in your program to see if it is hollow or solid(use Shaded mode)

Nilesh's picture

Hi,

Sorry, i don't want to see it on display. I want to programmatically find out if the cylindrical surface corresponds to hollow or filled...

shylesh

David Gao's picture

Hi, does anyone know the answer to this question? I had the same problem.

Kirill Gavrilov's picture

Geom_CylindricalSurface defines a cylindrical surface, so it cannot on it's own define a solid cylinder, only a hollow cylinder. Solid cylinder should have two extra circles defined by planar surfaces, so that TopoDS_Solid cylinder consists of several TopoDS_Face's (with one of them defined by Geom_CylindricalSurface in case of canonical geometry).

David Gao's picture

Thank you, Kirill. This question has puzzled me for a long time. If I select a face, which geometry is a cylindrical surface, from a complex body, how can I tell if the direction of the face is pointing towards the axis of the cylinder, or the reverse way?

Mikhail Sazonov's picture

The same cylindrical surface can be a surface of a hole in the body, or it can be an external surface like a fillet. The face orientation makes all deal.

First you take a normal direction according to the geometry. Then you check the orientation of the face. If it is Reversed then you just reverse the normal. That's all.

David Gao's picture

Thank you, Mikhail. how to take a normal direction of cylindrical surface? By the function Geom_CylindricalSurface::D1 or D2?

What I'm trying to figure out is that the normal direction of the cylindrical surface may point inward or outward, what determines this?

Mikhail Sazonov's picture

To get normal vector you should compute cross product of vectors DU and DV got by the method D1. Or, alternatively, using the method GeomLib::NormEstim.

Let's the cylinder axis has origin point Ao, evaluated point on a surface (returned by D0 or D1) is P, normal vector at this point is N. Then the normal is outward if the dot product of the vectors (Ao,P) and N is positive.

David Gao's picture

I'v understood the method you mentioned. Thank you!

But I doubt whether it can be judged from the definition of cylindrical surface, such as coordinate system, parameters, etc.

Assuming that the normal direction of cylindrical surface A points inward, and the normal direction of cylindrical surface B points outward, Can the normal direction point to the inside or the outside be judged from the definition of the cylindrical surface?? In other words, what is the difference between the definitions of A and B?

Mikhail Sazonov's picture

If the coordinate system is left-handed then normal is inward.

David Gao's picture

Thank you very much, Mikhail. You solved a problem that was confusing me.