Read-only parameters at random?

I’ve made a program that should duplicate sheets and assign them a new sheet number.
This program works but not consistently. At times it gives an error explaining that the parameter is read-only, but this error seems to be completely random and inconsistent. rerunning my program half of the times the same parameter of the same sheet is read-only, and not read-only.

I’m using the Rhythm node to set the Sheet Number parameter. In upper image i’m receiving the read-only error, even tho this parameter isn’t read-only as shown in the Parameter.IsReadOnly node.

How can i fix this? idea’s would be welcome.
Cheers

This usually happens because you are renumbering sheets with numbers that already exist in your document.

Another cause is this problem: 1. Renumber set of sheets A, 2. One of the new numbers exist in the set A, but it doesnt matter since you are renumbering all of them anyway, 3. Process in Dynamo begins, but renumbers a sheet while one of the other sheets in Set A has the same number (i.e. this sheet needs to be renumbered first to ‘free-up’ the number) otherwise the process fails and you get the error you report.

I’ve written a package which includes a node to renumber/rename sheets which is designed to circumvent this problems and report where it finds duplicate names: bimorphNodes bimorph.RenumberOrRenameSheets. Give that a shot and see if you have any more luck.

2 Likes

Thank you =) this seems to work. I’ve run a couple of tests and so far this problem hasn’t occured.

@Zach_Kron

@M.Melching glad to hear. If you/anyone else encounter this problem and want to know the trick to getting it to work more consistently its quite simple: I use the Id of the element to renumber itself FIRST as this guarantees a unique list of names/numbers, then I renumber. This approach can be used to renumber/rename any elements in Revit where uniqueness is required and where the problem I described above has a risk of occuring:

Notice that I call my renumber function twice. Once to renumber using the Sheet Id, then once more using the numbers input by the user. That way, the success of the renumber process is drastically improved.

3 Likes

Thanks for your explanation.

Is there also a way to make a parameter editable if it returns as read-only?
if i try to do the same with viewports (assign new sheets with specific viewport types), any effort returns into a read-only error.

No you need to investigate why:

  1. Check the report output of the bimorphNode, it will tell you which sheet couldn’t be renumbered so you know where to investigate
  2. Find one of the sheets and check it is in the current document
  3. (In most cases) You are trying to number a sheet with a sheet number already in use - check all the other sheets in your document and make sure you’re not inadvertently introducing duplicate numbers. Keep in mind the problem I described above is handled by the node, (so if you input a list of sheets /new numbers and there’s a duplicate(s) between the two that would otherwise cause the read/write exception, it will bypass the problem and complete the process successfully.)
1 Like