EngProgrammer
Aerospace
- Jan 14, 2015
- 150
Dear Forum,
I've been developing an NXOpen function for creating couterbore holes on a pointset using the CreateHolePackageBuilder class in the namespace wrokpart.features.CreateHolePackageBuilder. The code works except inside of the logfile it is throwing an error "Failed to commit feature_builder because expected sketch not found" This is strange because the hole series gets instantiated btu this error is appearing within the log file. I've provided the code snippet for my function below.
Any ideas why this is happening and how to fix it?
Thanks.
I've been developing an NXOpen function for creating couterbore holes on a pointset using the CreateHolePackageBuilder class in the namespace wrokpart.features.CreateHolePackageBuilder. The code works except inside of the logfile it is throwing an error "Failed to commit feature_builder because expected sketch not found" This is strange because the hole series gets instantiated btu this error is appearing within the log file. I've provided the code snippet for my function below.
Any ideas why this is happening and how to fix it?
Thanks.
Code:
Private Function CreateCounterBoreHole(ByVal iPointSet As Features.PointSet, ByVal iBody As Body) As Features.Feature
Dim holePackageBuilder1 As Features.HolePackageBuilder
holePackageBuilder1 = workpart.Features.CreateHolePackageBuilder(Nothing)
holePackageBuilder1.Tolerance = 0.001
holePackageBuilder1.HolePosition.DistanceTolerance = 0.001
holePackageBuilder1.HolePosition.ChainingTolerance = 0.00095
holePackageBuilder1.GeneralHoleForm = Features.HolePackageBuilder.HoleForms.Counterbored
holePackageBuilder1.GeneralCounterboreDiameter.RightHandSide = "1.0625"
holePackageBuilder1.GeneralCounterboreDepth.RightHandSide = "0.1"
holePackageBuilder1.GeneralCounterboreHoleDiameter.RightHandSide = "0.75"
holePackageBuilder1.GeneralCounterboreHoleDepth.RightHandSide = "1.5"
holePackageBuilder1.GeneralTipAngle.RightHandSide = "118"
holePackageBuilder1.StartExtensionEnabled = True
holePackageBuilder1.HolePosition.SetAllowedEntityTypes(Section.AllowTypes.OnlyPoints)
Dim features1(0) As Features.Feature
Dim pointSet1 As Features.PointSet = iPointSet ' CType(workpart.Features.FindObject("PointSet(37)"), Features.PointSet)
features1(0) = pointSet1
Dim featurePointsRule1 As FeaturePointsRule
featurePointsRule1 = workpart.ScRuleFactory.CreateRuleFeaturePoints(features1)
holePackageBuilder1.HolePosition.AllowSelfIntersection(True)
Dim rules1(0) As SelectionIntentRule
rules1(0) = featurePointsRule1
Dim nullNXObject As NXObject = Nothing
Dim helpPoint As Point = iPointSet.GetEntities()(0)
Dim helpPoint1 As Point3d = New Point3d(helpPoint.Coordinates.X, helpPoint.Coordinates.Y, helpPoint.Coordinates.Z) 'New Point3d(-10.4393096814239, 7.58722607614455, 6.63287328868582)
holePackageBuilder1.HolePosition.AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section.Mode.Create, False)
holePackageBuilder1.BooleanOperation.Type = GeometricUtilities.BooleanOperation.BooleanType.Subtract
Dim targetBodies9(0) As Body
Dim body1 As Body = iBody ' CType(workpart.Bodies.FindObject("BLOCK(21)"), Body)
targetBodies9(0) = body1
holePackageBuilder1.BooleanOperation.SetTargetBodies(targetBodies9)
holePackageBuilder1.ParentFeatureInternal = True
Dim oHolefeature As Features.Feature = holePackageBuilder1.Commit()
holePackageBuilder1.Destroy()
Return oHolefeature
End Function