EngProgrammer
Aerospace
- Jan 14, 2015
- 150
Anyone have experience using ChamferBuilder. I wrote a function for the creation of a chamfer; however, in some instances the chamfer is coming in the wrong direction and needs to be flipped. This is typically done manually in NX when installing a chamfer, the designer looks at the resulting chamfer and then reverses the direction. However, in my situation with code, I don't want to have to write code in interrogate the chamfer and then reverse direction. These chamfers are being applied to hole feature, so the depth is always along the length of the hole.
Any ideas?
Here's my function:
Any ideas?
Here's my function:
Code:
Private Function CreateChamfer(ByVal iDepth As Double, ByVal iAngle As Double, ByVal iEdge As Edge) As Features.Feature
Dim chamferBuilder1 As Features.ChamferBuilder
chamferBuilder1 = workPart.Features.CreateChamferBuilder(Nothing)
chamferBuilder1.Option = Features.ChamferBuilder.ChamferOption.OffsetAndAngle
chamferBuilder1.Method = Features.ChamferBuilder.OffsetMethod.EdgesAlongFaces
chamferBuilder1.FirstOffset = iDepth.ToString()
chamferBuilder1.Angle = iAngle.ToString()
chamferBuilder1.Tolerance = 0.001
Dim scCollector1 As ScCollector
scCollector1 = workPart.ScCollectors.CreateCollector()
Dim nullEdge As Edge = Nothing
Dim edgeTangentRule1 As EdgeTangentRule
edgeTangentRule1 = workPart.ScRuleFactory.CreateRuleEdgeTangent(iEdge, nullEdge, False, 0.5, False, False)
Dim rules1(0) As SelectionIntentRule
rules1(0) = edgeTangentRule1
scCollector1.ReplaceRules(rules1, False)
chamferBuilder1.SmartCollector = scCollector1
Dim feature1 As Features.Feature
feature1 = chamferBuilder1.CommitFeature()
chamferBuilder1.Destroy()
Return feature1
End Function