ClientFeature.AddDependency

ClientFeature.AddDependency

Anonymous
Not applicable
258 Views
0 Replies
Message 1 of 1

ClientFeature.AddDependency

Anonymous
Not applicable

Hello, 

I am trying to implement a clientfeature that needs to update when the geometry it references updates, 

from what i understand i need to set IsCustomSolved = true, and set its dependency to the reference geometry by using ClientFeature.Definition.AddDependency()

 

when i try to call AddDependency() i get a an ArgumentException when i pass it a sketch/work axis etc.

 

        public static void Main()
        {
            var app = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");
            var doc = (AssemblyDocument)app.ActiveDocument;
            var def = doc.ComponentDefinition;
            var sketch = def.Sketches[1];
            
            var clientfeaturedef = def.Features.ClientFeatures.CreateDefinition("TestFeature");
            clientfeaturedef.IsCustomSolved = true;
            var clientFeature = def.Features.ClientFeatures.Add(clientfeaturedef, "someid");
            clientFeature.Definition.AddDependency(sketch);
        }

 am i doing something wrong here?

0 Likes
259 Views
0 Replies
Replies (0)