problem about the API code

problem about the API code

Anonymous
Not applicable
1,293 Views
4 Replies
Message 1 of 5

problem about the API code

Anonymous
Not applicable

Execuse me, what is the meaning of the code below?

[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]

捕获.JPG

These are codes of "Hello Revit" API.

0 Likes
Accepted solutions (1)
1,294 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

That specifies whether your add-in is read-only or not.

 

There used to be a third option for 'automatic', but that has been removed:

 

http://thebuildingcoder.typepad.com/blog/2012/05/read-only-and-automatic-transaction-modes.html

 

http://thebuildingcoder.typepad.com/blog/2016/04/whats-new-in-the-revit-2017-api.html#2.3

 

http://thebuildingcoder.typepad.com/blog/2016/05/the-building-coder-samples-2017.html#4

 

By the way, your code snippet is much more useful if you include it as text instead of a screen snapshot.

 

The latter has lots of disadvantages, e.g.,  is harder to read, will not be included and analysed by searches and cannot be copied and pasted.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 5

Anonymous
Not applicable

Thank you for the answers and advice. By the way, Is the code"[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual/Read-Only)]" necessary for every API?

0 Likes
Message 4 of 5

jeremytammik
Autodesk
Autodesk
Accepted solution

Please read the getting started material:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

That will tell you all you need.

 

Specifically:

 

http://help.autodesk.com/view/RVT/2018/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Introduction_A...

 

Furthermore, please always perform at least a minimal search of your own before raising a question here and causing useless effort for your peers.

 

Thank you.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 5

Anonymous
Not applicable

Sorry for the inconvenience caused by this problem. Thank you very much for your help!

0 Likes