Document.ReferenceKeyManager.BindKeyToObject trouble

Document.ReferenceKeyManager.BindKeyToObject trouble

Anonymous
Not applicable
841 Views
3 Replies
Message 1 of 4

Document.ReferenceKeyManager.BindKeyToObject trouble

Anonymous
Not applicable

 

Fighting with the transient nature of faces I ran in to a few probs trying to use the API documentation on the ReferenceKeyManager Interface, that seems a little out of touch regarding parameters. This is my best go trying to implement the example from the docs into C# in an iteration over 6 faces that changes. The actual parameters seems to differ from the documentation, thus a few code changes, but this  works fine through the first iteration, but breaks when the number of faces change after the first iteration & then calling the BindKeyToObject giving me an argumentexception : Parameter is incorrect. The keyContext seems to be dynamic, but I asume that´s how it´s supposed to be.  myDoc & myComp are trivial, & the solutionnature is unique also in the iteration that breaks. As I understand this should be the correct procedure to reference faces that change.
Any clues? Thx in advance! ( WIN 7 64b, INV 2010, VS C# 2010 )

List<byte[]> refKeys = new List<byte[]>(); List<byte[]> contextDatas = new List<byte[]>(); for (int i = 1; i <= 6; i++) { byte[] refKey = new byte[0]; byte[] contextData = new byte[0]; int keyContext = myDoc.ReferenceKeyManager.CreateKeyContext(); myComp.SurfaceBodies[1].Faces[i].GetReferenceKey(ref refKey, keyContext); myDoc.ReferenceKeyManager.SaveContextToArray(keyContext, ref contextData); refKeys.Add(refKey); contextDatas.Add(contextData);
} for (int i = 0; i <= 5; i++)
{ byte[] contextData = contextDatas[i]; byte[] refKey = refKeys[i]; int keyContext = myDoc.ReferenceKeyManager.LoadContextFromArray(ref contextData); object solutionnature; Face theFace = (Face)myDoc.ReferenceKeyManager.BindKeyToObject(ref refKey, keyContext, out solutionnature); // CODE THAT MAKES A SKETCH DEFINED BY THE FACE & MAKES A FEATURE THAT CHANGES THE FACE
 }

 

 

0 Likes
842 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Well after a weeks try & error & patiently waiting for a reply on this thread I found the solution by chance & would like to share it with anybody stuck in C#, inv2010, Breps and an outdated API documentation:

 

object solutionnature = null;

 

 

Message 3 of 4

JarFu
Autodesk
Autodesk

Thanks for the reporting and workaround! We've received your problem report and accepted it as an internal bug INVGEN-28967.  Will let you know once there is any update for it.



Jar Fu
SW Engineer
Inventor QA
Autodesk, Inc.
0 Likes
Message 4 of 4

dylanTEV9W
Advocate
Advocate

I have the exact same problem tried the workaround it didn't fix the problem for me. Please fix this soon I've already wasted three hours trying to get around this issue. 

0 Likes