예제 #1
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))
예제 #2
0
 def __init__(self, source_viewid, filter_ids):
     self._source_viewid = revit.serialize(source_viewid)
     self._filter_ids = [revit.serialize(x) for x in filter_ids]
예제 #3
0
 def __init__(self, alignment, center, offset_uv):
     self._alignment = alignment
     self._center = revit.serialize(center)
     self._offset_uv = revit.serialize(offset_uv)
예제 #4
0
 def __init__(self, view_type, corner_pts, dir_orient):
     self._view_type = revit.serialize(view_type)
     self._corner_pts = [revit.serialize(x) for x in corner_pts]
     self._dir_orient = revit.serialize(dir_orient)
예제 #5
0
 def __init__(self, cropregion_curveloop, crop_bbox, is_active):
     self._cropregion_curveloop = revit.serialize(cropregion_curveloop)
     self._crop_bbox = revit.serialize(crop_bbox)
     self._is_active = is_active
예제 #6
0
 def __init__(self, source_viewid):
     self._source_viewid = revit.serialize(source_viewid)
예제 #7
0
 def __init__(self, section_box, view_orientation):
     self._section_box = revit.serialize(section_box)
     self._view_orientation = revit.serialize(view_orientation)