How to change python script out put?

All i need is to get the same input elements in the output as shown

thanks in advance

Unfortunately Python nodes can only provide one output, but you can put them all in a list and use a codeblock to divide it afterwards.

Yes, what you mentioned is exactly what i need, however i don’t know what i did wrong here ?

and here is the code if you would like to take a look

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

clr.AddReference("RevitAPI")
import Autodesk

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

elementA = UnwrapElement(IN[0])
elementB = UnwrapElement(IN[1])

doc = DocumentManager.Instance.CurrentDBDocument

results = [elementA,elementB]
TransactionManager.Instance.EnsureInTransaction(doc)

for A in elementA:
	for B in elementB:
		try:
			result = Autodesk.Revit.DB.JoinGeometryUtils.UnjoinGeometry(doc,A,B)
			results.append(result)
		except:
			pass
TransactionManager.Instance.TransactionTaskDone()
# Assign your output to the OUT variable.
OUT = [elementA,elementB]

Because your’e not providing any input into the node, it’s trying to iterate over the Null (None in Python) input for both elementA (and also elementB, but this error is at the first for loop).

If you have a nothing, you can’t pull an item out of it.

A similar issue would occur if you passed a single item into the input.

You’ll want to add error handling to ensure these issues don’t happen to users, or build the graph in a way where the items would have to exist and couldn’t be single items but always items in a list.

2 Likes

Thanks

1 Like

Hello this is Gulshan Negi
Well, changing the output of a Python script can be done using various methods. The most common method is using the print() function to display text, variables, or expressions in the console or terminal. Another method is writing to a file using the built-in open() function to create a file and the write() method to write data to the file.
I hope it will help you.
Thanks