Hello! I am trying to place a family instances above all doors in the project. The problems is that familes created via API does not have ‘Levels’ parameter - iam forced to set New host manualy. And i cant change builtinparameter FAMILY_LEVEL_PARAM because it is read-only(but it should be writeable). Is there any solution for this task? Thx for help…
created with API(elements binds to lowest level):
created manualy:
Python code:
# -*- coding: UTF-8 -*- import clr clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * clr.AddReference('RevitAPIUI') from Autodesk.Revit.UI import * curview = uidoc.ActiveGraphicalView doors = FilteredElementCollector(doc,curview.Id).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType().ToElements() blocks = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).WhereElementIsElementType().ToElements() for block in blocks: fam_name = block.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString() if fam_name == 'ARG_2D_ПеремичкаГазобетон': block_type=block break TransactionManager.Instance.EnsureInTransaction(doc) for i in doors: level = i.LevelId if block_type != None: p = i.Location.Point v2 = i.HandOrientation block_type.Activate() newdet=doc.Create.NewFamilyInstance(p, block_type, v2, doc.GetElement(level), Structure.StructuralType.NonStructural) offset = newdet.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM) offset.Set(0) #newdet.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).Set(level) - does not work!! TransactionManager.Instance.TransactionTaskDone()