Exemple #1
0
def get_keynote_pcommands():
    return list(
        reversed([
            x for x in coreutils.get_enum_values(UI.PostableCommand)
            if str(x).endswith('Keynote')
        ]))
Exemple #2
0
def get_apptelemetry_event_types():
    return list(coreutils.get_enum_values(EventType))
Exemple #3
0
    def _setup_event_telemetry_checkboxes(self):
        supportedEvents = EventUtils.GetSupportedEventTypes()
        for event_type in coreutils.get_enum_values(EventType):
            # verify event type is supported in telemetry system
            # grab the two parts of the event type name
            api_name, api_event = str(event_type).split('_')

            # figure out the namespace
            api_namespace = 'Autodesk.Revit.ApplicationServices.'
            if api_name in ['UIApplication', 'AddInCommandBinding']:
                api_namespace = 'Autodesk.Revit.UI.'

            # figure out the ui title
            api_title = api_event
            api_obj = api_name + '.' + api_event

            cbox = Controls.CheckBox()
            cbox.Margin = Windows.Thickness(0, 10, 0, 0)
            cbox.FontFamily = Windows.Media.FontFamily("Consolas")
            cbox.IsChecked = False
            tblock = Controls.TextBlock()
            tblock.Margin = Windows.Thickness(0, 2, 0, 0)
            # if event does not have interesting telemetry data, hide from user
            if event_type in [
                    EventType.AddInCommandBinding_BeforeExecuted,
                    EventType.AddInCommandBinding_CanExecute,
                    EventType.AddInCommandBinding_Executed,
                    EventType.Application_JournalUpdated
            ]:
                cbox.IsEnabled = False
                cbox.Visibility = Windows.Visibility.Collapsed

            # if the event type is not supported in running revit, inform user
            elif event_type not in supportedEvents:
                cbox.IsEnabled = False
                tblock.Inlines.Add(
                    Documents.Run("{}\n".format(' '.join(
                        coreutils.split_words(str(api_title))))))
                tblock.Inlines.Add(
                    Documents.Run("Not Supported in this Revit Version\n"))

            # if event is JournalCommandExecuted, create better user interface
            elif event_type == EventType.Application_JournalCommandExecuted:
                tblock.Inlines.Add(Documents.Run("Command Executed\n"))
                tblock.Inlines.Add(
                    Documents.Run(
                        "Event Type:               journal-command-exec\n"))
                tblock.Inlines.Add(
                    Documents.Run(
                        "Tracks execution of commands from active journal file. Includes:\n"
                    ))
                tblock.Inlines.Add(
                    Documents.Run(
                        "  Builtin Commands (e.g. ID_OBJECTS_WALL)\n"))
                tblock.Inlines.Add(
                    Documents.Run(
                        "  Thirdparty Commands (e.g. CustomCtrl_%CustomCtrl_%Site Designer%Modify%Sidewalk)\n"
                    ))
                tblock.Inlines.Add(
                    Documents.Run(
                        "  pyRevit Commands (e.g. CustomCtrl_%CustomCtrl_%pyRevit%pyRevit%Settings)\n"
                    ))

            # otherwise prepare the option for the event type
            elif event_type in supportedEvents:
                tblock.Inlines.Add(
                    Documents.Run("{}\n".format(' '.join(
                        coreutils.split_words(str(api_title))))))
                tblock.Inlines.Add(Documents.Run("API Event Type:           "))
                hyperlink = Documents.Hyperlink(Documents.Run(api_obj + "\n"))
                hyperlink.NavigateUri = \
                    System.Uri(apidocs.make_event_uri(api_namespace + api_obj))
                hyperlink.Click += self.handle_url_click
                tblock.Inlines.Add(hyperlink)
                tblock.Inlines.Add(
                    Documents.Run("pyRevit Event/Hook Name:  {}".format(
                        EventUtils.GetEventName(event_type))))
            cbox.Content = tblock
            self.event_telemetry_sp.Children.Add(cbox)
Exemple #4
0
        sheetnum_repr = repr(str(sheet.SheetNumber).encode("utf-8"))
        if coreutils.has_nonprintable(sheetnum):
            output.print_md('**{}**: Unicode: {}  Bytes: {}'.format(
                sheet.SheetNumber, repr(sheetnum), sheetnum_repr))

elif selected_switch == 'External Services':
    BExtSer = DB.ExternalService.ExternalServices.BuiltInExternalServices
    props = [x for x in dir(BExtSer) if 'Service' in x]
    bisrvids = {x: getattr(BExtSer, x).Guid for x in props}
    output.print_md('## Builtin Services')
    for bisrv, bisrvid in bisrvids.items():
        print('{} | {}'.format(bisrvid, bisrv))

    output.print_md('## Registered External Services')
    for esvc in DB.ExternalService.ExternalServiceRegistry.GetServices():
        output.insert_divider()
        output.print_md('{} | **{}**\n\n{} (by {}) (Builtin: {})'.format(
            esvc.ServiceId.Guid, esvc.Name, esvc.Description, esvc.VendorId,
            esvc.ServiceId.Guid in bisrvids))
        for sid in esvc.GetRegisteredServerIds():
            server = esvc.GetServer(sid)
            print('{} | {} ({}) (Builtin: {})'.format(sid, server.GetName(),
                                                      server.GetDescription(),
                                                      sid in bisrvids))

elif selected_switch == 'Builtin Categories with No DB.Category':
    for bic in coreutils.get_enum_values(DB.BuiltInCategory):
        dbcat = revit.query.get_category(bic)
        if not dbcat:
            print(bic)