private void SelectButton_Click(object sender, EventArgs e) { Inventor.ReferenceKeyManager rkm = m_app.ActiveDocument.ReferenceKeyManager; string context, key; GetContextAndKey(ReferenceKeysTreeView.SelectedNode, out context, out key); int i = GetContextIndex(context); try { byte[] bytes = new byte[] { }; rkm.StringToKey(key, ref bytes); object matchType; dynamic result = rkm.BindKeyToObject(ref bytes, i, out matchType); if (result.GetType() == Type.GetType("Invenor.ObjectCollection")) { m_app.ActiveDocument.SelectSet.SelectMultiple(result); } else { m_app.ActiveDocument.SelectSet.Select(result); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Could not bind key to object"); } }
private int LoadContext(string context) { Inventor.ReferenceKeyManager rkm = m_app.ActiveDocument.ReferenceKeyManager; byte[] bytes = new byte[] { }; rkm.StringToKey(context, ref bytes); return(rkm.LoadContextFromArray(ref bytes)); }
private byte [] GetContextBytes(string context) { byte[] bytes = new byte[] { }; context = GetContextString(context); Inventor.ReferenceKeyManager rkm = m_app.ActiveDocument.ReferenceKeyManager; rkm.StringToKey(context, bytes); return(bytes); }