Пример #1
0
        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");
            }
        }
Пример #2
0
        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));
        }
Пример #3
0
        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);
        }