Dynamo crash on placing generic annotation family with FamilyInstance.ByPointAndLevel

I am trying to place instances of the attached generic annotation family (Revit 2022).
I am using FamilyInstance.ByPointAndLevel, because I want the annotations to show up in floor plans.
But, consistently, dynamo crashes upon executing FamilyInstance.ByPointAndLevel.
As a workaround, I tried using FamilyInstance.ByPoint. But then the families are not showing in the floorplans as I would like to.

I am finding out that it somehow has to do with the point input. I can succesfully use Level1 and Origin point as inputs. Also Level 1 and 2 points (the origin pt and translated origin pt) works. But when using my specific list of points (which are all in the same XY plane (i.e. Z=0) then the crash occurs.

Here is a little more detail insight into the different point inputs.
Any idea why the points coming from Curve.PointAtParameter might be failing?

Funnily enough, I am encountering some strange behaviour with modeling range errors. The yellow highlighted node seems to be popping on-and-off with the error. Maybe this is where the trouble comes from.

Alternatively, is there a workaround you guys can suggest?

annotation_symbol.rfa (360 KB)

Hi,

As noted on your other post, it would be very helpful if you would post this issue to github.

Apologies I don’t have time to test it, but I think this python would do what you want using Python… It grabs all the location of a particular placed family, but we could adjust the input to take the list of points you have, let me know if you need help with that?

Hope that helps,

Mark

Thanks for your response.

Using Konrads code, with my points as input, resulted in the same crash.

Also, I have tried changing to the ‘large’ modeling range. This made the yellow error disappear, but still the same crash upon executing family placement.

By the way, I am very suspicious about the modeling range error. It seems Dynamo is confusing dots and commas? A value of 834.1654968654 should not be outside of the default modeling range, right? Same for -12034.2349283749374.

@Mark.Ackerley I submitted the issue

1 Like

Any more help is much appreciated, as Im stuck now.

Here are the files you need for reproduction.

  • revit model
  • dyn graph
  • custom node used

Acoustics.rvt (5.2 MB)
reproduction.dyn (77.6 KB)
Rectangle_at_Point_Direction.dyf (29.8 KB)

1 Like

As a workaround, does anyone know how to make generic annotation families that are placed without ByLevel placement show up in floorplans? Creating the families with ByCoordinates and ByCoordinateSystem is working, but I dont see the instances in the model …

I think this works…

# Copyright(c) 2019, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry

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

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

import System
from System import Array
from System.Collections.Generic import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)


def process_list(_func, _list):
    return map(lambda x: process_list(_func, x) if type(x) == list else _func(x), _list)

fType = UnwrapElement(IN[0])
lvl = UnwrapElement(IN[2])

def place_annotation(loc):
	return doc.Create.NewFamilyInstance(loc.ToXyz(), fType, lvl, doc.ActiveView)

try:
    errorReport = None
    TransactionManager.Instance.EnsureInTransaction(doc)
    output = process_list(place_annotation, IN[1])
    TransactionManager.Instance.TransactionTaskDone()
except:
    import traceback
    errorReport = traceback.format_exc()

if None == errorReport:
    OUT = output
else:
    OUT = errorReport

I’m not sure where they’re supposed to land, but they are created and it doesn’t crash?

Hope that helps,

Mark

Thank you @Mark.Ackerley . I will check your solution later, moved on to work on something else for the moment.

The annotations are supposed to land at the locations marked in the image underneath. The blue preview Dynamo points are the ones that are causing me the trouble, they are coming from the Curve.PointAtParameter node.

Without having looked in detail, I can see from your image that the annotations have not landed where they should. They should be visible from the Level1 Floorplan. Hence my last few questions on workarounds how to make created annotations appear in a certain floorplan.

For that issue, I have tried a clockwork node Element.SetLevel but that returned success: False. So I am also still looking to find a proper workaround.

All in all, any more help is still very welcome! But thanks so far.

Hey,

The code is using the Active view…

doc.ActiveView

if you add a line like :

viewMine = UnwrapElement(IN[3])

and

def place_annotation(loc):
	return doc.Create.NewFamilyInstance(loc.ToXyz(), fType, lvl, viewMine)

It probably works :slight_smile: Annotations are view specific, so that’s more important to you than the level in this situation.

If you want a list of views we need to do a bit more work…

2 Likes

Sorry, my bad…

# Copyright(c) 2019, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry

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

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

import System
from System import Array
from System.Collections.Generic import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)


def process_list(_func, _list):
    return map(lambda x: process_list(_func, x) if type(x) == list else _func(x), _list)

fType = UnwrapElement(IN[0])
lvl = UnwrapElement(IN[2])

def place_annotation(loc):
	return doc.Create.NewFamilyInstance(loc.ToXyz(), fType, doc.ActiveView)

try:
    errorReport = None
    TransactionManager.Instance.EnsureInTransaction(doc)
    output = process_list(place_annotation, IN[1])
    TransactionManager.Instance.TransactionTaskDone()
except:
    import traceback
    errorReport = traceback.format_exc()

if None == errorReport:
    OUT = output
else:
    OUT = errorReport

2 Likes

That’s great @Mark.Ackerley ! Thank you very much.
Still working on the other thing, but I will definitely pick this up.
Thanks a bunch

1 Like

Annotations are view specific

This is what I needed to know. I did not realize this.

I have now nested the annotation symbol inside a Generic Model family, so that it can be placed view-independently, but show up in any view (the way I want it).

Thanks so much again for your support @Mark.Ackerley

1 Like