Match Paint Material for Paint Material Command


#1

Continuing the discussion from Extract face material information:

Is there a way to match the material that was painted on a face and start the Paint tool with that material?

With the post linked above, I was able to create the following flow where you can interactively select a face and have Dynamo report what material is on the face.

Thanks again!

Get the Material of a Selected Face.dyn (13.7 KB)


#2

You can trigger the paint tool as a postable command but I’m not aware of any way that can set the material used with it. The document class has methods for setting a default family and element type but nothing on materials.

Alternatively, if you know the faces that need to be painted, you can directly use the Document.Paint method.


#3

Thank you very much for that insight!

-Thom K.


#4

You can have dynamo copy the material name to the clipboard and start the command as @Dimitar_Venkov has said. You can then just past the name into the material and Revit will search for it. Not a 100% solution but would help out a lot.


#5

Here is my interpretation of what you have done. Thanks for starting the post. They python code at the end was borrowed from @john_pierson Rhythm Package (PostableCommand.Default3DView). I only changed “Default3DView” to “Paint” API found here Thanks John and @Dimitar_Venkov

Material on Face and Start Paint.dyn (7.9 KB)


#6

Greetings Steven,

That works quite well, thank you very much for putting that together.

There seems to be some issue with it remembering what it last did and not truly running it tabula rasa. I’ve seen this on other scripts too where I’d have to either close the DYN or relaunch Dynamo for it to ‘forget’.

If there’s some insight or maneuvering, I’d certainly appreciate it.

Thank you very much for connecting those dots!

-Thom K.


#7

I am not quite sure. Is the Python producing and error?

You can try this maybe:
Select a new face and set the Boolean to False. Hit Run
Set the Boolean to True. Hit Run
Select a new face and set the Boolean to False. Hit Run
Set the Boolean to True. Hit Run
.
.
.
Have you tried it with the Player? I am sorry I have not used it that much to find an error with it.


#8

Sorry for the delayed response:

I haven’t received any errors with anything in Dynamo: It’s just that if I paint with material A, then paint with material B, and then run the tool to match material A, it just selects/sets the last material I painted with.

I haven’t had a chance, but I will try out your proposed process and see what happens.

Thank you again!!
Thom K.


#9

The Revit tool will always default to the last material you painted with. My script, (sorry if I did it backwards from what you want) you select the face and it will copy the material name to your clip board. If the Boolean is set to true it will activate the paint command (by default it has the last material you painted with) you can hit ctrl+v on your keyboard to past the name of the material into the search box. Revit will then filter to the material. Select the material and then you can paint with it.


#10

Oh, I would never look a gift-script in the mouth!

Your description is the workflow that I was hoping for. For whatever reason, Dynamo/Revit don’t like running the script multiple times without closing Dynamo and selecting the face didn’t always push the material into the clipboard.

It works as intended, I think there is just some internal things with Dynamo/Revit that cause some inconsistent results.

Thank you again for your perseverance.
Thom K.


#11

Oh ok I under stand what you are saying. If you have access to Revit 18.2 with the Dynamo player it should work each time as this is running a fresh copy each time you press play.

If you could please marked solved (if you think this has been solved) so others can find the answer as well.


#12

Excellent!

Thank you again for your responses and work.
Thom K.