Code:
Private Sub FaceGen()Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oFace As Face
Set oFace = ThisApplication.CommandManager.Pick(kPartFacePlanarFilter, "Select a planar face")
Dim oSketch As PlanarSketch
Set oSketch = oDoc.ComponentDefinition.Sketches.Add(oFace, True)
Call oSketch.Profiles.AddForSolid
Dim oBoundPatchdef As BoundaryPatchDefinition
Set oBoundPatchdef = oDoc.ComponentDefinition.Features.BoundaryPatchFeatures.CreateBoundaryPatchDefinition
Call oBoundPatchdef.BoundaryPatchLoops.Add(oSketch.Profiles.Item(1))
Dim oBoundPatch As BoundaryPatchFeature
Set oBoundPatch = oDoc.ComponentDefinition.Features.BoundaryPatchFeatures.Add(oBoundPatchdef)
Call oDoc.SelectSet.Select(oBoundPatch.SurfaceBodies.Item(1))
Call ThisApplication.CommandManager.ControlDefinitions.Item("PartTransformCmd").Execute
End Sub