/// <summary>
        /// 编辑零部件,自动区分装配体还是零件
        /// </summary>
        /// <param name="comp">组件</param>
        /// <param name="doc">顶级文档</param>
        /// <param name="silent">静默编辑--提高速度</param>
        /// <param name="readOnly">只读</param>
        /// <returns></returns>
        public static swEditPartCommandStatus_e Edit(this IComponent2 comp, IAssemblyDoc doc, bool silent = true, bool readOnly = false)
        {
            var type = comp.GetCompType();
            int info = -1;

            switch (type)
            {
            case swDocumentTypes_e.swDocPART:
                if (comp.Select2(false, -1))
                {
                    doc.EditPart2(silent, readOnly, ref info);
                }
                break;

            case swDocumentTypes_e.swDocASSEMBLY:
                if (comp.Select2(false, -1))
                {
                    doc.EditAssembly();
                }
                info = 0;
                break;

            default:
                throw new FileFormatException(string.Format("can not edit component width type of:{0} ", type.ToString()));
            }
            swEditPartCommandStatus_e state = (swEditPartCommandStatus_e)info;

            return(state);
        }