오류메세지
Starting a transaction from an external application running outside of API context is not allowed
원인
1. 모든 Revit API 호출은 "API context" 내에서 수행되어야 함
2. 다른 thread에서 API에 액세스하는 경우
3. 이러한 현상은 Form을 만들고 Button.onclick 이벤트로 API로 호출할 때 자주 발생한다.
해결방법
IExternalEventHandler 을 통해 외부에서 event 발생되게한다.
방법1. IExternalEventHandler 생성
방법2. Execute method 을 시행한다.
(Execute method 은 Revit API context에서 실행됨)
방법3. ExternalEvent 생성(방금 생성된 event handler사용)
방법4. Revit API context에서 작업을 수행해야 할 경우, external event에 공지하기( my_external_event.Raise() 이용)
오류 해결방법 참고사이트
Starting a transaction from an external application running outside of API context is not allowed
Starting a transaction from an external application running outside of API context is not allowed. cannot start transaction.
stackoverflow.com
IExternalEventHandler 생성 참고사이트
https://thebuildingcoder.typepad.com/blog/2015/12/external-event-and-10-year-forum-anniversary.html
External Events and 10 Year Forum Anniversary
Ten years ago today, on December 9, 2005, Jim Quanci posted the first thread on the Revit API discussion forum. This was pointed out by Revitalizer, one of the forum's chief contributors. Thank you very much for this, Revitalizer, and thank you even more f
thebuildingcoder.typepad.com
'Revit' 카테고리의 다른 글
[ Revit ] 창이 열린 채로 Revit 작동시키는 초간단 방법 (0) | 2019.09.26 |
---|---|
[ Revit ] Solution : Revit could not complete the external command (0) | 2019.09.17 |
[ Revit ] 초간단 Revit 언어변경하기 (0) | 2019.09.10 |
[ Revit ] How to Transfer Project Standards (0) | 2019.09.02 |
[ Revit API ] How to use project( ) method (0) | 2019.07.28 |