오류메세지

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() 이용)

 

오류 해결방법 참고사이트

https://stackoverflow.com/questions/31490990/starting-a-transaction-from-an-external-application-running-outside-of-api-conte

 

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

 

반응형

+ Recent posts