Exemple #1
0
        /// <summary>
        /// Run this function after this.Document is populated. It fills two ref vars with swDocumentTypes_e.
        /// </summary>
        /// <param name="d">The document type.</param>
        /// <param name="od">The top-level document type.</param>
        private void GetTypes(ref swDocumentTypes_e d, ref swDocumentTypes_e od)
        {
            swDocumentTypes_e docT     = (swDocumentTypes_e)Document.GetType();
            ModelDoc2         overDoc  = (ModelDoc2)_swApp.ActiveDoc;
            swDocumentTypes_e overDocT = (swDocumentTypes_e)overDoc.GetType();

            if ((docT != swDocumentTypes_e.swDocDRAWING && swSelMgr != null) && swSelMgr.GetSelectedObjectCount2(-1) > 0)
            {
                Component2 comp = (Component2)swSelMgr.GetSelectedObjectsComponent4(1, -1);
                if (comp != null)
                {
                    ModelDoc2 cmd = (ModelDoc2)comp.GetModelDoc2();
                    docT = (swDocumentTypes_e)cmd.GetType();
                    prop.GetPropertyData(comp);
                    comp = null;
                }
                else
                {
                    prop.GetPropertyData(Document);
                }
            }
            else
            {
                swSelMgr = null;
                prop.GetPropertyData(Document);
            }
            d  = docT;
            od = overDocT;
        }