【问题标题】:UIView.ZoomAndCenterRectangle() only works correctly when called twiceUIView.ZoomAndCenterRectangle() 仅在调用两次时才能正常工作
【发布时间】:2019-10-17 15:40:47
【问题描述】:

在调用 UIView.ZoomAndCenterRectangle() 方法时,我在 Revit 2018.2 中遇到了一些奇怪的行为。场景是我刚刚使用 3DView.CreateIsometric() 创建了一个新的 3D 视图,并且还将该 3DView 设置为 UIDocument 的 ActiveView。按照这些操作,只调用一次 UIView.ZoomAndCenterRectangle() 似乎根本不起作用。但是,如果在第一次之后立即调用它,则视图会正确缩放!

我最初的想法是,第一次 ZoomAndCenter 调用可能只占用了 3DView 完全生成和开始接收调用的足够时间,尽管这似乎不太可能,因为我的印象是 Revit 外部命令完全同步运行。无论如何,我尝试了以下代码,这会导致 500 毫秒的实际延迟:

int val = 0;
for(int i = 0; i < 500000000; i++)
{
    val += i;
}

uiView.ZoomAndCenterRectangle(max, min);
//uiView.ZoomAndCenterRectangle(max, min);

但这仍然不起作用......所以似乎出于某种奇怪的原因,您确实必须运行两次调用才能执行它:

uiView.ZoomAndCenterRectangle(max, min);
uiView.ZoomAndCenterRectangle(max, min);

我错过了什么!!??

【问题讨论】:

    标签: c# revit-api revit


    【解决方案1】:

    也许这只是某种再生问题。我最近设置了一个视图方向,在我 forced a refresh of the current view 之前没有看到任何区别。也许你也可以做类似的事情。或者,如果调用该方法两次有效,这听起来也不错,对我来说。

    【讨论】:

      猜你喜欢
      • 2016-11-08
      • 1970-01-01
      • 2018-12-10
      • 2016-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-08
      相关资源
      最近更新 更多