Ajout d'un script pour générer des dessins 2D pour tous les tubes
This commit is contained in:
parent
43d7036751
commit
98924d44a1
5 changed files with 348 additions and 9 deletions
38
tools/utils/vspt_coroutine.py
Normal file
38
tools/utils/vspt_coroutine.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import asyncio
|
||||
from PySide.QtCore import QTimer
|
||||
|
||||
class EventLoop:
|
||||
loop = None
|
||||
|
||||
def __init__(self):
|
||||
self.loop = asyncio.new_event_loop()
|
||||
|
||||
def create_task(self, coro):
|
||||
self.loop.create_task(coro)
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
self.loop.stop()
|
||||
self.loop.run_forever()
|
||||
|
||||
async def wait(self, time_milliseconds):
|
||||
#print("waiting " + str(time_milliseconds) + "ms...")
|
||||
currentLoop = self
|
||||
fut = self.loop.create_future()
|
||||
def callback():
|
||||
#print("wait callback")
|
||||
fut.set_result(True)
|
||||
currentLoop.update()
|
||||
QTimer.singleShot(time_milliseconds, callback)
|
||||
await fut
|
||||
#print("end wait")
|
||||
|
||||
main_loop = None
|
||||
|
||||
def get_main_loop():
|
||||
global main_loop
|
||||
if main_loop is None:
|
||||
#print("Creating main loop")
|
||||
main_loop = EventLoop()
|
||||
return main_loop
|
||||
|
||||
6
tools/utils/vspt_freecad.py
Normal file
6
tools/utils/vspt_freecad.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import FreeCAD as App
|
||||
|
||||
def close_all_docs():
|
||||
#print("close_all_docs")
|
||||
while len(App.listDocuments().values()) > 0:
|
||||
App.closeDocument(list(App.listDocuments().values())[0].Name)
|
||||
Loading…
Add table
Add a link
Reference in a new issue