Creating FamilyInstance. Problem with setting level parameter

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
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
from Autodesk.Revit.DB import *
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_ПеремичкаГазобетон':
for i in doors:
	level = i.LevelId
	if block_type != None:
		p = i.Location.Point
		v2 = i.HandOrientation
		newdet=doc.Create.NewFamilyInstance(p, block_type, v2, doc.GetElement(level), Structure.StructuralType.NonStructural)
		offset = newdet.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM)
		#newdet.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).Set(level)   -  does not work!!

Hi Dmytro,

maybe, that value depends on other object, related to the family. Do you have some property that return other table to explore it?

Hi, franciscopossetto!
I can use any other families even with simple extrude body and result is the same.

Have you trying with other newFamilyInstance definition? the one that not specificate the level? Just to be sure that’s not a problem with the method. Maybe you can set the level on that way. Just an idea.

Same result with any other methode… Parameter is read-only

Could you share the error?

Thx for trying to help, the error is:

IronPythonEvaluator.EvaluateIronPythonScript операция не выполнена.
Traceback (most recent call last):
File “”, line 32, in
Exception: The parameter is read-only.

Is weird, should works.Could you share the family? I can try here and see in RevitLookup.

Ofcourse, it is simple generic model family
ARG_2D_ПеремичкаГазобетон.rfa (348 KB)

I tried with R2019 and the result is different:

I wonder if Schedule LEvel and Work Plane represents your two parameter “Host” and “Level”?