Q:
When I try to use SetToFaceExtent on a HoleFeature, then it keeps returning error. What shall I do?
A:
This is as designed. To set the Face - which is a BRep input - to the Hole Feature, the stop node has to be moved above the Hole Feature. This is required for any Feature edit that involves a BRep input. On moving the stop node above the Hole Feature the call to SetToFaceExtent succeeds even with a Face as input.
Sub SetToFaceExtentTest(ByVal app As Inventor.Application)
Try
Dim doc As PartDocument = app.ActiveDocument
Dim hf As HoleFeature = app.CommandManager.Pick(
SelectionFilterEnum.kPartFeatureFilter,
"Select hole feature:")
If hf Is Nothing Then
Return
End If
Dim face As Face = app.CommandManager.Pick(
SelectionFilterEnum.kPartFacePlanarFilter,
"Select planar face:")
If face Is Nothing Then
Return
End If
hf.SetEndOfPart(True)
hf.SetToFaceExtent(face, True)
doc.ComponentDefinition.SetEndOfPartToTopOrBottom(False)
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub