Cancel
Showing results for 
Search instead for 
Did you mean: 

Null tag not allowed error when using CreateHoleFeatureBuilder function

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

I am trying to detect the depth and other measures of a hole which i have in my model. I was trying to cast Feature to Hole object but it didnt work .So i found another way of reaching the depth of a hole here is my code.

 

FeatureCollection featColl = workPart.Features;
foreach (Feature feat in featColl){

    if (feat.FeatureType == "SIMPLE HOLE"){
    HoleFeatureBuilder hole = featColl.CreateHoleFeatureBuilder(feat);

    }

}

 

i am pretty sure i have simple hole type of features in my model but somehow i get an error.

here is what i found in errorlogs:

 

NXOpen.NXException: Null tag not allowed
at NXOpen.Features.FeatureCollection.CreateHoleFeatureBuilder(Feature hole)

 

i would appriciate any help.

4 REPLIES 4

Re: Null tag not allowed error when using CreateHoleFeatureBuilder function

Legend
Legend

@Cagri 

 

I would suggest you to record a journal, Edit the value and compare with you code.

伊尔凡

Re: Null tag not allowed error when using CreateHoleFeatureBuilder function

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

@IR  thx , i have managed to fix the casting issue by comparing my code to the journaling code.

Since I haven't find a solution related to this i am adding my code here so that others may have the same problem.

FeatureCollection featColl = workPart.Features;
        foreach (Feature feat in featColl)
        {
            if (feat.FeatureType == "HOLE PACKAGE")
            {
                HolePackage holePackage1 = (HolePackage)feat;
                HolePackageBuilder builder = featColl.CreateHolePackageBuilder(holePackage1);
                builder.DrillSizeHoleDepth.RightHandSide ="10";
                builder.Destroy();
            }
        } 

with this code we can read or edit any attributes of the hole.Dont forget to put the condition statement. If ur FeatureType!="HOLE PACKAGE" your casting operation will be failed.

Re: Null tag not allowed error when using CreateHoleFeatureBuilder function

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Re: Null tag not allowed error when using CreateHoleFeatureBuilder function

Legend
Legend

@Cagri 

 

das ist gut

 

伊尔凡