Modifying is forbidden because the document has no open transaction. The document has no open transaction. In Revit Document.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You have 2 options:
change the TransactionMode to Automatic at the class attribute
[Transaction(TransactionMode.Automatic)]
open a transaction within your command
Transaction tr = new Transaction(commandData.Application.ActiveUIDocument.Document); tr.Start("Command name here");
// your code
tr.Commit();
回答2:
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()
回答3:
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