Place Generic Annotation by point in Family Editor

Hello guys,

I initially wanted to place Generic Annotations in a project (in a view per se) which worked great. I then tried to use this script in the family editor but it doesn’t create the Generic Annotation in the family. I need help to see what i may be doing wrong. I know that projects and families see the Generic Annotation differently but i am not sure what node i’m using that is incorrect.

I really appreciate the help from yall. Thank you.

@Nick_Boyts or @AmolShah sorry to bother yall, do you guys have any idea what i could be doing wrong here?

Is your image of placing them in the project or the family? Does Dynamo show that they’re placed but then they don’t exist in the family? Have you made sure annotation categories are visibile?

2 Likes

And also you need to use document.FamilyCreate property:

https://www.revitapidocs.com/2021.1/693b2a55-b3a2-5d18-fcc4-e24448a16039.htm

1 Like

Hello nick. I have the generic annotation loaded into the family and yes i’m trying to have this work in the family editor vs the project file. In the project file this script works beautifully. The generic annotations are placed exactly where they need to be. However in the family editor this script doesnt work. It DOES find the cad text and it does find the points but it doesn’t place the generic annotation in that spot. I can show you the way it looks with it working in the project vs the family editor if you would like.

forgot to add that yes the generic annotation are on and visible. i can add one no problem through the ribbon.

Hello Kulkul. Thank you for letting me know about this. I clicked on the link. Which of these would i use in the python script node? Is it just a copy paste or does it need more than just what is in each of those code strings?

Is this where this would go?

From what i understand from the image:
The IN[0] is the Family Type.
The IN[1] is the point at which i need this family to go.

How do i do this? All your wisdom is appreciated, i’m trying to step up my Python game and am struggling.

Nope!
Try to search on forum how to use this method you will find many examples of it.

2 Likes

will do. thank you

Hello Kulkul,

I don’t know if i am searching for the wrong term, however i cannot find anything that would point me to the right types of examples. I am seeing something called zero touch nodes, ive mostly now looking at dynamo primer and trying to figure out how to use c# or c++ or visual basic as a means to get where i need to go.

Wondering if this is the right path? If you have any leads, or keywords, that you could point me towards so i can learn i would really appreciate it. I’m still struggling to find a way to use the method you pointed out.

Sure thing @DaftPooch
https://forum.dynamobim.com/search?q=FamilyCreate

1 Like

I think i’m close. I found a good starting point. I found someone that was doing something similar in the search you provided. Although this is a Structural Framing Family. The family i am working in is a Detail Item Family. So when i run this it gives me the following error code:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 21, in
TypeError: expected FamilySymbol, got List[object]

I am hoping you can give me some direction.

Could you show me your Dynamo graph.

1 Like

Yes, i’m sorry about the wait.

Do these changes:

1 Like

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 21, in
TypeError: expected StructuralType, got Level

I’m now getting this error. Here is what the script looks like now:

Does the line:

elementlist.append.(newobj.ToDSType(False))

is that “SType” the - structural type it is referring to?

The error you are getting is because of the inputs on the NewFamilyInstance() method; that is an overloaded method (meaning the method can be executed with various different inputs). See the list in the API docs; the script is throwing an error because your first two inputs match the following: NewFamilyInstance(XYZ, FamilySymbol, StructuralType)

Try replacing your level input with the View to use the NewFamilyInstance(XYZ, FamilySymbol, View) method.

Here is a good explanation of what “ToDSType(False)” is doing in your script :slightly_smiling_face:

3 Likes

Ok. Thank you all for your help. This was a hecking learning experience. As per the usual standard i will share what i learned.

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])
view = UnwrapElement(IN[2])
elementlist = list()
counter = 0
TransactionManager.Instance.EnsureInTransaction(doc)
for point in points:
	newobj = doc.FamilyCreate.NewFamilyInstance(point.ToXyz(),famtype,view)
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist

The " NewFamily(XYZ, FamilySymbol, View) " was the way to go.

I want to thank all of you for the help and motivation to figure this out myself (although i wouldn’t of been able to do it without the advice from yall). It was the push i needed to get my feet wet and understand the python code a bit better. I definitely have a long way to go before i feel comfortable writing PC from scratch. Thank you.

edit: i fixed the code so its copy pastable as mentioned below. I will also make this the solution. Thank you again guys.

1 Like

If your script is functioning, then your post should be marked as the solution! If you would, edit your post so your Python script is formatted as code (select the script and hit the </> in the text editor). Glad you finally got it sorted! :slightly_smiling_face:

3 Likes