Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using the MirrorElements method to mirror a door element on the other side of a wall, without copying it.
https://www.revitapidocs.com/2017/36027166-d494-9937-74c2-d61197af3878.htm
Unfortunately I am getting the error "Can't mirror an instance without its host" which does not make any sense for me. In the Revit UI, I can mirror the same door without getting this message.
Please, refer to my python code below which takes an an input a single door. You can easily copy paste this to a python node in Dynamo to reproduce the issue.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
from System.Collections.Generic import List
doc = DocumentManager.Instance.CurrentDBDocument
data = UnwrapElement(IN[0])
output=[]
ids=[]
ids.append(data.Id)
Ids = List[ElementId](ids)
from Autodesk.Revit.DB import Transaction
t = Transaction(doc, 'Name')
t.Start()
output = ElementTransformUtils.MirrorElements(doc, Ids, Plane.CreateByNormalAndOrigin(data.GetTransform().BasisY, data.Location.Point), False);
t.Commit()
OUT = output
Solved! Go to Solution.