Material Paint Multiple Wall Surfaces

python
dynamo
revit
#1

I’m having difficulty with the syntax of this python script to apply a material paint to a series of wall surfaces.
Error: “unexpected token <‘newline’>”

0 Likes

#2

Probably easiest to say that just about everything directly related to how your trying to paint the walls is not correct. Here’s a script that I wrote a while back for the same kind of thing that you can look at and try to evaluate how it differs from yours. This isn’t the most robust script as it will fail if you don’t have a list (single object), or you have a multi-dimensional list, or if you have a face based wall, but it should be enough to get the point across.

-Tim

1 Like

Python Nodes Basics
#3

Thanks for answering this Tim. Making sure to unwrap the elements is a good point. It’s multiple walls with different materials assigned to different faces. I’ve done the sorting of which material to which exterior/interior face with a Element.Faces node. However, are you saying that “faces” have to be derived within the script and can not be loaded in as an input?

0 Likes

#4

The faces need be Autodesk.Revit.DB.Face objects that come from a Revit solid object, and what you’re showing in your initial script are surfaces from a Dynamo solid object, very different things as far as the Revit API is concerned with. You could try passing the materials as a 2d list to the python script just to see if the faces of the Revit solid and Dynamo solid are in the same order. Maybe you’ll get lucky there and it will just work, but it’s not something I’d feel comfortable relying on working all the time. Either way, I think trying to pass the faces into the script is unnecessary unless you’re writing your own nodes to extract the proper kinds of faces (in addition to convert them to a Dynamo surface), iterating through them to get the materials set, and then passing the relevant faces into the python script.

Ideally I would probably want to run whatever filtering or evaluating you’re doing on the Dynamo surfaces (Element.Faces) with the Revit API on faces extracted directly from the wall at runtime. I might just be overly paranoid though.

-Tim

0 Likes

#5

Made some adjustments, but kept the sorting in dynamo nodes and the paint function in python. Works pretty well.

0 Likes

#6

Hi @pm6718 I am trying to study to be able to apply and calculate formwork area so can you up file .dyn!
Thank you so much!

0 Likes

#7

This is an appropriate title for a new thread including screenshots of your current work. See if the links mentioned in this post can help:

1 Like