0025687: Visualization, XCAF - eliminate visual artifacts at the edges of faces
[occt.git] / samples / tcl / xde.tcl
1 # Simple sample demonstrating work with assemblies in XDE, and assignment of 
2 # names and colors to components vs. instances
3
4 #Category: XDE
5 #Title: Work with assemblies, colors etc. in XDE
6
7 pload MODELING
8 pload OCAF
9 pload XDE
10
11 puts "Make a link as assembly made of a pin and two instances of the same nut"
12 pcylinder pin 1 10
13 pcylinder nut 2 2
14 compound nut nut nuts
15 explode nuts
16 ttranslate nuts_1 0 0 7
17 ttranslate nuts_2 0 0 1
18 compound pin nuts_1 nuts_2 link
19
20 puts "Add link assembly in XCAF document, and add names and colors:"
21 NewDocument D XCAF
22 XAddShape D link
23 SetName D [XFindShape D pin] "Pin"
24 SetName D [XFindShape D nut] "Nut"
25 SetName D [XFindShape D link] "Link"
26 SetName D [XFindShape D link]:1 "Pin instance"
27 SetName D [XFindShape D link]:2 "Nut instance 1"
28 SetName D [XFindShape D link]:3 "Nut instance 2"
29
30 puts "- Pin will be white"
31 XSetColor D [XFindShape D pin] 1 1 1
32 puts "- Nut itself will be dark gray"
33 XSetColor D [XFindShape D nut] 0.1 0.1 0.1
34 puts "- Nut instance #1 will be red"
35 XSetColor D [XFindShape D link]:2 1 0 0
36 puts "- Nut instance #2 will be green"
37 XSetColor D [XFindShape D link]:3 0 1 0
38
39 puts "Starting DF browser..."
40 DFBrowse D
41 puts "Expand the document tree to see its structure and assigned names"
42
43 puts "Showing assembly in 3d view..."
44 XShow D
45 vfit
46 vsetdispmode 1