Dynamo Python Script - GetElement(Reference) of Text note

Hi everyone,
I am new in Dynamo and Python Script, so sorry for my mistakes.

I am trying to make a Python script in Dynamo, which is based on picking points on elements and showing the coordinates of the points and also the host element.
Everything works fine until I place a pickpoint on Text note, then I simply get “Operation failed”.
Simply when “doc.GetElement()” is assigned to text note, the script is not working.
Any sugestions?

Hi,

I don’t think a text note is an ‘Element’…

image

Unlike a wall for example…

image

It does have a position property though…

http://www.revitapidocs.com/2018/36740103-d9cb-6451-c9ff-34e6880c9eeb.htm

Hope that helps,

Mark

Thanks for your reply.
Maybe I explained it wrong - I meant a “text note”, not “text node”. I am speaking about classic text in Revit - it has it´s ID, so I assume it is an element.
image

Hey,

Apologies for that mistake…

I ran your code and it worked for me?

My only change was to remove line 32 and change ‘Vyber body’ to ‘Select Points’

Hope that helps,

Mark

image

EDIT: If I have a text note in a sheet I get an empty list…

Thank you for your help.
Unfortunately the code is still not working for me, maybe it is caused by the version of Revit or Dynamo ( I am using Revit 2018.2 and Dynamo Core 1.3.2.2480
May I ask which version of Revit and Dynamo did you use for testing?
image

Hey,

Sure, I’m on 2018.3 and 1.3.2.2480.

Here’s my version of your code…

Perhaps there is a language issue?

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

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

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import Point as dsPoint

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
UIunit = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

#points selection
selpoints = uidoc.Selection.PickObjects(Selection.ObjectType.PointOnElement, 'Select Points')

#host elements and point coordinates
prvky = []
points = []

for A in selpoints:
	prvky.append(doc.GetElement(A))
	pt = A.GlobalPoint
	points.append(dsPoint.ByCoordinates(UnitUtils.ConvertFromInternalUnits(pt.X,UIunit),UnitUtils.ConvertFromInternalUnits(pt.Y,UIunit),UnitUtils.ConvertFromInternalUnits(pt.Z,UIunit)))
#Assign your output to the OUT variable.
OUT = [prvky, points]

Thank you for your help, it is really caused by the Revit language. If I run Revit in english, the code works fine. If i run Revit in czech (/language CSY) the code show “Operation failed”.

Is there any way how to find the reason for this, or is there any idea how to solve it?

Hi,

Text note doesn’t work with other language version than English Revit in Dynamo 1.3.
This is a known bug with Dynamo 1.3. This has been corrected in Dynamo 2.0.

TextNote in French in 1.3 :
TextNote

I tried to install Dynamo 2.0.1 and it looks like the bug was not fixed yet.
Or did I miss something?


image

It is working in Dynamo 2.1

Hey,

Just in case you didn’t know, you can download the Development Builds of Dynamo here… http://dynamobuilds.com/

This allows you to use 2.1, though obviously it might have some bugs…

Hope that helps,

Mark

1 Like

Thanks a lot, Dynamo 2.1 solved the problem.