[英]How can I flip a live section with the Revit API
I would like to be able to flip a live section using the Revit 2017 API. 我希望能够使用Revit 2017 API翻转实时部分。 It would be the equivalent of the UI feature seen in my images below.
这将等同于下面的图像中显示的UI功能。
I've tried using the built-in ElementTransformUtils.MirrorElement
but that will only create a second section marker with a second section view. 我尝试使用内置的
ElementTransformUtils.MirrorElement
但这只会创建带有第二个剖面视图的第二个剖面标记。 Is there any way that I can achieve this using the Revit API? 有什么方法可以使用Revit API做到这一点?
I got a solution to my post How can I flip a section using the Revit 2017 API on the Revit API forum. 我为我的帖子找到了解决方案如何在Revit API论坛上使用Revit 2017 API翻转部分 。 It turns out that I overlooked the plural
ElementTransformUtils.MirrorElements
function which I assumed was almost exactly the same as the singular ElementTransformUtils.MirrorElement
except for doing multiple element mirrors instead of a single mirror. 事实证明,我认为复数的
ElementTransformUtils.MirrorElements
函数与单数的ElementTransformUtils.MirrorElement
几乎完全相同,除了执行多个元素镜像而不是单个镜像。 The plural ElementTransformUtils.MirrorElements
has a bool mirrorCopies
parameter that you can set to false
which will force the original section to be mirrored instead of just making mirrored copy of the original. 复数的
ElementTransformUtils.MirrorElements
具有bool mirrorCopies
参数,您可以将其设置为false
,这将强制对原始节进行镜像,而不是仅对原始节进行镜像复制。 Here are the two function signatures side-by-side: 这是两个并排的函数签名:
void MirrorElement(
Document document,
ElementId elementToMirror,
Plane plane
);
IList<ElementId> MirrorElements(
Document document,
ICollection<ElementId> elementsToMirror,
Plane plane,
bool mirrorCopies
);
My code ends up looking like this (with elementsToMirror
only containing a single element): 我的代码最终看起来像这样(只有
elementsToMirror
只包含一个元素):
ElementTransformUtils.MirrorElements(document, elementsToMirror, mirrorPlane, false);
You need to change the CropBox
property of the ViewSection
object. 您需要更改
ViewSection
对象的CropBox
属性。 The Z components of the Min
and Max
properties should be inverted. Min
和Max
属性的Z分量应反转。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.