Extension of wall base

Hello,

I am trying to partition the wall into parts and extend the top only partially.
I was able to do this for a single element in this topic.

But when I connect multiple elements, I get an error. How can I modify this python script to work with multiple elements (lists)?

Hello,
what have you tried?
The script you mention was just a test for one single element.
To work with multiple parts you must learn how to use loops in python, for example:

You will probably need something like:

parts=UnwrapElement(IN[0])
faces=UnwrapElement(IN[1])

TransactionManager.Instance.EnsureInTransaction(doc)
for part,face in zip(parts,faces):
	part.SetFaceOffset(face,offset)
TransactionManager.Instance.TransactionTaskDone()

Thank you GregX,

I know very little about Python.
I have tried putting in the script you provided, but I get the error as shown in the image.
I will study the website you provided.

I will put a Python script that I have tried. Could you please let me know what you have done to fix it?
WallPartsExtension.txt (988 Bytes)

import clr

Import Element wrapper extension methods

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

Import DocumentManager and TransactionManager

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

Import RevitAPI

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

test=
parts=UnwrapElement(IN[0])
faces=UnwrapElement(IN[1])
offset=IN[2]/304.8 #decimal to imperial

TransactionManager.Instance.EnsureInTransaction(doc)
for part,face in zip(parts,faces):
part.SetFaceOffset(face,offset)
TransactionManager.Instance.TransactionTaskDone()

OUT=part.GetFaceOffset(face)*304.8

hello

I have not tried it, but how about changing it as follows?

offset=IN[2]

TransactionManager.Instance.EnsureInTransaction(doc)
for part,face,off in zip(parts,faces,offset):
    part.SetFaceOffset(face,off/304.8)
TransactionManager.Instance.TransactionTaskDone()

111205

Thanks for the reply.
It didn’t work with the error “unexpected token ‘Element’” returned.
However, I solved the problem by creating a custom node including the original Python Script.
Still, thanks for your help.