Пример #1
0
        // managing attachments ======================================================================================
        // attach primary or given clone to revit version
        // @handled @logs
        public static void Attach(int revitYear,
                                  PyRevitClone clone,
                                  int engineVer,
                                  bool allUsers = false,
                                  bool force    = false)
        {
            // make the addin manifest file
            var engine = clone.GetEngine(engineVer);

            if (engine.Runtime)
            {
                logger.Debug(string.Format("Attaching Clone \"{0}\" @ \"{1}\" to Revit {2}", clone.Name, clone.ClonePath, revitYear));

                // remove existing attachments first
                // this is critical as there might be invalid attachments to expired clones
                Detach(revitYear, currentAndAllUsers: true);

                // now recreate attachment
                RevitAddons.CreateManifestFile(
                    revitYear,
                    PyRevitConsts.AddinFileName,
                    PyRevitConsts.AddinName,
                    engine.AssemblyPath,
                    PyRevitConsts.AddinId,
                    PyRevitConsts.AddinClassName,
                    PyRevitConsts.VendorId,
                    allusers: allUsers
                    );
            }
            else
            {
                throw new PyRevitException(string.Format("Engine {0} can not be used as runtime.", engineVer));
            }
        }
Пример #2
0
        // managing attachments ======================================================================================
        // attach primary or given clone to revit version
        // @handled @logs
        public static void Attach(int revitYear,
                                  PyRevitClone clone,
                                  int engineVer,
                                  bool allUsers = false,
                                  bool force    = false)
        {
            // make the addin manifest file
            var engine = clone.GetEngine(engineVer);

            if (engine.Runtime)
            {
                logger.Debug(string.Format("Attaching Clone \"{0}\" @ \"{1}\" to Revit {2}",
                                           clone.Name, clone.ClonePath, revitYear));
                RevitAddons.CreateManifestFile(revitYear,
                                               PyRevitConsts.AddinFileName,
                                               PyRevitConsts.AddinName,
                                               engine.AssemblyPath,
                                               PyRevitConsts.AddinId,
                                               PyRevitConsts.AddinClassName,
                                               PyRevitConsts.VendorId,
                                               allusers: allUsers);
            }
            else
            {
                throw new PyRevitException(string.Format("Engine {0} can not be used as runtime.", engineVer));
            }
        }