xde.tcl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Simple sample demonstrating work with assemblies in XDE, and assignment of
  2. # names and colors to components vs. instances
  3. #Category: XDE
  4. #Title: Work with assemblies, colors etc. in XDE
  5. pload MODELING
  6. pload OCAF
  7. pload XDE
  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. puts "Add link assembly in XCAF document, and add names and colors:"
  17. NewDocument D XCAF
  18. XAddShape D link
  19. SetName D [XFindShape D pin] "Pin"
  20. SetName D [XFindShape D nut] "Nut"
  21. SetName D [XFindShape D link] "Link"
  22. SetName D [XFindShape D link]:1 "Pin instance"
  23. SetName D [XFindShape D link]:2 "Nut instance 1"
  24. SetName D [XFindShape D link]:3 "Nut instance 2"
  25. puts "- Pin will be white"
  26. XSetColor D [XFindShape D pin] WHITE
  27. puts "- Nut itself will be dark gray"
  28. XSetColor D [XFindShape D nut] GRAY10
  29. puts "- Nut instance #1 will be red"
  30. XSetColor D [XFindShape D link]:2 RED
  31. puts "- Nut instance #2 will be green"
  32. XSetColor D [XFindShape D link]:3 GREEN
  33. puts "Starting DF browser..."
  34. DFBrowse D
  35. puts "Expand the document tree to see its structure and assigned names"
  36. puts "Showing assembly in 3d view..."
  37. vclear
  38. vinit View1
  39. XDisplay -dispMode 1 D -explore
  40. vfit