Hello All,
I’d like to share my problem with you and hopefully will find some help. I’ve written an application which simulates manufacturing of bevel gears based on Boolean’s operations. After simulation I receive some number of “microsurfaces” representing a teeth spacing. In the next step the program needs to cut received microsurfaces by a tool created by revolve operation (sheet feature). I’ve notice an issue when a number of “microsurfaces” is high, then the NX cannot confirm a revolve feature (only such error occurs: “System.NullReferenceException” which says me nothing. When this number is low the revolve feature can be confirmed without any error. Below you can find a code. Anybody have an idea what is wrong here? Do you think that memory is overloaded? Do I have any command enables to release it?
Thank you in advance for your help,
Pawel
The code:
int licz1 =0; Section section1; SelectionIntentRule[] rules1 =new SelectionIntentRule[1]; NXObject feature_revolve1 =null; NXOpen.Features.RevolveBuilder revolveBuilder1 =null; double IncZ =((B +2* naddatek)/(inter_number-1)); while(licz1 <10){ point3d1.X=0; point3d1.Y=0.5; point3d1.Z= offsetIN + Z1DIA +(IncZ * Math.Cos(sigma1 *(Math.PI/180)))* licz; point3d2.X=0; point3d2.Y= Y1DIA +(4* Math.Cos(sigma1 *(Math.PI/180)))+((IncZ)* Math.Sin(sigma1 *(Math.PI/180))+(0)* Math.Cos(sigma1 *(Math.PI/180)))* licz; point3d2.Z= offsetIN -(4* Math.Sin(sigma1 *(Math.PI/180)))+((IncZ)* Math.Cos(sigma1 *(Math.PI/180))-(0)* Math.Sin(sigma1 *(Math.PI/180)))* licz; Vector3d vector3d1 =new Vector3d(0, 0, 1); Point point1 = displayPart.Points.CreatePoint(point3d1); Point point2 = displayPart.Points.CreatePoint(point3d2); //Line definition Curve[] linia =new Curve[1]; linia[0]= displayPart.Curves.CreateLine(point1, point2); NXObject nxObject1; nxObject1 = linia[0]; Point3d pointZero =new Point3d(0, 0, 0); Direction direction1; direction1 = displayPart.Directions.CreateDirection(pointZero, vector3d1, NXOpen.SmartObject.UpdateOption.WithinModeling); //Axis creation Point nullPoint =null; Axis axis1; axis1 = displayPart.Axes.CreateAxis(nullPoint, direction1, SmartObject.UpdateOption.WithinModeling); //RevolveBulidier NXOpen.Features.Feature nullFeature1 =null; revolveBuilder1 = displayPart.Features.CreateRevolveBuilder(nullFeature1); //Section section1 = displayPart.Sections.CreateSection(0.02, 0.02, 0.02); revolveBuilder1.Section= section1; revolveBuilder1.Axis= axis1; revolveBuilder1.Tolerance=0.02; section1.DistanceTolerance=0.02; section1.ChainingTolerance=0.02; //Line assignment CurveDumbRule curveDumbRule1; curveDumbRule1 = displayPart.ScRuleFactory.CreateRuleCurveDumb(linia); section1.AllowSelfIntersection(true); rules1[0]= curveDumbRule1; NXObject nullNXObject =null; //Selection section1.AddToSection(rules1, nxObject1, nullNXObject, nullNXObject, point3d1, NXOpen.Section.Mode.Create, false); revolveBuilder1.Axis= axis1; //Sheet Body selection revolveBuilder1.FeatureOptions.BodyType= NXOpen.GeometricUtilities.FeatureOptions.BodyStyle.Sheet; revolveBuilder1.Section= section1; //Ustawienia revolveBuilder1.Limits.StartExtend.Value.RightHandSide="0"; revolveBuilder1.Limits.EndExtend.Value.RightHandSide="360"; revolveBuilder1.ParentFeatureInternal=false; licz1++; try{ feature_revolve1 = revolveBuilder1.CommitFeature();}catch{continue;} break;};