1 # Simple sample demonstrating work with assemblies in XDE, and assignment of
2 # names and colors to components vs. instances
8 puts "Make a link as assembly made of a pin and two instances of the same nut"
13 ttranslate nuts_1 0 0 7
14 ttranslate nuts_2 0 0 1
15 compound pin nuts_1 nuts_2 link
17 puts "Add link assembly in XCAF document, and add names and colors:"
20 SetName D [XFindShape D pin] "Pin"
21 SetName D [XFindShape D nut] "Nut"
22 SetName D [XFindShape D link] "Link"
23 SetName D [XFindShape D link]:1 "Pin instance"
24 SetName D [XFindShape D link]:2 "Nut instance 1"
25 SetName D [XFindShape D link]:3 "Nut instance 2"
27 puts "- Pin will be white"
28 XSetColor D [XFindShape D pin] 1 1 1
29 puts "- Nut itself will be dark gray"
30 XSetColor D [XFindShape D nut] 0.1 0.1 0.1
31 puts "- Nut instance #1 will be red"
32 XSetColor D [XFindShape D link]:2 1 0 0
33 puts "- Nut instance #2 will be green"
34 XSetColor D [XFindShape D link]:3 0 1 0
36 puts "Starting DF browser..."
38 puts "Expand the document tree to see its structure and assigned names"
40 puts "Showing assembly in 3d view..."