Trying to collect all the holes generated by Hole Wizard from Part file.
swFeat = (Feature)swMdlDoc.FirstFeature();
int count = 0;
object[] points = null;
int iCompare = 0;
while ((swFeat != null))
{
Feature swSubFeature = default(Feature);
swSubFeature = (Feature)swFeat.GetFirstSubFeature();
Feature swSketch = default(Feature);
if (swSubFeature == null)
{
//WriteLog("swSubFeature == null");
swSketch = (Feature)swFeat.GetSpecificFeature2();
}
else
{
swSketch = (Feature)swSubFeature.GetSpecificFeature2();
}
if (swSketch == null)
{
//WriteLog("swSubFeature pSketch == null");
swFeat = (Feature)swFeat.GetNextFeature();
continue;
}
Sketch pSketch = default(Sketch);
pSketch = (Sketch)swSketch;
MathTransform swMdl2Skt = default(MathTransform);
swMdl2Skt = pSketch.ModelToSketchTransform;//True To Res Matrix of Worknc outil*.mul[ Lower Matrix from file ];Use this for Hole direction
WizardHoleFeatureData2 swWizardHoleFeatureData = default(WizardHoleFeatureData2);
SketchPoint swSketchPoint = default(SketchPoint);
swWizardHoleFeatureData = (WizardHoleFeatureData2)swFeat.GetDefinition();
count = swWizardHoleFeatureData.GetSketchPointCount();
points = (object[])swWizardHoleFeatureData.GetSketchPoints();
foreach (object point in points)
{
swSketchPoint = (SketchPoint)point;
WriteLog("X,Y,Z = " + swSketchPoint.X.ToString() + " , " + swSketchPoint.Y.ToString() + " , " + swSketchPoint.Z.ToString());
}
Sktech CSYS and model CSYS is different. Want to get the Hole direction in Sketch CSYS and Model CSYS
please help.
Hi Geeta Kapase,
1. Once you obtain the skech point, get pointer to ISketch (sketch containing these sketch points) using ISketchPoint::GetSketch method.
2. Obtain plane or face on which this sketch is created using ISketch::GetReferenceEntity method.
3. Get the normal of the plane using IRefPlane::Transform property or face using IFace2::Normal property.
4. Direction of the hole wizard hole is opposite to this normal (180 degree).
Hope this helps.
Regards,
Nilesh Patel