a347ef35 |
1 | # Simple sample demonstrating work with assemblies in XDE, and assignment of |
2 | # names and colors to components vs. instances |
3 | |
4 | pload MODELING |
5 | pload OCAF |
6 | pload XDE |
7 | |
8 | puts "Make a link as assembly made of a pin and two instances of the same nut" |
9 | pcylinder pin 1 10 |
10 | pcylinder nut 2 2 |
11 | compound nut nut nuts |
12 | explode nuts |
13 | ttranslate nuts_1 0 0 7 |
14 | ttranslate nuts_2 0 0 1 |
15 | compound pin nuts_1 nuts_2 link |
16 | |
17 | puts "Add link assembly in XCAF document, and add names and colors:" |
18 | NewDocument D XCAF |
19 | XAddShape D link |
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" |
26 | |
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 |
35 | |
36 | puts "Starting DF browser..." |
37 | DFBrowse D |
38 | puts "Expand the document tree to see its structure and assigned names" |
39 | |
40 | puts "Showing assembly in 3d view..." |
41 | XShow D |
42 | vfit |
43 | vsetdispmode 1 |