PROTOCORE DASM StackValue error

thanks for the reply. I filled the value according to the type and the error went away, despite that, I had null result.
Here below the code - skipping the headers, import , class definition and function definitions that I did not change -:
geom = tolist(IN[0])
fam_path = IN[1]
names = tolist(IN[2])
category = tolist(IN[3])
material = tolist(IN[4])
isVoid = tolist(IN[5])
subcat = tolist(IN[6])

DEFAULT ELEVATION IS A BUILT IN PARAMETER THAT CAN BE USED HERE TO FEED HEIGHT

height = tolist(IN[7])

units = doc.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits
factor = UnitUtils.ConvertToInternalUnits(1,units)
acceptable_views = (“ThreeD”, “FloorPlan”, “EngineeringPlan”, “CeilingPlan”, “Elevation”, “Section”)
origin = XYZ(0,0,0)
str_typ = StructuralType.NonStructural
t1 = TransactionManager.Instance
temp_path = System.IO.Path.GetTempPath()
invalid_chars = System.IO.Path.GetInvalideFileNameChars()
satOpt= SATImportOptions()
satOpt.Placement = ImportPlacement.Origin
satOpt.Unit = ImportUnit.Foot
opt1 = Options()
opt1.ComputeReferences = True
SaveAsOpt = SaveAsOptions()
SaveAsOpt.OverwriteExistingFile = True

def NewForm_background(s1, name1, cat1, isVoid1, mat1, subcat1, H):
enable_mat = True
if mat1 == None: enable_mat = False
enable_subcat = True
if subcat1 == None: enable_subcat = False
# NEW BOOLEAN var TO acccess HEIGHT
enable_H = True
if H == None: enable_H = False
#
TransactionManager.ForceCloseTransaction(t1)
famdoc = doc.Application.NewFamilyDocument(fam_path)
sat_path = “%s%s.sat” % (temp_path, name1)
try:
if factor != 1:
s1 = s1.Scale(factor)
vec1 = Vector.ByTwoPoints(BoundingBox.ByGeometry(s1).MinPoint, DynPoint.Origin())
#
s1 = s1.Translate(vec1)
sat1 = Geometry.ExportToSAT(s1, sat_path)
satOpt = SATImportOptions()
satOpt.Placement = ImportPlacement.Origin
satOpt.Unit = ImportUnit.Foot
view_fec = FilteredElementCollector(famdoc).OfClass(View)
view1 = None
for v in view_fec:
if str(v.ViewType) in acceptable_views and not v.IsTemplate:
view1 = v
break
t1.EnsureInTransaction(famdoc)
satId = famdoc.Import(sat1, satOpt, view1)
opt1 = Options()
opt1.ComputeReferences = True
el1 = famdoc.GetElement(satId)
geom1 = el1.get_Geometry(opt1)
enum = geom1.GetEnumerator()
enum.MoveNext()
geom2 = enum.Current.GetInstanceGeometry()
#
HH = famdoc.FamilyManager.AddParameter
famdoc.Set(HH) = H
#
enum2 = geom2.GetEnumerator()
enum2.MoveNext()
s1 = enum2.Current
famdoc.Delete(satId)
System.IO.File.Delete(sat_path)
save_path = ‘%s%s.rfa’ % (temp_path, name1)
try: #set the category
fam_cat = famdoc.Settings.Categories.get_Item(cat1.Name)
famdoc.OwnerFamily.FamilyCategory = fam_cat
except: pass
s2 = FreeFormElement.Create(famdoc,s1)
if isVoid1:
void_par = s2.get_Parameter(BuiltInParameter.ELEMENT_IS_CUTTING).Set(1)
void_par2 = famdoc.OwnerFamily.get_Parameter(BuiltInParameter.FAMILY_ALLOW_CUT_WITH_VOIDS).Set(1)
else: #voids do not have a material values or a sub-cateogry
if enable_mat:
try:
mat_fec = FilteredElementCollector(famdoc).OfClass(Material)
for m in mat_fec:
if m.Name == mat1:
fam_mat = m
break
mat_par = s2.get_Parameter(BuiltInParameter.MATERIAL_ID_PARAM)
mat_par.Set(fam_mat.Id)
except: pass
if enable_subcat: #create and assign the sub-category:
try:
current_fam_cat = famdoc.OwnerFamily.FamilyCategory
new_subcat = famdoc.Settings.Categories.NewSubcategory(current_fam_cat, subcat1)
s2.Subcategory = new_subcat
except: pass
#
if enable_H :
try:
h_par = s2.get_Parameter(BuiltInParameter.FAMILY_WPB_DEFAULT_ELEVATION).Set(HH)
except: pass
#
TransactionManager.ForceCloseTransaction(t1)
famdoc.SaveAs(save_path, SaveAsOpt)
family1 = famdoc.LoadFamily(doc, FamOpt1() )
famdoc.Close(False)
System.IO.File.Delete(save_path)
symbols = family1.GetFamilySymbolIds().GetEnumerator()
symbols.MoveNext()
symbol1 = doc.GetElement(symbols.Current)
t1.EnsureInTransaction(doc)
if not symbol1.IsActive: symbol1.Activate()
inst1 = doc.Create.NewFamilyInstance(origin, symbol1, str_typ)
ElementTransformUtils.MoveElement(doc,inst1.Id, vec1.Reverse().ToXyz() )
TransactionManager.ForceCloseTransaction(t1)
return inst1.ToDSType(False), family1.ToDSType(False)
except:
message = (traceback.format_exc(),"")
return message
else : return message

if len(geom) == len(names) == len(category) == len(isVoid) == len(material) == len(subcat)== len (height):
return1 = map(NewForm_background, geom, names, category, isVoid, material, subcat, height)
elif len(geom) == len(names):

i did NOT add HEIGHT IN THE PADDED LIST

padded = PadLists([geom, category, isVoid, material, subcat])
p_category, p_isVoid, p_material, p_subcat = padded[1], padded[2], padded[3], padded[4], 
return1 = map(NewForm_background, geom, names, p_category, p_isVoid, p_material, p_subcat, height)

else : return1 = [(“Make sure that each geometry\nobject has a unique family name.”, “”)]
OUT = output1([i[0] for i in return1]), output1([i[1] for i in return1])

I think, wether the parameter gets in the family. It is disconnected from the geometry created with other nodes.

  • List item

Another approach may be to collect all the families in Revit and set their geometry locked to a parameter to tweak those height afterwards. I am working toward improving the ELK definitionhere, another thread.

  • List item
    Also I thought about the boundingbox, max point, …
    Sorry for the Capital bold characters …they came up like that (?)