AnsweredAssumed Answered

How to get Hole direction created by hole wizard using sketch ?

Question asked by Geeta Kapase on Dec 18, 2020
Latest reply on Dec 22, 2020 by Geeta Kapase

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. 

Outcomes