It seems that when a ClientFeatureDefinition includes a CombineFeature, ClientFeature.Add method produces an error. And it seems that there is a history related to this issue (Link).
For example, the following code works fine, but if we comment out line 53 and uncomment line 56, it produces an error (see the image)
Public Sub TestClientFeature()
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition
Dim oSketch As PlanarSketch
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3))
Dim oTransGeom As TransientGeometry
Set oTransGeom = ThisApplication.TransientGeometry
Dim oCircle As SketchCircle
Set oCircle = oSketch.SketchCircles.AddByCenterRadius(oTransGeom.CreatePoint2d(0, 0), 1)
Dim oPaths As ObjectCollection
Set oPaths = ThisApplication.TransientObjects.CreateObjectCollection
oPaths.Add oCircle
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid(False, oPaths)
Dim oExtrudeDef As ExtrudeDefinition
Set oExtrudeDef = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kNewBodyOperation)
Call oExtrudeDef.SetDistanceExtent(1, kNegativeExtentDirection)
Dim oExtrude1 As ExtrudeFeature
Set oExtrude1 = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)
Set oCircle = oSketch.SketchCircles.AddByCenterRadius(oTransGeom.CreatePoint2d(0.75, 0), 1)
oPaths.Clear
oPaths.Add oCircle
Set oProfile = oSketch.Profiles.AddForSolid(False, oPaths)
Set oExtrudeDef = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kNewBodyOperation)
Call oExtrudeDef.SetDistanceExtent(1, kNegativeExtentDirection)
Dim oExtrude2 As ExtrudeFeature
Set oExtrude2 = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)
Dim oTools As ObjectCollection
Set oTools = ThisApplication.TransientObjects.CreateObjectCollection
oTools.Add oExtrude2.SurfaceBodies.Item(1)
Dim oCombine As CombineFeature
Set oCombine = oCompDef.Features.CombineFeatures.Add(oExtrude1.SurfaceBodies.Item(1), oTools, kCutOperation, True)
Dim oClientDef As ClientFeatureDefinition
Set oClientDef = oCompDef.Features.ClientFeatures.CreateDefinition(, oExtrude1, oExtrude2)
' If we change the previous line to the next line, the ClientFeatures.Add method produces an error
' Set oClientDef = oCompDef.Features.ClientFeatures.CreateDefinition(, oExtrude1, oCombine)
Dim oClient As ClientFeature
Set oClient = oCompDef.Features.ClientFeatures.Add(oClientDef, "TestClientFeature1")
End Sub
I also tested it in C# and received a similar error:
It is interesting that we can create nested ClientFeatures including CombineFeature without error:
|__ ClientFeature
|__ ClientFeature
|__ CombineFeature
In the 2023 version of Inventor, the envelope feature is not needed. This is already required by later versions (2024 and 2025). I can add more. If the ClientFeature contains a Combine Feature in which the "Keep Toolbody" option is disabled, then something in the data of the modeled part is completely corrupted. It is not possible to proceed with any modeling of the part. Inventor hangs and doesn't even give any error message. Suppose you save the part file after creating such a Clientfeature, it is irreversibly damaged. In that case, it cannot be opened, and we receive the error message "Internal error in persistence operation".
Can't find what you're looking for? Ask the community or share your knowledge.