Home
Reply
Regular Contributor
yadongshen
Posts: 46

The cosine_angle of cone is always zero

Dear All,

 

When I try to get the cosine_angle of a cone, so that I can judge if the cone is hole or a pin. 

When the cone is a hole, the cosine_angle should be -1. The cosine_angle should be positive 1 if the cone is a pin.

It turned out the cosine_angle in my code is always zero. I am stuck at that point.

My code to derive cone face from the feature selection is attached below:

 

FACE *PTRFACE = (FACE*)FirstEntity;
CONE* PTRCONE = (CONE*)PTRFACE->geometry();
SPAunit_vector AxisVector = PTRCONE->direction();
SPAposition Root = PTRCONE->root_point();
double sine_angle = PTRCONE->sine_angle();
double cosine_angle = PTRCONE->cosine_angle();

UserSpecifyingTolerance.JPG
Regular Contributor
Vi2
Posts: 72

Re: The cosine_angle of cone is always zero

This entity should be a CONE (or cone). Your must check the type of SURFACE (or surface).

To_yadongshen.jpg
Regular Contributor
yadongshen
Posts: 46

Re: The cosine_angle of cone is always zero

Thank you.

 

but when i followed the instruction, the cosine_angle is always positive 1.

why is that.

 

FACE *PTRFACE = (FACE*)FirstEntity;
SURFACE *PTRSURFACE = (SURFACE*)PTRFACE->geometry();
surface const &surf = *(surface const*)&PTRSURFACE->equation();
cone const &cone = *(cone const*)&surf;
double cosine_angle = cone.cosine_angle;

Regular Contributor
Vi2
Posts: 72

Re: The cosine_angle of cone is always zero

You should detect the CONE(cone) surface to obtain its features.

 

if ( is_cone( &surf ) )

{

     cone const &cone = *(cone const*)&surf;
     double cosine_angle = cone.cosine_angle;

}

else

{

     // no cone!

}