By Dennis Collin
I recently posted on how users can get a Revit title sheet family to report the location of the authoring file. However, there is a limitation because Revit’s Out of the box parameter provides the option of just displaying the full path and filename but sometimes, we only want the filename to show. As per the image below.
This can’t normally be done with the normal out-of-the-box functions, but by creating a user defined, shared parameter we can leverage the power of Dynamo scripting!
First we need to create a bespoke file name parameter:
- In the manage tab create a new or amend an existing shared parameter file.
- Add a new parameter group like Sheets or similar.
- Create a new Text based parameter called File_name (Typically use an underscore as spacing character).
Create a new label using this bespoke parameter and add it to the title sheet family.
Load the sheet family into the project/template.
The same custom parameter(s) will also need to be added to the project.
Go to Manage>Project Parameters.
Choose from Shared parameters and add the parameters, ensuring they are Instance, and assigned to Sheet categories.
The custom parameter can now be edited like a normal text field. Except we now want Dynamo to fill the string in with the file name.
In the manage tab, locate the Dynamo button.
Run the Dynamo environment, and execute the Dynamo script.
Note the filename parameter now reports the actual file name.
Looking at the script in detail Dynamo has nodes that can access the file name and path, but the resultant string needs to be ‘chopped’ so that just the filename is shown. The chopping character is the ‘\’ symbol to separate the filename from the file directories.
Illustration of the graph is below, just using standard out-of-the-box nodes.
Note. Image shows the Dynamo 2.13 environment, but the graph will look similar on any recent Dynamo version.
Comentários (0 comentários)