コード例 #1
0
def sendKey(sender, args):
    global elements
    if script.get_envvar(SYNC_VIEW_ENV_VAR):
        event_doc = sender.ActiveUIDocument.Document
        uiapp = UIApplication(event_doc.Application)
        while True:
            if len(get_selected_elements(event_doc)) == 1:
                time.sleep(1)
                # TaskDialog.Show("Count Total", str(len(elements)))
                #TaskDialog.Show("Count Current", str(len(get_selected_elements(doc))))
                #time.sleep(1)
                # SendKeys.SendWait("+{K}")

                break
            else:
                return
        # TaskDialog.Show("Count 1", str(len(elements)))

        revit.get_selection().set_to(elements[1:])
コード例 #2
0
ファイル: script.py プロジェクト: BimRoss/pyRevit
def applyzoomstate(sender, args):
    if script.get_envvar(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, DB.ViewPlan):
            project_name = op.splitext(op.basename(event_doc.PathName))[0]
            data_filename = project_name + '_pySyncRevitActiveViewZoomState'
            data_file = script.get_instance_data_file(data_filename)
            f = open(data_file, 'r')
            p2 = pl.load(f)
            p1 = pl.load(f)
            f.close()
            vc1 = DB.XYZ(p1.x, p1.y, 0)
            vc2 = DB.XYZ(p2.x, p2.y, 0)
            current_ui_view.ZoomAndCenterRectangle(vc1, vc2)
コード例 #3
0
def copy_zoomstate(sender, args):
    """Copy zoom state to data file"""
    try:
        # if syncinc is active, and current view is supported
        if script.get_envvar(SYNC_VIEW_ENV_VAR) and \
                isinstance(args.CurrentActiveView, SUPPORTED_VIEW_TYPES):
            event_uidoc = sender.ActiveUIDocument
            event_doc = sender.ActiveUIDocument.Document
            active_ui_views = event_uidoc.GetOpenUIViews()

            # find current uiview
            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 not current_ui_view:
                return

            # get zoom corners
            cornerlist = current_ui_view.GetZoomCorners()
            # and save the info
            f = open(get_datafile(event_doc), 'w')
            try:
                # dump current view type
                pl.dump(type(args.CurrentActiveView).__name__, f)
                # dump zoom and center
                pl.dump([revit.serialize(x) for x in cornerlist], f)
                # dump ViewOrientation3D
                if isinstance(args.CurrentActiveView, DB.View3D):
                    orientation = args.CurrentActiveView.GetOrientation()
                    pl.dump(revit.serialize(orientation), f)
                elif isinstance(args.CurrentActiveView, DB.ViewSection):
                    direction = args.CurrentActiveView.ViewDirection
                    pl.dump(revit.serialize(direction), f)
            except Exception as copy_ex:
                logger.dev_log("copy_zoomstate::store", str(copy_ex))
            finally:
                f.close()
    except Exception as ex:
        logger.dev_log("copy_zoomstate::", str(ex))
コード例 #4
0
def copyzoomstate1(sender, args):
    if script.get_envvar(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, DB.ViewPlan):
            project_name = op.splitext(op.basename(event_doc.PathName))[0]
            data_filename = project_name + '_pySyncRevitActiveViewZoomState'
            data_file = script.get_instance_data_file(data_filename)

            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()

        logFile = open(
            "\\\\stvgroup.stvinc.com\\p\\NYNY\\Practices\\Hazem Kahla\\RevitLogs\\"
            + str(datetime.date.today()) + "_" +
            str(sender.ActiveUIDocument.Document.Application.Username) +
            ".txt", "w")
        logFile.write(
            str(datetime.datetime) + "_" + "LouM" + "_" + "Log Start")
        logFile.close()
コード例 #5
0
ファイル: script.py プロジェクト: FNXE/pyRevit
def copyzoomstate(sender, args):
    try:
        if script.get_envvar(SYNC_VIEW_ENV_VAR) and \
                isinstance(args.CurrentActiveView, SUPPORTED_VIEW_TYPES):
            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 not current_ui_view:
                return

            cornerlist = current_ui_view.GetZoomCorners()

            f = open(get_datafile(event_doc), 'w')
            try:
                pl.dump(type(args.CurrentActiveView).__name__, f)
                # dump zoom and center
                pl.dump(revit.serializable.serialize_list(cornerlist), f)
                # dump ViewOrientation3D
                if isinstance(args.CurrentActiveView, DB.View3D):
                    orientation = args.CurrentActiveView.GetOrientation()
                    pl.dump(revit.serializable.ViewOrientation3D(orientation),
                            f)
                elif isinstance(args.CurrentActiveView, DB.ViewSection):
                    direction = args.CurrentActiveView.ViewDirection
                    pl.dump(revit.serializable.XYZ(direction), f)
            except Exception:
                pass
            finally:
                f.close()
    except Exception:
        pass
コード例 #6
0
def isEvenHandlerAdded():
    return script.get_envvar(AUTO_WORKSET_SET_EVENTADDED)
コード例 #7
0
def isOn():
    return script.get_envvar(AUTO_WORKSET_SET)
コード例 #8
0
def togglestate1():
    new_state = not script.get_envvar(SYNC_VIEW_ENV_VAR)
    script.set_envvar(SYNC_VIEW_ENV_VAR, new_state)
    script.toggle_icon(new_state)
コード例 #9
0
def toggle_minifyui(config):
    new_state = not script.get_envvar(MINIFYUI_ENV_VAR)
    script.set_envvar(MINIFYUI_ENV_VAR, new_state)
    script.toggle_icon(new_state)
    update_ui(config)
コード例 #10
0
ファイル: script.py プロジェクト: Melca-G/Aeolus
def PopWindow(sender, args):
    global elements
    if script.get_envvar(SYNC_EXPLODE_ENV_VAR):
        TaskDialog.Show("Test", "Idle")
コード例 #11
0
ファイル: script.py プロジェクト: Melca-G/Aeolus
def togglestate():
    new_state = not script.get_envvar(SYNC_EXPLODE_ENV_VAR)
    script.set_envvar(SYNC_EXPLODE_ENV_VAR, new_state)
    script.toggle_icon(new_state)