Open central file from revit server in background and change textnote text

Hey I am trying to design a dynamo script to automate the process of maintaining revit files from a revit server.

Unfortunately, I have a problem with one part of it.

As part of the maintenance, I would like to change a text note, which is pre placed on the starting view.
The text note should represent date and time of the maintenance and also what happened.

I have tried it in a “normal” opened revit file and it works fine but when I try to do the same on my opened file in the background, I get this error:

Attempt to modify the model outside of transaction.

any help would be amazing

thanks

Hi @SpaghettiWithNodes
Try using the OOTB transaction start/end nodes.

  • Transaction start put right after the document opening node
  • Transaction End after your setText node
  • then save and close the file in background.

If you need more in depth explaination to understand the Transaction drill, try the revit api doc: Transaction Class

Or easier to understand maybe Intro to Transactions… from @Daniel_Woodcock1

1 Like

but if I try to summarize what a transaction is with a metaphor:

  • you are in a shop (Revit Model), you can look around at stuff (model elements and data) and you can eventually touch and buy things (set Text note for example).
  • In order to do so you need to ask the owner/cashier (Revit application) to interact with the things.
  • So you Start talking (start a transaction), do your stuff/buy, then say goodbye (end the transaction) and leave (save your changes and close the file)
2 Likes

Thanks and also for that great metaphor but it didnt work still the same error.

Would you mind sending me your script?
@SpaghettiWithNodes

no please have a look i have send you a message

The TextNote.SetText node is not intended to work in a document open in the background.
Another node should be created with a document input.

1 Like

By not sharing a sample graph you put extra strain on the people trying to help you out, who now have to ‘know’ what the issue is offhand as they have run into it before (Alban likely falls into this category), or to rebuild your graph from scratch which can be quite tedious. Always err on the side of sharing when possible - it helps the community help you which leads to faster answers. :slight_smile:

1 Like

sorry

here is my graph

OpenFileFromRervitServerAndSaveLocal25.dyn (67.2 KB)

1 Like

Ok that makes sense to me but I don’t know how to make my own node.
Is there a Package I could use or do you know how to make a node for this?