-
Notifications
You must be signed in to change notification settings - Fork 2
/
TabularNotes.py
54 lines (48 loc) · 1.95 KB
/
TabularNotes.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
import NXOpen
import NXOpen.UF
theSession = NXOpen.Session.GetSession()
theUfSession = NXOpen.UF.UFSession.GetUFSession()
workPart = theSession.Parts.Work
lw = theSession.ListingWindow
lw.Open()
def main():
myTabNotes = []
numSection = 0
numRows = 0
numCols = 0
findTabularNotes(myTabNotes)
lw.WriteLine(f"Number of tabular notes found: {len(myTabNotes)}")
lw.WriteLine(str(f'First tabular note info:\n'))
numSections = theUfSession.Tabnot.AskNmSections(myTabNotes[0])
lw.WriteLine(str(f'Number of sections in tabular note: {numSections}'))
numRows = theUfSession.Tabnot.AskNmRows(myTabNotes[0])
lw.WriteLine(str(f'Number of rows in tabular note: {numRows}'))
numCols = theUfSession.Tabnot.AskNmColumns(myTabNotes[0])
lw.WriteLine(str(f'Number of columns in tabular note: {numCols}\n'))
rowTag = 0
colTag = 0
cellTag = 0
for j in range(0, numRows):
rowTag = theUfSession.Tabnot.AskNthRow(myTabNotes[0], j)
for k in range(0, numCols):
colTag =theUfSession.Tabnot.AskNthColumn(myTabNotes[0], k)
cellTag = theUfSession.Tabnot.AskCellAtRowCol(rowTag, colTag)
cellText = ""
evalCellText = ""
cellText = theUfSession.Tabnot.AskCellText(cellTag)
evalCellText = theUfSession.Tabnot.AskEvaluatedCellText(cellTag)
lw.WriteLine(f"Cell[{j}{k}] \n Text-> {cellText} \n Evuluated text: {evalCellText}")
def findTabularNotes(tagList):
tmpTabNote = 0
NxType = 0
NxSubtype = 0
while True:
tmpTabNote = theUfSession.Obj.CycleObjsInPart(workPart.Tag, NXOpen.UF.UFConstants.UF_tabular_note_type, tmpTabNote)
if tmpTabNote != 0:
NxType , NxSubtype = theUfSession.Obj.AskTypeAndSubtype(tmpTabNote)
if NxSubtype == NXOpen.UF.UFConstants.UF_tabular_note_subtype:
tagList.append(tmpTabNote)
else:
break
if __name__ == "__main__":
main()