FamilyInstance.ByPointinView - Clockwork package - Doubt

Hi there, I’ve some problems with this node and I would like to know if this node is just for one view and one family type or I could input a list of family types and a list of views. I created a script that works if I use just one view and one family type, but doen’t work if a use a list of those. I don’t know if I did sth wrong or it is the node that doesn’t accept lists.

Captura

The node doen’t accept list.

I don’t know how to solve it :frowning:

 

Does anyone have a suggested alternative to the node mentioned by the OP? I have the same question/issue. I want to place a list of items on a list of sheets. It works fine with this node if I feed in one sheet. But not with a list. Does anyone know a way around that?

If not this node, how would I loop grabbing the items from the sheet list one at a time and feeding in? Thank you.

Hi @Paul_Aubin,

By adjusting @Andreas_Dieckmann’s node a little bit, you can achieve what you are after:

Python script:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
points = UnwrapElement(IN[0])
famtype = UnwrapElement(IN[1])
views = UnwrapElement(IN[2])
elementlist = list()
counter = 0

TransactionManager.Instance.EnsureInTransaction(doc)
# make sure familysymbol is active
if famtype.IsActive == False:
	famtype.Activate()
	doc.Regenerate()
for v in views:
	temp = []
	for p in points:
		newobj = doc.Create.NewFamilyInstance(p.ToXyz(),famtype,v)
		temp.append(newobj.ToDSType(False))
	elementlist.append(temp)
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist

And a big thanks to you for the many hours of really good and educational video material :slight_smile:

4 Likes

Hi Martin:

Thank you for the reply and the kind comments about my work.

So, I Know nothing about Python, but I pasted your code in and modified my graph and it worked! Thank you!

I had almost replied back with another issue, but i figured it out before posting. The output of the Python node generated a four-level list, but I needed it to be a three-level before it worked correctly. Flatten to the rescue! Got to pay close attention to those list structures…

SO thank you again. This works like a charm now. Very pleased.

1 Like

When I am inserting a scale bar in different sheets at specific points. This is not allowing multiple instances in the same sheet in sequence but when I insert once in sheet M001 then insert in sheet M002 and then comeback in M001 it is working. When I insert one view with scale bar in M001 and then I insert second view in the same sheet M001 it is not working.

I tried by inserting above code but it is not working at all.

Hi Martin,
I’m having some trouble with your code. I need to create elements at points in sub-list index 0 on view A, and at points in sub-list index 1 on view B. Can this be done? I can’t seem to figure out how to add list Levels to the python script.

Hi @steinah6,

To utilize List@Level, it would require wrapping the python script into a costum node. If I remember correctly, this is described in the Dynamo Primer.

From your description on what you are aiming to do, it would require a little different approach in regards to the python part. The zip() function would do what you are after here, but I can’t demonstrate it right now. It would have to wait until tomorrow, unless someone else chips in :wink:

I read the primer and was able to create a custom node. But I couldn’t wrap my head around the zip() function in Python.

It can wait until tomorrow, my script works for the current view which is fine for now. Thank you!

Alright, no probs :slightly_smiling_face:

I think I found a modified .dyf that should accept lists, but I can’t download it. Post #5 here:

The link seems to be broken and is taking me here:
https://dynamobim.orgwp-content/uploads/forum-assets/eduardo-tavaresquattrod-com-br/09/22/FamilyInstance.ByPointInViewList.dyf