I’m trying to place doors and windows in a wall, at a given level.
I’ve tried using Family.InstanceByPointAndLevel, but it doesn’t seem to work for doors or windows.
I’m guessing that I’d need to specify a wall host of the family with a python node. I have found the code below on the Github forum, for placing windows, but I’m having trouble getting it to work either.
Do you have any ideas how can I make it work?
I’m using Revit 2015 and Dynamo 0.7.2
# Default imports import clr clr.AddReference('RevitAPI') clr.AddReference('RevitAPIUI') from Autodesk.Revit.DB import * import Autodesk import sys import clr path = r'C:\Autodesk\Dynamo\Core' exec_path = r'C:\Autodesk\Dynamo\Core\dll' sys.path.append(path) sys.path.append(exec_path) clr.AddReference('LibGNet') from Autodesk.LibG import * #The input to this node will be stored in the IN0...INX variable(s). wall = IN0 windowfamily = IN1 doc = IN2 uParam = 0.5 bottomToBottom = 3 locCurve = wall.Location wallLength = locCurve.Curve.Length start = locCurve.Curve.get_EndPoint(0) direction = locCurve.Curve.get_EndPoint(1) - start location = start + direction.Normalize() * wallLength * uParam #deletes the existing windows on the wall elList = wall.FindInserts(True, False, False, False) for elemId in elList: doc.Delete(elemId) famInst = doc.Create.NewFamilyInstance(location, windowfamily, wall, wall.Level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural); famInst.get_Parameter("Sill Height").Set(bottomToBottom); #Assign your output to the OUT variable OUT = famInst