Search code examples
pythonrevit-apirevitrevitpythonshellpyrevit

How to pick up a certain plane in an element to mirror it?


I'm working with Revit API and the revit python shell to make a tool, and a part of the tool's operation includes mirroring the selected element(desk) shown in the screenshot.

In order to pick up a plane to mirror the desk, I'm trying to pick up a curve from the bounding box of the desk in the floor plan. However, I have a hard time to pick up a specific curve on the back side of the desk element. The direction of the plane should be consistent no matter what family the user selects.

Any idea on this?

enter image description here


Solution

  • It depends on how you define "back side of the desk element".

    That is a very "human" definition.

    Please reformulate that for the computer".

    I assume that the desk is a family instance, which has a Location property, which is actually a LocationPoint, which is equipped with a Rotation property.

    You can use that to determine the direction of the "back" edge.

    The distance of the "back" edge from the location point is also constant.

    Those two properties enable you to calculate the mirroring line.