'str' object has no attribute 'Id'



you can help me fix

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

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

#Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk

#Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
from Autodesk.Revit.DB import *
from Autodesk.Revit.Creation import *
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)


doc = DocumentManager.Instance.CurrentDBDocument

FirstPoint = IN[0]
SecondPoint = IN[1]
pipetype = UnwrapElement(IN[2])
systemtype = UnwrapElement(IN[3])
level = UnwrapElement(IN[4])

LevelId = level.Id
elements =[]


for i,x in enumerate(FirstPoint):
	pipe = Autodesk.Revit.DB.Plumbing.Pipe.Create(doc, pipetype.Id, systemtype.Id, LevelId, FirstPoints[i].ToXyz(), SecoundPoint[i].ToXyz())
	elements.append(pipe.Id)
	
TransactionManager.Instance.TransactionTaskDone()

OUT = elements

You get the error because you feed the python node the names of your elements (string) instead of the elements.

Please use proper Markdown formatting for code posted:

This is also the format the Markdown formatter uses to indicate code.[6] Some variations of Markdown support “fenced code blocks” that span multiple lines of code, starting (and ending) with three backticks in a row (```).

I guess I would like you to enclose your code in three (3) backticks at start and end so that it gets recognized as such.

Thanks!

2.dyn (32.6 KB)