Be careful which parameters you use
I just change first argument of CreateSweepDefinition to SweepTypeEnum.kPathSweepType
Dim oApp As Inventor.Application
oApp = ThisApplication
' Obtener el documento activo (debe ser un ensamblaje o un archivo de pieza)
Dim oDoc As Inventor.PartDocument
oDoc = oApp.ActiveDocument
Dim oCompDef As Inventor.PartComponentDefinition
oCompDef = oDoc.ComponentDefinition
If Hubo_Error_Short = 1 Then
Try
Dim ShortStay As Inventor.SweepFeature
Dim staydef As Inventor.SweepDefinition
Dim oprof As Inventor.Profile
Dim opath As Inventor.Path
oprof = oCompDef.Sketches.Item("Short_Profile").Profiles.AddForSolid()
opath = oCompDef.Features.CreatePath(oCompDef.Sketches.Item("Short_Path").SketchLines.Item(4 - 3))
staydef = oCompDef.Features.SweepFeatures.CreateSweepDefinition(
SweepTypeEnum.kPathSweepType,
oprof,
opath,
PartFeatureOperationEnum.kJoinOperation
)
ShortStay = oCompDef.Features.SweepFeatures.Add(staydef)
Catch ex As Exception
' Manejar cualquier error que pueda ocurrir durante la operación de barrido
MsgBox("Error al realizar la operación de barrido: " & ex.Message)
End Try
End If