File: Q6

package info (click to toggle)
opencascade 7.9.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 301,924 kB
  • sloc: cpp: 1,523,264; tcl: 10,159; cs: 5,173; java: 1,554; sh: 1,342; ansic: 827; xml: 699; makefile: 30; javascript: 22
file content (89 lines) | stat: -rw-r--r-- 1,937 bytes parent folder | download | duplicates (5)
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
#INTERFACE CAF
# Basic attributes
# TDataStd_ReferenceArray
#
# Testing attribute: User defined (additional GUID) TDataStd_ReferenceArray
#
# Testing command:   SetRefArray
# Testing command:   GetRefArray
#

puts "caf001-Q6"
set QA_DUP 0

# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 0:3
set aSetAttr12 0:4
set aLabel 0:2

set aGuid1 "12e94518-6dbc-11d4-b9c8-0060b0ee281b"

SetRefArray D ${aLabel} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
SetRefArray D ${aLabel} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}

# Close/Open the transaction
NewCommand D

# Forget the attribute
ForgetAll D ${aLabel}

# Close/Open the transaction
NewCommand D

# Undo-Redo-Undo
Undo D
Redo D
Undo D

# Save Document
set aFile ${imagedir}/caf001-Q6.cbf
SaveAs D  ${aFile}
Close D

#Open a document
Open ${aFile} D


# Get a value of the attribute
set IsGood 1
set aMessage1 "Add TDataStd_ReferenceArray attribute: Error"
set aGetAttr1 [GetRefArray D ${aLabel}]
set aLen1 [llength ${aGetAttr1}]
set aGetAttr2 [GetRefArray D ${aLabel} ${aGuid1}]
set aLen2 [llength ${aGetAttr2}]

if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
   set IsGood 0
   puts "aLen1=${aLen1}"
   puts ${aMessage1}
}
if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
   set IsGood 0
   puts "aLen2=${aLen2}"
   puts ${aMessage1}
}

set aGetAttr11 [lindex ${aGetAttr1} 0]
set aGetAttr21 [lindex ${aGetAttr2} 0]
if { ${aGetAttr11} != ${aGetAttr21} } {
   set IsGood 0
   puts "aGetAttr11=${aGetAttr11}"
   puts "aGetAttr21=${aGetAttr21}"
   puts ${aMessage1}
}
set aGetAttr12 [lindex ${aGetAttr1} 1]
set aGetAttr22 [lindex ${aGetAttr2} 1]
if { ${aGetAttr12} != ${aGetAttr22} } {
   set IsGood 0
   puts "aGetAttr12=${aGetAttr12}"
   puts "aGetAttr22=${aGetAttr22}"
   puts ${aMessage1}
}

if { ${IsGood} == 0} {
  puts "Add TDataStd_ReferenceArray attribute: Error"
} else {
  puts "Add TDataStd_ReferenceArray attribute: OK"
}