Inventor API/VBA/I-logic modify loft feature

josiahmorgan
Explorer

Inventor API/VBA/I-logic modify loft feature

josiahmorgan
Explorer
Explorer

I am needing to write an i-logic rule that will change the center sketch of an existing surface loft feature.

I am able to create a new loft without any issues using vba in the i-logic vba.  However, when I attempt to edit centerline of the loft to use the new sketch profile, I get the following error:

Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))

 

Also, I have had no luck in trying to modify the section profiles of a loft either.

The reason I cannot create a new loft instead of modify is because there are several children features that were built using the gui which use this loft.

 

thanks.

0 Likes
Reply
Accepted solutions (1)
922 Views
2 Replies
Replies (2)

JaneFan
Autodesk
Autodesk

Hello there,

 

Please check whether it is possible to edit the sections or centerlines of a loft feature in UI with the same inputs as in API.

If it succeeds in UI, try the following steps:

1. Before edit loft feature, roll back the feature, like this: Call oLoftFeature.SetEndOfPart(True)

2. Are you editing loft feature via its definition, or editing loft feature directly?

It is recommended to edit a feature via its definition, like this:

    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
   
    Dim oP1 As Profile, oP2 As Profile, oP3 As Profile
    Set oP1 = oDoc.ComponentDefinition.Sketches(1).Profiles.AddForSolid
    Set oP2 = oDoc.ComponentDefinition.Sketches(2).Profiles.AddForSolid
    Set oP3 = oDoc.ComponentDefinition.Sketches(3).Profiles.AddForSolid
   
    Dim oCol As ObjectCollection
    Set oCol = ThisApplication.TransientObjects.CreateObjectCollection
    oCol.Add oP1
    oCol.Add oP2
   
    Dim oLoftDef As LoftDefinition
    Set oLoftDef = oDoc.ComponentDefinition.Features.LoftFeatures.CreateLoftDefinition(oCol, kJoinOperation)
   
    Dim oLoftF As LoftFeature
    Set oLoftF = oDoc.ComponentDefinition.Features.LoftFeatures.Add(oLoftDef)
   

    Call oLoftF.SetEndOfPart(True)


    Call oCol.Clear
    oCol.Add oP1
    oCol.Add oP3
    oLoftDef.Sections = oCol
    oLoftF.Definition = oLoftDef

 




Jane Fan
Inventor QA Engineer
0 Likes

josiahmorgan
Explorer
Explorer
Accepted solution

the solution was to create a new loft definition using the copy definition command, change the centerline on the NEW loft definition, then replace the loft definition on the loft feature with the new loft definition.

Apparently you cannot replace a centerline or profile within an existing loft definition, but you can replace the entire loft definition of a loft feature and it will maintain it's children dependencies.

0 Likes