Пример #1
0
def copyzoomstate(sender, args):
    if get_pyrevit_env_var(SYNC_VIEW_ENV_VAR):
        event_uidoc = sender.ActiveUIDocument
        event_doc = sender.ActiveUIDocument.Document
        active_ui_views = event_uidoc.GetOpenUIViews()
        current_ui_view = None
        for active_ui_view in active_ui_views:
            if active_ui_view.ViewId == args.CurrentActiveView.Id:
                current_ui_view = active_ui_view

        if isinstance(args.CurrentActiveView, ViewPlan):
            project_name = op.splitext(op.basename(event_doc.PathName))[0]
            data_file = this_script.get_instance_data_file(
                project_name + '_pySyncRevitActiveViewZoomState')

            cornerlist = current_ui_view.GetZoomCorners()

            vc1 = cornerlist[0]
            vc2 = cornerlist[1]
            p1 = Point()
            p2 = Point()
            p1.x = vc1.X
            p1.y = vc1.Y
            p2.x = vc2.X
            p2.y = vc2.Y

            f = open(data_file, 'w')
            pl.dump(p1, f)
            pl.dump(p2, f)
            f.close()
Пример #2
0
def togglestate():
    new_state = not get_pyrevit_env_var(SYNC_VIEW_ENV_VAR)
    set_pyrevit_env_var(SYNC_VIEW_ENV_VAR, new_state)
    on_icon = this_script.get_bundle_file('on.png')
    off_icon = this_script.get_bundle_file('off.png')
    if new_state:
        this_script.ui_button.set_icon(on_icon)
    else:
        this_script.ui_button.set_icon(off_icon)
Пример #3
0
def applyzoomstate(sender, args):
    if get_pyrevit_env_var(SYNC_VIEW_ENV_VAR):
        event_uidoc = sender.ActiveUIDocument
        event_doc = sender.ActiveUIDocument.Document
        active_ui_views = event_uidoc.GetOpenUIViews()
        current_ui_view = None
        for active_ui_view in active_ui_views:
            if active_ui_view.ViewId == args.CurrentActiveView.Id:
                current_ui_view = active_ui_view

        if isinstance(args.CurrentActiveView, ViewPlan):
            project_name = op.splitext(op.basename(event_doc.PathName))[0]
            data_file = this_script.get_instance_data_file(
                project_name + '_pySyncRevitActiveViewZoomState')
            f = open(data_file, 'r')
            p2 = pl.load(f)
            p1 = pl.load(f)
            f.close()
            vc1 = XYZ(p1.x, p1.y, 0)
            vc2 = XYZ(p2.x, p2.y, 0)
            current_ui_view.ZoomAndCenterRectangle(vc1, vc2)
Пример #4
0
def togglestate():
    new_state = not get_pyrevit_env_var(SYNC_VIEW_ENV_VAR)
    set_pyrevit_env_var(SYNC_VIEW_ENV_VAR, new_state)
    this_script.toggle_icon(new_state)