Renaming views on sheets with sheet number

Hi

I’ve set up a definition that renames views on sheets with their respective sheet number as prefix.

The script simply puts together Sheet Number and View Name and sets the parameter - quite simple and probably too simple, as already renamed views will get the sheet number added over and over again each time I run the definition. So what I want to do is to get Dynamo to check whether a sheet number already is contained in the view name. I couldn’t find any nodes for this, so I’ve turned to Python without any luck so far, as the script fails with the flattened sheet.views as input. That being said, I think I’m also missing some range-thing in the script.

Any thoughts on how to solve this with/without Python?

Christian

ViewRename

 

Could you not simply do an ‘If Statement’ on it? ie. If ‘Sheet Name’ = a concatenated (string) of ‘Sheet Name + Sheet Number’, then end transaction? If it doesn’t, then run definition.

I don’t think that would do the trick - Dynamo should check whether the Sheet Number is included in the View Name already. A if View Name = Sheet Number+View Name would also result in the Sheet Number being added over and over again. Please correct me if I’m wrong.

Currently you’re querying the “View Name”, and populating it with a concatenated “View Name” + “-” + “View Number”. So when you run this again, querying the “View Name” will give you the concatenated version from the previous run and THEN add again, the “-” + “View Number”. So you get a form of recursion.

Not that I know how, but I would assume you can simply use an ‘if statement’ to say that, if the “View Name” = “View Name-View Name” then don’t run it, no? Or query if it already contains a “-” if that’s not commonplace in your typical, starting View Names. Or any other form of filter for that matter.

Just thinking out loud really…

I have a similar tool that I built and I ran into the same issue. I solved the problem by first having Dynamo go through each View Name and remove the DetailNumber and SheetName (essentially undoing what the previous Dynamo run did), then run back through all views and append the Detail Number and Sheet Name back to the View Name. My reasoning here was that Views on Sheets occasionally get renumbered, removed from the sheet, etc., so I really needed to run back through all views and rename them rather than only looking for views that were not already named with Detail Num and Sheet info since the Detail number and Sheet Name that were appended to the View name might not be up to date.

Good point Ben! Duly noted for future reference.

Yeah, good point Ben! Something similar actualy crossed my mind before, but I couldn’t think of a way of telling Dynamo which parts to remove from the View Name (unless you use the exact same numbering syntax on every project). Could you share some additional insight about your solution?

 

If you use something like an underscore purely to separate the sheet number/detail number from the name it

s not too bad. you have to only use it for that though, it can’t appear more. (At least in my example.)

 

About to drop this on Rhythm in the package manager.

2015-05-06_09h45_03

You could always use String.Contains if you know hat you’re looking for (e.g. the sheet number). But if the view has been moved from one sheet to another, you’re out of look, obviously. In that case you would have to use something like regular expressions to parse the view name.

The ode I mentioned before is now live on the package manager. Also here are the bones of the node

2015-05-06_10h54_10

Christian-

J0hnp’s approach is pretty much the same approach I use to remove the characters. I use “*" because it’s a little more unique than simple "”. See below for the section of my definition that does the removing of the text.

Remove Characters

Hi, I’ve started a similar routine from the existing routine above, except without the Python. Tried it out with some floorplans/sections/elevations and schedules on a sheet. This went perfectly, until I placed a legend view onto the sheet. Suddenly I got the following error in the Sheet.Views-node:“Warning: Sheet.get_Views operation failed. Unable to cast object of type ‘Revit.Elements.UnknownElement’ to type ‘Revit.Elements.Views.View’.” Anyone else encountered the same issue?

 

 

@Dieter - I have the same error like you and I don’t know how to solve. Do you found a solution for it?

Hi Eduard,

Which Dynamo version your using?

It works for me fine. Try using custom node from Spring nodes Package called “Sheet.Views+”. Good Luck!

Hello

Maybe I am missing something- but couldn’t you either:

  1. leave the View Name untouched, but update the 'Title on Sheet" parameter with a concatenation of sheet and view name, or
  2. add an extra parameter to views to store (or temporarily store) data to work around the recursion problem, and update the View Name
option 2. Would be best if you wanted to see the sheet number for each view in the project browser, rather than just on the sheet

 

Andrew