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.
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.
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.
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
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.
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.
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.
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.
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.
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.