-
Notifications
You must be signed in to change notification settings - Fork 2
/
hFrame3DDfc3DDout.py
58 lines (43 loc) · 1.53 KB
/
hFrame3DDfc3DDout.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
49
50
51
52
53
54
55
56
57
58
#
__title__ = "FreeCAD hFrame3DDfc library"
__author__ = "[email protected]"
import FreeCAD,FreeCADGui
import os
class Node:
def __init__(self, id , x,y,z):
self.x = x
self.y = y
self.z = z
self.id = str(id)
# elmnt n1 n2 Ax Asy Asz Jx Iy Iz E G roll density
class Member:
def __init__(self, id , n1,n2):
self.n1 = n1
self.n2 = n2
self.id = str(id)
def printChildren(objs = None, level = 0, baseline = ""):
for cnt, obj in enumerate(objs,1):
# print(baseline + " \_" + obj.Label + " {" + obj.TypeId.rsplit(':',1)[-1] + "} => ")
print(baseline + " \_" + obj.Label + " {"+ "".join(filter(str.isalpha, obj.Name)) + "} => ")
if cnt == len(objs):
baselinechi = baseline + " "
else:
baselinechi = baseline + " | "
printChildren(obj.ViewObject.claimChildren(), level+1, baselinechi)
class hFrame3DDfc3DDout:
"hFrame3DDfc3DDout object"
def GetResources(self):
# return {'Pixmap': 'path_to_icon.svg', 'MenuText': 'my Result', 'ToolTip': 'very short description'}
return {"MenuText": "Output 3DD file.",
"Accel": "Ctrl+t",
"ToolTip": "hFrame3DDfc3DDout",
"Pixmap": os.path.dirname(__file__)+"./resources/filesave.svg"
}
def IsActive(self):
if FreeCAD.ActiveDocument == None:
return False
else:
return True
def Activated(self):
printChildren(FreeCADGui.Selection.getSelection())
FreeCADGui.addCommand('hFrame3DDfc3DDout',hFrame3DDfc3DDout())