0

I would like to be able to flip a live section using the Revit 2017 API. It would be the equivalent of the UI feature seen in my images below.

Before After

I've tried using the built-in ElementTransformUtils.MirrorElement but that will only create a second section marker with a second section view. Is there any way that I can achieve this using the Revit API?

skeletank
  • 2,880
  • 5
  • 43
  • 75

2 Answers2

2

I got a solution to my post How can I flip a section using the Revit 2017 API on the Revit API forum. 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. 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. 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):

ElementTransformUtils.MirrorElements(document, elementsToMirror, mirrorPlane, false);
skeletank
  • 2,880
  • 5
  • 43
  • 75
0

You need to change the CropBox property of the ViewSection object. The Z components of the Min and Max properties should be inverted.

Maxence
  • 12,868
  • 5
  • 57
  • 69
  • Yes, could you please share a code sample? This was the road I was headed down before I got a response from the Revit API forums. Also, one of the people responding to my post there stated that setting `mirrorCopies` to `false` (as per my answer) didn't work for them. I'm wondering if my answer doesn't work for older versions of Revit. – skeletank Feb 14 '17 at 14:57