-
Notifications
You must be signed in to change notification settings - Fork 75
/
updateAssemblyCmd.py
48 lines (34 loc) · 1.08 KB
/
updateAssemblyCmd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# coding: utf-8
#
# updateAssembly.py
import math, re, os
from PySide import QtGui, QtCore
import FreeCADGui as Gui
import FreeCAD as App
import Part
import Asm4_libs as Asm4
class updateAssembly:
def GetResources(self):
return {"MenuText": "Solve and Update Assembly",
"ToolTip": "Update Assembly",
"Pixmap" : os.path.join( Asm4.iconPath , 'Asm4_Solver.svg')
}
def IsActive(self):
if App.ActiveDocument:
return(True)
return(False)
"""
+-----------------------------------------------+
| the real stuff |
+-----------------------------------------------+
"""
def Activated(self):
# find every Part in the document ...
for obj in App.ActiveDocument.Objects:
# ... and update it
if obj.TypeId == 'App::Part':
obj.recompute(True)
#App.ActiveDocument.recompute()
# add the command to the workbench
Gui.addCommand( 'Asm4_updateAssembly', updateAssembly() )