Hi, I would like to make a sweeping using sketches already made in the file. There is no problem to define the profile, but i don't manage to create the path. The two sketches are planar and not in the same plane.
Where is the mistake ? Thanks you.
Public Sub Sweep()
' Set a reference to the currently active document.
' This assumes that it is a part document.
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
' Set a reference to the component definition.
Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition
' Create a profile.
Dim oSketch1 As PlanarSketch
Set oSketch1 = oCompDef.Sketches.Item(1)
Dim oProfile As Profile
Set oProfile = oSketch1.Profiles.AddForSolid
' Create a path.
Dim oSketch2 As PlanarSketch
Set oSketch2 = oCompDef.Sketches.Item(2)
Dim oPath As Path
Set oPath = oCompDef.Features.CreatePath(oSketch2)
'Create the sweep feature.
Dim oSweep As SweepFeature
Set oSweep = oCompDef.Features.SweepFeatures.AddUsingPath(oProfile, oPath, kJoinOperation)
End Sub