I'm placing a new face-based family instance into my Revit model with the help of the NewFamilyInstance Method (Face, XYZ, XYZ, FamilySymbol) method described here. This works fine, except the instance does not have its level set to that of the host (it's set to -1 when accessed through the API and just left blank in the UI).
I tried setting the level like such
placedInstance.LevelId = hostWall.LevelId
and following this approach also tried
placedInstance.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).Set(hostWall.LevelId);
but both throw an error saying the parameter is readonly.
Any help would be appreciated!