-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIKABcreateGridNote.pmlfnc
110 lines (92 loc) · 2.64 KB
/
SIKABcreateGridNote.pmlfnc
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Define function !!SIKABcreateGridNote()
NEW NOTE
handle any
!!SIKABgridPathReturn = 'error;newNote'
return
endhandle
!note = !!ce
!sheetSize = !!ce.owner.size
!file = object file(!!SIKABgridPath)
if !file.Exists() then
do !row values !file.ReadFile()
!data = !row.split(';')
if !data[1] eq 'stra' then
!f = !data[2].split(' ')
!t = !data[3].split(' ')
NEW STRA
FPT x $!f[1] y $!f[2]
TPT x $!t[1] y $!t[2]
if !data[4] eq 'Dotted' then
NLStyle Dotted
elseif !data[4] eq 'Dashed' then
NLStyle Dashed
endif
elseif !data[1] eq 'text' then
NEW TEXP
!texp = !!ce
ALIGNMENT HBODY
!xy = !data[2].split(' ')
!btext = !data[3]
!cheitx = !data[6].Replace(',','.')
BTEXT '$!btext'
Cheitx '$!cheitx'
AT X $!xy[1] Y $!xy[2]
var !extent extent btext
!extentCord = !extent.Split(' ')
if !data[7] ne '-' then
if !data[7] eq 'center' then
!cellWidth = !data[4].Real()
!textWidth = !extentCord[6].Real() - !extentCord[2].Real()
!moveDist = !cellWidth / 2 - !textWidth / 2
BY X $!moveDist
elseif !data[7] eq 'right' then
!cellWidth = !data[4].Real()
!textWidth = !extentCord[6].Real() - !extentCord[2].Real()
!moveDist = !cellWidth - !textWidth
BY X $!moveDist
endif
endif
if !data[9] eq 'word-break' then
!cellWidth = !data[4].Real()
!textWidth = !extentCord[6].Real() - !extentCord[2].Real()
if !textWidth gt !cellWidth then
!words = !btext.split(' ')
!finalBtext = ''
NEW TEXP
Cheitx '$!cheitx'
!tempTexp = !!ce
--q var !words
do !i to !words.Size()
$!tempTexp
!newBtext = !finalBtext + !words[!i] + ' '
BTEXT '$!newBtext'
--q btext
var !extent extent btext
!extentCord = !extent.Split(' ')
!textWidth = !extentCord[6].Real() - !extentCord[2].Real()
--q var !extent
--q var !textWidth
--q var !cellWidth
--q var !newBtext
--$p -------------
if !textWidth gt !cellWidth then
!finalBtext = !finalBtext + '#/' + !words[!i] + ' '
else
!finalBtext = !newBtext
endif
enddo
$!tempTexp
DELETE TEXP
$!texp
BTEXT '$!finalBtext'
endif
endif
endif
enddo
else
!!SIKABgridPathReturn = 'error;noFile'
endif
$!note
--BY X ($!sheetSize[1] / 2 )
--BY Y ($!sheetSize[2] / 2 )
EndFunction