File: xde.tcl

package info (click to toggle)
opencascade 7.8.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 293,924 kB
  • sloc: cpp: 1,249,635; tcl: 15,974; cs: 5,173; java: 1,554; sh: 1,354; ansic: 821; xml: 737; makefile: 26; javascript: 22
file content (47 lines) | stat: -rw-r--r-- 1,321 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
# Simple sample demonstrating work with assemblies in XDE, and assignment of 
# names and colors to components vs. instances

#Category: XDE
#Title: Work with assemblies, colors etc. in XDE

pload MODELING
pload OCAF
pload XDE

puts "Make a link as assembly made of a pin and two instances of the same nut"
pcylinder pin 1 10
pcylinder nut 2 2
compound nut nut nuts
explode nuts
ttranslate nuts_1 0 0 7
ttranslate nuts_2 0 0 1
compound pin nuts_1 nuts_2 link

puts "Add link assembly in XCAF document, and add names and colors:"
NewDocument D XCAF
XAddShape D link
SetName D [XFindShape D pin] "Pin"
SetName D [XFindShape D nut] "Nut"
SetName D [XFindShape D link] "Link"
SetName D [XFindShape D link]:1 "Pin instance"
SetName D [XFindShape D link]:2 "Nut instance 1"
SetName D [XFindShape D link]:3 "Nut instance 2"

puts "- Pin will be white"
XSetColor D [XFindShape D pin] WHITE
puts "- Nut itself will be dark gray"
XSetColor D [XFindShape D nut] GRAY10
puts "- Nut instance #1 will be red"
XSetColor D [XFindShape D link]:2 RED
puts "- Nut instance #2 will be green"
XSetColor D [XFindShape D link]:3 GREEN

puts "Starting DF browser..."
DFBrowse D
puts "Expand the document tree to see its structure and assigned names"

puts "Showing assembly in 3d view..."
vclear
vinit View1
XDisplay -dispMode 1 D -explore
vfit