Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
My add-in runs in the background and receives messages from an external second program. Therefore a thread is created which constantly listens and in the event of a new message runs Fusion360-commands.
Unfortunately Fusion crashes when it has to interact with the UI for example if it has to create a new document.
Here an example:
import adsk.core, adsk.fusion, adsk.cam, math, threading
def run(context😞
thread = threading.Thread(target=CreateNewDocument)
thread.start()
def CreateNewDocument():
app = adsk.core.Application.get()
doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
Is there a way to interact with the UI within the thread?
Solved! Go to Solution.