示例#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));
            }
        }
示例#3
0
 private void GenerateManifest()
 {
     RevitAddons.CreateManifestFile(Revit.ProductYear,
                                    Path.GetFileName(PyRevitRunnerManifestFile),
                                    "pyRevitRunner",
                                    PyRevitCloneRunner,
                                    "D49D3677-61C4-47A8-BFFF-49E6616D54C1",
                                    "PyRevitRunner.PyRevitRunnerApplication",
                                    PyRevitConsts.VendorId,
                                    addinPath: WorkingDirectory);
 }