Data-Shape failing on selecting some families...?

Hi all,

I know this is specific to a custom node from Data-Shape, but I was wondering if anyone has ever had this issue with the input module of Data-Shape.

See screen cap: all different categories of tags work with my node, except Multi-Category, which, if selected in Revit, will produce a Null result from the Data-shape node…

Just a weird behavior. If I do not select any multi category tags, the graph works perfectly as is.
On the other hand, the category filter works while selecting tags in Revit, and the multi category tags get regularly selected.

Once clicked on “Finish”, however, the node returns “Null” as in screen shot…

Thank you

Regards

gio

hello,

after some more troubleshooting, I found out that tags tagging elements in a linked model cause the data-shape node to return a null list.

To be clear, the tags are live, but they are tagging an element in a linked model.

Any idea how to fix this?

Thank you

regards

gio

PS: maybe I should send an email to Mostafa?

I believe there is a DS node for selecting elements in a linked model. You’ll have to use a filter to separate your local elements from your linked elements and use both nodes to selecting everything you’re looking for.

Thank you Nick, but i am not sure I understand how your suggestion will help my issue.

I think this issue is the same as this one, by JacobSmall:

In that post you will also find the original script, by Dimitar, that was eventually built into the Spring node below.

It appears that unwrapping tags that are tagging elements in a link file will return a null.

Unless we use a “unkown element” unwrapping…

This is all I can say, with my limited Python knowledge.

Here is the Data-Shape input node script (from the awesome Mostafa) that is supposed to allow the user to select tags, but that returns Null if one of the tags is tagging an element in a linked model:

#Copyright (c) mostafa el ayoubi ,  2017
#Data-Shapes www.data-shapes.net , elayoubi.mostafa@gmail.com
#This node was inspired by @DanielHurtubise

class uiselectelements():

    def __init__(self,inputname,buttontext,multi):
        self.inputname = inputname
        self.buttontext = buttontext
        self.multi = multi

    def __repr__(self):
        return 'UI.SelectElements input'



class uiselectelementsofcat():

    def __init__(self,inputname,buttontext,category,multi):
        self.inputname = inputname
        self.buttontext = buttontext
        self.category = category
        self.multi = multi

    def __repr__(self):
        return 'UI.SelectElementsOfCategory input'

if IN[2] == [""]:
	x = uiselectelements(IN[0],IN[1],IN[3])
else:
	if isinstance(IN[2],list):
		catnames = ', '.join([UnwrapElement(i).Name for i in IN[2]])
		if IN[1] == "Select Model Element(s)":
			buttontext = 'Select %s' %(catnames)
		else:
			buttontext = IN[1]
	else:
		buttontext = IN[1]
		
	x = uiselectelementsofcat(IN[0],buttontext,IN[2],IN[3])


OUT = x

Here is the code of a Spring node which uses the “unknown element”
unwrapping that is supposed to solve the issue:


# Copyright(c) 2018, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
# www.badmonkeys.net

import clr

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import FilteredElementCollector, ElementMulticategoryFilter, ElementId

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

from System.Collections.Generic import List

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

views = UnwrapElement(tolist(IN[0]) )
cat = UnwrapElement(IN[1])
OUT = []

ueWrapper = None
wrappers = clr.GetClrType(Revit.Elements.ElementWrapper).GetMethods()
for w in wrappers:
	if w.ToString().startswith("Revit.Elements.UnknownElement"):
		ueWrapper = w
		break

if cat is not None:
	catId = List[ElementId]()
	for c in tolist(cat):
		catId.Add(c.Id)
	catFil = ElementMulticategoryFilter(catId)
else:
	catFil = None

for v in views:
	fec = FilteredElementCollector(doc, v.Id).WhereElementIsNotElementType()
	if catFil is not None:
		fec = fec.WherePasses(catFil)
	viewEl = []
	for e in fec:
		try:
			viewEl.append(e.ToDSType(True) )
		except:
			if ueWrapper:
				viewEl.append(ueWrapper.Invoke(None, (e, True) ) )
	OUT.append(viewEl)
	fec.Dispose()
if catFil is not None:
	catFil.Dispose()

This is all above and beyond what I can muster in the python language…

We need some hero able to improve the Data-Shape node with the “unknown element” unwrapping method…maybe?

Thank you

regards

gio