Python Warning :Object has no attribute 'GeometryCurve'

#1

Hi guys,

When i use select model element a detail line —> Script run good.
But when i use script to create detail line —> Script warning in Python Node.
What can i edit this warning ?

Warning and Python Code


Many thank

0 Likes

#2

Hi @mr.engineer.aec,

With the DetailCurve.ByCurve node, you obtain a list of one element.
list
Your script can’t iterate on a list of lines.
You can use the FirstItem node after the DetailCurve.ByCurve node or modify the script.

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

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument

lines = UnwrapElement(IN[0])
if not hasattr(lines, '__iter__'):
	lines = [lines]
	
elements= UnwrapElement(IN[1])
if not hasattr(elements, '__iter__'):
	elements = [elements]

elementsRef = ReferenceArray()
for element in elements:
	elementsRef.Append(Reference(element))
	
TransactionManager.Instance.EnsureInTransaction(doc)
for line in lines:
	dim = doc.Create.NewDimension(doc.ActiveView, line.GeometryCurve, elementsRef).ToDSType(True)
TransactionManager.Instance.TransactionTaskDone()

OUT=dim

There is a package with a dozen of nodes to dimension. It will be much easier.

2 Likes

#3

Hi @Alban_de_Chasteigner .

Thank for your help.
I used first item node and script is ran.
I will test your idea package “Genius Loci”
Thank you so much.

0 Likes

#4

Hi @Alban_de_Chasteigner
I can’t search “Dimension By References” node in Genius Loci Packages. in 2018.9.5 Version
How can i search ?

Dynamo 1.3.3
Package Genius Loci 2018.9.5

0 Likes

#5

Hi,

Please update to the latest version of the package (2019.3.11).
It’s compatible with Dynamo 1.3 if it’s your concern.

1 Like