kindOfShape() [bug] [CONE2D]

Hello,
I just found a bug with geompy.kindOfShape(face) when face is a cone2D face.

following the documentation SALOME Geometry User's Guide: Auxiliary data structures and methods
if face is a cone2D
the result of geompy.kindOfShape(face) should look similar to this:
[CONE2D, xc, yc, zc, dx, dy, dz, R_1, R_2 H]
so, center in (xc,yc,zc)
auxPoint in (xc+dx, yc+dy, zc+dz)
axis a vector between center and auxPoint
minorRadius equal to R_1
mayorRadius equal to R_2
and a height of H
so to recreate the cone of the surface (following the documentation) one should do:

infoOfFace=geompy.KindOfShape(face)
center=geompy.MakeVertex(infoOfFace[1], infoOfFace[2], infoOfFace[3])
vertNorm=geompy.MakeVertex(infoOfFace[1]+infoOfFace[4], infoOfFace[2]+infoOfFace[5], infoOfFace[3]+infoOfFace[6])
axis=geompy.MakeVector(center, vertNorm)
radius_0=infoOfFace[7]
radius_1=infoOfFace[8]
height=infoOfFace[9]
completeCone=geompy.MakeCone(center, axis, radius_0,radius_1, height)
geompy.addToStudy(completeCone,'completeCone')
geompy.addToStudy(face,'face')

but as it can be seen in the image: the completeCone is not correctly created.
image
(outside of the direction that could be a missing sign somewhere in the calculation which I find strange as with the other kindOfShape I have tested it has succesfully create the corresponding related body without orientation issues), the issue is that the geompy.kindOfShape(face) is returning one of two wrong parameters, or the heigh(H) or the radius 2 (R_2), as the result gives the following result:
[CONE2D, 0.0005, 0.0, 0.0005, 0.0, 0.0, -1.0, 0.00075, 0.0, 0.0006000000000000003]
which would indicate that is a cone of R_1=0.00075, R_2=0.0 (meaning is a complete cone), and a height=0.0006 the thing is:

  • the height is correct but then R_2 should be equal to 0.0005 (and not 0.0)

or

  • the R_2 is correct but then the height should be equal to 0.0018 (and not 0.0006)

here is the sketch of the original geometry:

and the STEP model attached:
cone2d.step (4,2 KB)

@cbourcier I am tagging you as this is part of last developments, might be usefull to find the issue before is burried by development
regards,

Thank you @franco.ota for reporting this.

The current implementation is only considering fully revolved conical surfaces, either an entire cone or truncated cone. For the trimmed face, like in your case, it is currently not working and returning an incorrect default value (for the upper radius). The same is true for the axis direction.

BTW: This API function was recently updated but only to get more details for different types of curves. The implementation for faces did not change!

Regards,
Martin

Hello Martin,
Thanks for the insight,
It would be great to add this feature as it is not a complex one to add. I managed to do it reliable in python,
I am not at the pc but the work flow is the following one:
With kinfOfShape get

  1. Center, axis (from center to point center+(dx, dy, dz)) and radius (R) and height
  2. Extend the axis to the height returned by kinfOfShape
  3. Iterate over all vertexes in the surface and get their respective distances (the smallest one is r)
  4. One can create the corresponding cone, using center, axis, R, r and height.

This will create correctly even for sections of surfaces of cones the corresponding cone.
Regards.