예제 #1
0
def window(numberoftags):
    """Result Window"""
    dialog = TaskDialog("Header")
    dialog.MainInstruction = "Results"
    dialog.MainContent = "{0} tags were switched to {1}".format(
        numberoftags, 'halftone')
    dialog.CommonButtons = TaskDialogCommonButtons.Close
    return dialog.Show()
예제 #2
0
def dialogManager():
    '''dialogbox to manage updater state from a ribbon button'''
    #scope when dialogManager is called
    doc = __revit__.ActiveUIDocument.Document

    # registering state
    app_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId())
    doc_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId(),
                                                  doc)

    # note : the global will be unregistered when the last document is unregistered
    # note2 : look at IsUpdaterEnabled and EnableUpdater/DisableUpdater too
    # note3 : enabled or not, an updater may be suspended by Revit for misbehaving

    # build the dialog box
    box = TaskDialog('Dynamic Model Updaters')
    box.MainInstruction = 'DoubleHeight Updater Manager'

    box.MainContent = '- Document Updater is :{0} Registered'.format(
        ' NOT' * (not doc_dmu))
    box.MainContent += '\n- Global Updater is :{0} Registered'.format(
        ' NOT' * (not app_dmu))

    # add command options
    if doc_dmu:
        box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,
                           'Disable document Updater')

    else:
        box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2,
                           'Enable document Updater')

    if app_dmu:
        box.AddCommandLink(TaskDialogCommandLinkId.CommandLink3,
                           'Disable all documents Updater ')

    # box.FooterText = 'Add comments in the footer'

    # close button to abort
    box.CommonButtons = TaskDialogCommonButtons.Close

    # show the dialogbox and capture the answer
    answer = box.Show()

    # 1st option : disable updater for current document
    if answer == TaskDialogResult.CommandLink1:

        doc_unregister(doc)

    # 2nd option : register the current doc
    elif answer == TaskDialogResult.CommandLink2:

        doc_register(doc)

    # 3rd option : disable updater for all opened documents
    elif answer == TaskDialogResult.CommandLink3:

        global_unregister()
예제 #3
0
def dialogManager():
    '''dialogbox to manage updater state from a ribbon button'''
    #scope when dialogManager is called
    doc = __revit__.ActiveUIDocument.Document
    
    # registering state
    app_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId())
    doc_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId(), doc)

    # note : the global will be unregistered when the last document is unregistered
    # note2 : look at IsUpdaterEnabled and EnableUpdater/DisableUpdater too 
    # note3 : enabled or not, an updater may be suspended by Revit for misbehaving
    
    # build the dialog box
    box = TaskDialog('Dynamic Model Updaters')
    box.MainInstruction  = 'DoubleHeight Updater Manager'

    box.MainContent = '- Document Updater is :{0} Registered'.format(' NOT' * (not doc_dmu))
    box.MainContent += '\n- Global Updater is :{0} Registered'.format(' NOT' * (not app_dmu))
    
    # add command options
    if doc_dmu:
        box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Disable document Updater')
        
    else :
        box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Enable document Updater')
        
    if app_dmu:
        box.AddCommandLink(TaskDialogCommandLinkId.CommandLink3, 'Disable all documents Updater ')

    # box.FooterText = 'Add comments in the footer'

    # close button to abort 
    box.CommonButtons = TaskDialogCommonButtons.Close

    # show the dialogbox and capture the answer
    answer = box.Show()

    # 1st option : disable updater for current document
    if answer == TaskDialogResult.CommandLink1:
        
        doc_unregister(doc)
        
    # 2nd option : register the current doc
    elif answer == TaskDialogResult.CommandLink2:
        
        doc_register(doc)
        
    # 3rd option : disable updater for all opened documents
    elif answer == TaskDialogResult.CommandLink3:
        
        global_unregister()
예제 #4
0
def event_handler_function(sender, args):
    print(15*"-" + "event_handler file opened" + 15*"-")
    doc = __revit__.ActiveUIDocument.Document
    now_utc = str(datetime.datetime.utcnow())
    log_path = "d:/delme/model_open_log.txt"

    if doc.IsWorkshared:
        doc_central_path = ModelPathUtils.ConvertModelPathToUserVisiblePath(doc.GetWorksharingCentralModelPath())
        doc_local_path = doc.PathName
        doc_path = doc_central_path
        in_central = doc_central_path == doc_local_path
        if in_central:
            task_dialog = TaskDialog("rvt_fixme_central_model_warning")
            task_dialog.Id = "rvt_fixme_central_model_warning"
            task_dialog.MainIcon = TaskDialogIcon.TaskDialogIconWarning
            task_dialog.Title = "Attention - you are in central model!!!"
            task_dialog.MainContent = task_dialog.Title
            task_dialog.TitleAutoPrefix = True
            task_dialog.AllowCancellation = True
            task_dialog.Show()
        model_name = op.basename(doc_path)
        model_path = op.dirname(doc_path)
        # model_central_name = model_name.split("_" + rvt_user)[0]
        model_central_name = model_name.split(".rvt")[0]
        assume_fix_tasks_dir = op.join(model_path, "RVT_fixme")
        ini = op.join(assume_fix_tasks_dir, "fixme_{}.ini".format(model_central_name))
        jsn = op.join(assume_fix_tasks_dir, "fixme_{}_ids.json".format(model_central_name))

        # print("searching for fixme: {}".format(ini))
        if op.exists(ini):
            print("- found corresponding RVT_fixme ini to this model.")
            # print(doc_path)
            # print("file was opened at {0}".format(now_utc))
            # print("ini found at: {0}".format(ini))
            if doc.IsWorkshared:
                import on_ws_model_opened
                print("- workshared model found at:\n- {0}".format(doc_path))
                # print("attempt reload")
                # reload(on_ws_model_opened)
                # print("after_reload")
                on_ws_model_opened.connect_to_rvt(ini)

        # print("searching for fixme: {}".format(jsn))
        if op.exists(jsn):
            print("- found corresponding RVT_fixme json to this model.")
            if doc.IsWorkshared:
                import on_ws_model_opened
                print("- workshared model found at:\n- {0}".format(doc_path))
                on_ws_model_opened.connect_to_rvt(jsn)

        with open(log_path, "a") as model_log:
            model_log.write("ws file was opened at \n- {0}\n-".format(now_utc))
예제 #5
0
def AppDialogShowing(sender, args):
    dialogId = args.DialogId
    promptInfo = "A Revit dialog will be opened.\n"
    promptInfo += "The DialogId of this dialog is " + dialogId + "\n"
    promptInfo += "If you don't want the dialog to open, please press cancel button"

    taskDialog = TaskDialog("Revit")
    taskDialog.Id = "Customer DialogId"
    taskDialog.MainContent = promptInfo
    buttons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel
    taskDialog.CommonButtons = buttons
    result = taskDialog.Show()
    if TaskDialogResult.Cancel == result:
        args.OverrideResult(1)
    else:
        args.OverrideResult(0)
예제 #6
0
if ii == 0: print "None"
if ii !=0: print "Total Details/Sections Modified: " + str(i)

if i == ii == 0:
    __window__.Close()
    trans.RollBack()
    TaskDialog.Show("You are amazing!  None of the Drafting Views or Sections on sheets were missing templates. You should celebrate.")
    sys.exit() 
# Get the application and document from external command data.
# app = commandData.Application.Application;
# activeDoc = commandData.Application.ActiveUIDocument.Document;

# Creates a Revit task dialog to communicate information to the user.
mainDialog = TaskDialog("SilmanApps")
mainDialog.MainInstruction = "I recommend reviewing the results before keeping them."
mainDialog.MainContent = "Click on the Revit icon on the taskbar and switch windows to view."

# Add commmandLink options to task dialog
mainDialog.AddCommandLink(Autodesk.Revit.UI.TaskDialogCommandLinkId.CommandLink1,"Undo changes?")
mainDialog.AddCommandLink(Autodesk.Revit.UI.TaskDialogCommandLinkId.CommandLink2,"Keep Changes")

# Set footer text. Footer text is usually used to link to the help document.
mainDialog.FooterText = " "

tResult = mainDialog.Show()


# If the user clicks the second command link, a simple Task Dialog 
# created by static method shows information about the active document
if Autodesk.Revit.UI.TaskDialogResult.CommandLink2 == tResult:
    trans.Commit()
예제 #7
0
This file is shared on www.revitapidocs.com
For more information visit http://github.com/gtalarico/revitapidocs
License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md
"""

# Results here: https://imgur.com/4DiPYfe

from Autodesk.Revit.UI import (TaskDialog, TaskDialogCommonButtons,
                               TaskDialogCommandLinkId, TaskDialogResult)

title = 'Task Dialog Title'
dialog = TaskDialog(title)

# Properties
dialog.MainInstruction = 'Text Header'
dialog.MainContent = 'Text Content'
dialog.FooterText = 'Footer Text'
dialog.VerificationText = 'Verification Text'
# dialog.ExpandedContent = expanded_content

# Settings
dialog.TitleAutoPrefix = False
dialog.AllowCancellation = True

# Add Button
dialog.CommonButtons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Yes

# Set Default Button
dialog.DefaultButton = TaskDialogResult.None

# Add Command Link
예제 #8
0
my_updater = MyRoomUpdater(app.ActiveAddInId)

# registering state
app_dmu = UpdaterRegistry.IsUpdaterRegistered(my_updater.GetUpdaterId())
doc_dmu = UpdaterRegistry.IsUpdaterRegistered(my_updater.GetUpdaterId(), doc)

# note : the global will be unregistered when the last document is unregistered
# note2 : look at IsUpdaterEnabled and EnableUpdater/DisableUpdater too 
# note3 : enabled or not, an updater may be suspended by Revit for misbehaving


# build the dialog box
box = TaskDialog('Dynamic Model Updaters')
box.MainInstruction  = 'DoubleHeight Updater Manager'

box.MainContent = '- Document Updater is :{0} Registered'.format(' NOT' * (not doc_dmu))
box.MainContent += '\n- Global Updater is :{0} Registered'.format(' NOT' * (not app_dmu))


# add command options
if doc_dmu:
    box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Disable document Updater')
    
else :
    box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Enable document Updater')
    
if app_dmu:
    box.AddCommandLink(TaskDialogCommandLinkId.CommandLink3, 'Disable all documents Updater ')

# box.FooterText = 'Add comments in the footer'
예제 #9
0
from Autodesk.Revit.UI import TaskDialogCommonButtons
from Autodesk.Revit.UI import TaskDialogResult
from Autodesk.Revit.UI import UIApplication

from System.Collections.Generic import *

collPipeSystems = FilteredElementCollector(doc).\
 OfCategory(BuiltInCategory.OST_PipingSystem).ToElements()

# DS now and late = Duct System
collDuctSystems = FilteredElementCollector(doc).\
 OfCategory(BuiltInCategory.OST_DuctSystem).WhereElementIsNotElementType().ToElements()
DSNameList = [i.Name for i in collDuctSystems]

newDialog = TaskDialog("Warning!")
newDialog.MainContent = "Найдено " + DSNameList.Count.ToString(
) + " систем воздуховодов.\
						\nПродолжить?"

buttons = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No
newDialog.CommonButtons = buttons
result = newDialog.Show()
if result == TaskDialogResult.No:
    TaskDialog.Show("Warning!", "Отменено")
    raise SystemExit


vfType = [i for i in FilteredElementCollector(doc).\
 OfClass(ViewFamilyType).ToElements() if i.ViewFamily.ToString() == "ThreeDimensional"]
vfType = vfType[0].Id

#view template ID for 200
my_updater = MyRoomUpdater(app.ActiveAddInId)

# registering state
app_dmu = UpdaterRegistry.IsUpdaterRegistered(my_updater.GetUpdaterId())
doc_dmu = UpdaterRegistry.IsUpdaterRegistered(my_updater.GetUpdaterId(), doc)

# note : the global will be unregistered when the last document is unregistered
# note2 : look at IsUpdaterEnabled and EnableUpdater/DisableUpdater too 
# note3 : enabled or not, an updater may be suspended by Revit for misbehaving


# build the dialog box
box = TaskDialog('Dynamic Model Updaters')
box.MainInstruction  = 'DoubleHeight Updater Manager'

box.MainContent = '- Document Updater is :{0} Registered'.format(' NOT' * (not doc_dmu))
box.MainContent += '\n- Global Updater is :{0} Registered'.format(' NOT' * (not app_dmu))


# add command options
if doc_dmu:
    box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Disable document Updater')
    
else :
    box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Enable document Updater')
    
if app_dmu:
    box.AddCommandLink(TaskDialogCommandLinkId.CommandLink3, 'Disable all documents Updater ')

# box.FooterText = 'Add comments in the footer'