extracting hole axis

Hello,

I want to build an api which founds a hole feature in parts

and extracts its hole axis.

I attach a file of what I've already done.

Regards, ohad.

SolidworksApi macros
Answers 2
SF
SF 2011-11-27 Best Answer

Please, can anyone help me? it is very important for me.

thanks

RJ
RJ 2011-11-28

Ohad,

You can use the following steps to generate the axis: -

  • Traverse through feature manager and get a hole feature.
  • Use feature::getFaces() to get all the feature faces.
  • Traverse through each face; get the underlying surface object. (Face2::getSurface())
  • Check if the surface is conical or cylindrical. (Surface::ISCone() and Surface::IsCylinder())
  • Use Surface::ConeParams and Surface::CylinderParams to get the surface parameters.
  • The resultant parameter values have axis in model coordinate system.

Hope it helps!!!

Rajat Jain