Exemple #1
0
 def _get_unique_name(self):
     """Creates a unique name for the command. This is used to uniquely identify this command and also
     to create the class in pyRevit dll assembly.
     Current method create a unique name based on the command full directory address.
     Example:
         self.direcotry = '/pyRevit.package/pyRevit.tab/Edit.panel/Flip doors.pushbutton'
         unique name = pyRevitpyRevitEditFlipdoors
     """
     uname = ''
     dir_str = self.directory
     for dname in dir_str.split(op.sep):
         name, ext = op.splitext(dname)
         if ext != '':
             uname += name
         else:
             continue
     return cleanup_string(uname)
Exemple #2
0
    def make_unique_name(cls, cmp_path):
        """Creates a unique name for the command. This is used to uniquely
        identify this command and also to create the class in
        pyRevit dll assembly. Current method create a unique name based on
        the command full directory address.
        Example:
            for 'pyRevit.extension/pyRevit.tab/Edit.panel/Flip doors.pushbutton'
            unique name would be: 'pyrevit-pyrevit-edit-flipdoors'
        """
        pieces = []
        inside_ext = False
        for dname in cmp_path.split(op.sep):
            if exts.ExtensionTypes.UI_EXTENSION.POSTFIX in dname:
                inside_ext = True

            name, ext = op.splitext(dname)
            if ext != '' and inside_ext:
                pieces.append(name)
            else:
                continue
        return coreutils.cleanup_string(exts.UNIQUE_ID_SEPARATOR.join(pieces),
                                        skip=[exts.UNIQUE_ID_SEPARATOR
                                              ]).lower()
Exemple #3
0
    def _get_unique_name(self):
        """Creates a unique name for the command. This is used to uniquely
        identify this command and also to create the class in
        pyRevit dll assembly. Current method create a unique name based on
        the command full directory address.
        Example:
            self.direcotry =
            '/pyRevit.extension/pyRevit.tab/Edit.panel/Flip doors.pushbutton'
            unique name =
            pyRevitpyRevitEditFlipdoors
        """
        uname = ''
        inside_ext = False
        dir_str = self.directory
        for dname in dir_str.split(op.sep):
            if exts.UI_EXTENSION_POSTFIX in dname:
                inside_ext = True

            name, ext = op.splitext(dname)
            if ext != '' and inside_ext:
                uname += name
            else:
                continue
        return coreutils.cleanup_string(uname)
Exemple #4
0
def _create_hook_id(extension, hook_script):
    hook_script_id = op.basename(hook_script)
    pieces = [extension.unique_name, hook_script_id]
    return coreutils.cleanup_string(exts.UNIQUE_ID_SEPARATOR.join(pieces),
                                    skip=[exts.UNIQUE_ID_SEPARATOR]).lower()