Can't create ClientFeature

Can't create ClientFeature

Maxim-CADman77
Advisor Advisor
351 Views
1 Reply
Message 1 of 2

Can't create ClientFeature

Maxim-CADman77
Advisor
Advisor

I've tried several samples devoted to creation ClientFeature and still can't create any one.

 

For example

https://forums.autodesk.com/t5/forums/postpage/board-id/120?interaction_style=forum&catId=70&boardId...

Gives me  "Compile error: Syntax error"

 

(I run Inventor, create IPT, open build-in VB Editor, create new module, paste the code and press Run).

What I'm missing?

 

Thanks in advance.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Accepted solutions (1)
352 Views
1 Reply
Reply (1)
Message 2 of 2

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Maxim-CADman77,

 

Hoping that below VBA code would help to add client feature in a PartDocument.

Public Sub Main()

    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As PartComponentDefinition
    Set oDef = oDoc.ComponentDefinition
    
    Dim oClientFeatDef As ClientFeatureDefinition
    Set oClientFeatDef = oDef.Features.ClientFeatures.CreateDefinition()
    
    Dim oClientFeat As ClientFeature
    Set oClientFeat = oDef.Features.ClientFeatures.Add(oClientFeatDef, "MyNode")
    
    oClientFeat.Name = "Testing"
    
End Sub

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes