Hi… I’m an absolute beginner in Dynamo so not exactly sure of the ways that it is going to help me but I can see the potential is there to be unlocked if I can pick up some skills.
I am a Revit technician (Structural) and have a need to improve Revit’s limited pdf creation tools and following various online research and painstaking baby steps I have written my first Dynamo Graph which does do what I need but in quite a basic way, but I would appreciate some simple guidance on how I can get over a hurdle as follows…
I sometimes work on projects that have strict naming conventions for issued pdf files, which are a bit of a pain to change manually so have written a graph to do it for me. At the moment I have got it set to rename five files as that’s how many I am using in my test set up, but obviously each project may have a different number of sheets therefore I am wondering what my options are for building into my graph some way of Dynamo working out how many files it needs to rename ?
I’m guessing this is obvious to experienced users but with my basically non-existent Dynamo/Programming experience, I have no idea what to look for beyond this point in my graph. I understand that this problem may have been solved/discussed many times in the past but if I just copy what someone else has created I won’t learn a thing so I wanted to try to solve the problem as much as I could.
Does anyone have any suggestions ?
Thanks
This is a screenshot of my graph (assuming I have uploaded correctly)…
Could you get the information you need for the new name from parameters within the project? i.e Sheet Number, sheet name, current revision.
If so then I recommend reading Konrad’s blog (link below)
This helped me a lot as I have learnt how to write a graph which allows you to print multiple sheets (different sheet sizes as well) and rename them within the one graph.
Hi… Thanks for the replies. I have read Konrad’s articles and used them to get this far. My main problem now is figuring out how to get dynamo to rename all of the pdfs I create in a folder (however many that may be) without me needing to have a section of the graph for each one. ie… Is there a specific node I should be looking into that effectively specifies that a command is applicable to “all” the files that match a set criteria?
Apologies if it’s in the articles mentioned but I haven’t seen it and when coding is shown, it goes completely over my head.
@Konrad_K_Sobon’s node is set up to take a list of identifiers and rename any files which contain the matching identifier, no need to have multiple instances of this node as a result unless you want to run it on multiple directories. Just build coordinated lists of matching length and go to town. Try this:
Note that I had previously modified the Rename Files node to remove the loading of Revit specific libraries, transaction handling and document stuff which weren’t used and throw an error if you’re running it in studio.
Hi Jacob… I got error messages as follows when I tried it. From looking online I found a post that suggested each \ should be replaced with \ but it still didn’t work.
Thanks Joseph… That worked for the code block problem but now I get Traceback/WindowsErrors which I believe has got something to do with the Rename Files Node.
It looks like you’re feeding a “path”+“Name” when all revit wants is the “Name” for the New Names input. The string replace needs the empty string input to remove the path.
The String.Replace node not the String.Insert node. I believe you need to set the lower string node which currently has “”; with “” and remove the quotes form the start and end of the upper string node. Quotes in a code block is telling dynamo that this bit of content in the code block is a string. If you call a string node there is no need for the quotes.
In addition if you just need to rename. You can also use the old fashion “RENAME” graph below will create a CMD in your desired folder and you can run it separately outside by double clicking the Rename.cmd
Thanks for this. I haven’t had chance to look into it yet but are you saying a file can be created using dynamo but that can then be run independently/separate to dynamo?
Yes it will create a file located on your specified location. Just try it…it will create a file called rename.cmd that you can run separately outside revit and dynamo. Its just a batch file a very old trick but really works and simple.
I’ll give that a try as soon as I get chance. Do you know if there is list of other “. cmd” files readily available or easily creatable. I’m not sure what I would want them to do but the concept intrigues me as I had no idea things like that were possible without having advanced coding skills (which I obviously haven’t).
Thanks for the tip off
I am not sure what else…depending on your requirement. Dynamo is not built for this purpose but its good it can do this trick on writing ‘cmd’. Try it first and see if it will do the trick as an alternative to the above solution.