【问题标题】:Revit API transform "cannot access with an instance reference"Revit API 转换“无法通过实例引用访问”
【发布时间】:2019-05-01 08:23:32
【问题描述】:

我正在尝试转换。并尝试执行和存储多个转换,但可能由于转换的静态属性而无法执行。像这样的:

Wall wall = doc.GetElement(id) as Wall;
BoundingBoxXYZ wallBoundingBox = wall.get_BoundingBox(doc.ActiveView);

//Original
Transform originalTransform = wallBoundingBox.Transform;

//Translated
Transform translatedTransform = originalTransform.CreateTranslation(wallBoundingBox.Min);

错误信息: “成员 'Transform.CreateTranslation(XYZ)' 不能通过实例引用访问,而是使用类型名称对其进行限定。”

有什么解决方法吗?

【问题讨论】:

  • 根据help.autodesk.com/view/RVT/2018/ENU/…你需要使用 Operator* - 将两个指定的变换相乘。
  • 有趣的方法!我尝试测试使用 XYZ 进行转换的方法,但似乎找不到方法,有什么见解吗?
  • 对不起,不是我用过的系统,我只是在阅读 API 参考资料...

标签: c# revit-api


【解决方案1】:

CreateTranslationTransform 类的静态成员

像这样使用它:

Transform translatedTransform 
  = Transform.CreateTranslation(
    wallBoundingBox.Min);

【讨论】:

  • 有什么办法可以将translatedTransform 存储在变量中,然后对变量执行另一次平移/旋转?
  • 它已经存储在一个变量中,在translatedTransform!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多