Creating a Callout on a View Using Dynamo

Hello there,
I was wondering if there is a way to create a callout on a view using Dynamo.


I looked through Dynamo’s built-in nodes, external packages nodes and the API but couldn’t find anything that could be helpful.
Any help is greatly appreciated!

Hello,

Unfortunately, there is not a built-in node in Dynamo for this, but it seems there is a Revit API here for the callout creation. It requires 2 corner points(min and max point of the callout rectangle) for the callout.

Using Python, you can create a custom node for yourself.

Here is an example Python code:

Python Code for Callout Creation in Dynamo

import clr

# Import Revit API
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

# Import Revit Services
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitNodes for geometry conversion
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

parentViewId = ElementId(IN[0].Id)
viewFamilyTypeId = ElementId(IN[1].Id)
minPoint = IN[2]  # Lower-left corner of callout (DesignScript Point)
maxPoint = IN[3]  # Upper-right corner of callout (DesignScript Point)
calloutName = IN[4]  # Name of the callout view

# Access the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument

# Start a transaction
TransactionManager.Instance.EnsureInTransaction(doc)


# Convert DesignScript Points to Revit XYZ
minPointXYZ = minPoint.ToXyz()
maxPointXYZ = maxPoint.ToXyz()

# Create the callout view
callout_view = ViewSection.CreateCallout(
    doc,
    parentViewId,          # View Id that the callout will appear
    viewFamilyTypeId,      # View Family Type Id for the callout
    minPointXYZ,           # Lower-left corner
    maxPointXYZ            # Upper-right corner
)

# Set properties for the callout view
callout_view.Name = calloutName


# End the transaction
TransactionManager.Instance.TransactionTaskDone()

# Output the result
OUT = callout_view

You need to figure out an algorithm to get min and max point of the callout rectangle. After doing this, you can create a custom node for yourself by following these steps:
1- Select the python node
2- Right click on white canvas
3- Select create custom node
4- This will pop up a new window to fill some details. You can write down the details.
5- After that go inside the new custom node by double clicking on the body to edit the input/output names

This shows the inside of the custom node:


This is how it looks in the project:

I hope this will work for you.

1 Like

I will note that we need a node for this and update you when it is available :slight_smile:
FYI: @casandraarmeanu @vlad.catalina

3 Likes

archilab have one as well, we can use too until that :wink:

1 Like

Thank you! That was helpful. For some reason I missed the CreateCallout method in the API docs on revitapidocs.com. When you search for “callout”, these are the results:

There is also another method in the API that is called CreateReferenceCallout. This will create a callout for a view that already exists in the model as opposed to the CreateCallout method that will create a new view (and a callout for it) based on the bounding box supplied. You just need to supply it with the ID of the view that will be referenced by the callout.

1 Like