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.
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?
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?
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.
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]
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.
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.
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!