Revit: Modifying is forbidden because the document

2019-09-17 07:20发布

Modifying is forbidden because the document has no open transaction. The document has no open transaction. In Revit Document.

3条回答
Melony?
2楼-- · 2019-09-17 07:49

You have 2 options:

  1. change the TransactionMode to Automatic at the class attribute

    [Transaction(TransactionMode.Automatic)]

  2. open a transaction within your command

    Transaction tr = new Transaction(commandData.Application.ActiveUIDocument.Document); tr.Start("Command name here");

    // your code

    tr.Commit();

查看更多
可以哭但决不认输i
3楼-- · 2019-09-17 07:53

close streamreader function

Dim TextLine As String = ""
    Dim fs As FileStream = New FileStream("baglanti.ini", FileMode.Open)
    Dim sr As StreamReader = New StreamReader(fs)
    baglanti_kodu = sr.ReadLine()
    fs.Close()
    sr.Close()  <---- they
查看更多
【Aperson】
4楼-- · 2019-09-17 08:03

Since you tagged this as revitpythonshell:

try:
    transaction = Transaction(doc, 'a name for your transaction)
    transaction.Start()
    do_stuff_that_needs_to_modify_document()
    transaction.Commit()
except:
    transaction.Rollback()
    throw_hands_up_in_the_air_and_cry_in_frustration()
查看更多
登录 后发表回答