I’m trying to set the Detail Level for a 3D view created in a set of files - using View.SetDetailLevel - however the only value which seems to work for the detailLevel input is “Medium”. I’ve tried “Fine” and “Coarse” in a code block as well as using the native Detail Level node but each returns a false in the success output.
not sure if this is a bug, i’m using the wrong input or something is preventing editing the view detail level (new views default to Medium so perhaps that is why a Medium input works?)
Welcome to the Forum @owensharp
In Revit the Detail level is represented by a dropdown list.
In other cases where dropdown lists are present, the value to set is a corresponding number value.
could you give that a try?
Hi Marcel … thanks for the suggestion, but unfortunately 0-2 integers are not working. 1 (Medium) returns a false so i am thinking the code block string or Detail Level node output are the correct format as they at least work for Medium, and that the issue is with the View.SetDetailLevel node or something is preventing editing the view?
a view template can prevent it yes
so View.SetDetailLevel works as expected if i modify a view in the active Revit document, even one i have created through Dynamo
the script attached is opening a folder of revit files, creating a 3D view and closing (saving) the files - which all works, except for setting the Detail Level of the created views. I’ve tried passing both the view output of the initial Create 3DView, and a list of all the views created (1 in each RVT) neither of which works. Pretty sure View Templates are not the issue as tested with OOTB templates with no View Templates assigned. If i run this on the active Revit doc instead of a folder of files it works … will do some more searching
(also would post the script but not allowed to attach files yet!)
try a transaction .end node between creating the view and setting the detail level.
it makes sure the view creation is completed before the rest of the script is processed
i’ve tried the transaction.end node following the view creation and before referencing the documents the views are created in, but did not fix the issue. I also tried a transaction.start immediately after the .end … saw that used in a few other examples but wasn’t sure if it was required, but didn’t seem to make a difference.
I’ve attached the script with this inserted now i can attach files.
Create Model Export Views.dyn (38.1 KB)
however i suspect there is a different issue, so i tested trying to modify existing views in a set of files and the same issue occurs. I then tried an alternate method Element.SetParameterByName to set the Detail Level and that threw an error “attempt to modify the model outside of transaction” (see attached). Note if the integer is set to 2(=Medium) then the warning dissappears.
I’ve also run into the same problem trying to change the Style (e.g Shaded) or Scale … so i’m wondering if there is an issue with changing View settings in docs loaded from filepaths vs active docs open in Revit (these scripts all work fine for the latter)
it might be easier to use a view template setting the detail level
thanks, i had considered that earlier as it would address multiple view settings i hadn’t got to yet however i’d need to create a new view template to apply as can’t rely on the models containing the view templates i need. my quick search seemed to indicate you can’t create new view templates through Dynamo, but i will have another look
maybe its not possible to create a view template ( found that too)
but it might be possible to copy one from another file
can’t test it (no Revit here)