VisualizationDemo.tcl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. # Copyright (c) 1999-2014 OPEN CASCADE SAS
  2. #
  3. #Category: Demos
  4. #Title: Displaying 3d viewer
  5. #
  6. # This file is part of Open CASCADE Technology software library.
  7. #
  8. # This library is free software; you can redistribute it and / or modify it
  9. # under the terms of the GNU Lesser General Public version 2.1 as published
  10. # by the Free Software Foundation, with special exception defined in the file
  11. # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
  12. # distribution for complete text of the license and disclaimer of any warranty.
  13. #
  14. # Alternatively, this file may be used under the terms of Open CASCADE
  15. # commercial license or contractual agreement.
  16. # Command to log a message to both command-line and dialog window
  17. proc sage { a} {
  18. if { ![winfo exists .h ] } {
  19. toplevel .h -bg azure3
  20. wm title .h "INFO TEST HARNESS"
  21. wm geometry .h +320+20
  22. }
  23. if { [winfo exists .h.m ] } {
  24. set astring [.h.m cget -text]
  25. set newstring "${astring} \n $a"
  26. .h.m configure -text $newstring
  27. puts $a
  28. } else {
  29. message .h.m -justify left -bg azure2 -width 13c -relief ridge -bd 4 -text $a
  30. puts $a
  31. }
  32. pack .h.m
  33. update
  34. }
  35. if { [winfo exists .h ] } {
  36. destroy .h
  37. }
  38. pload MODELING VISUALIZATION
  39. sage " Creating the V3D Viewer"
  40. sage " vinit"
  41. sage " "
  42. vinit
  43. vclear
  44. clear
  45. sage " Creating the Topological Viewer"
  46. sage " smallview"
  47. sage " "
  48. smallview
  49. sage " Creating a box"
  50. sage " box b -10 -10 -10 20 20 20"
  51. sage " "
  52. box b -10 -10 -10 20 20 20
  53. fit
  54. sage " Display the box in the V3D Viewer"
  55. sage " vdisplay b"
  56. sage " "
  57. vdisplay b
  58. vfit
  59. nexplode b f
  60. erase b
  61. sage " Draft of two lateral faces "
  62. sage " nexplode b f"
  63. sage " depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1 "
  64. sage " nexplode r f"
  65. sage " depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1 "
  66. sage " "
  67. depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1
  68. clear
  69. nexplode r f
  70. depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1
  71. clear
  72. nexplode rr e
  73. verase b
  74. vdisplay rr
  75. vfit
  76. sage " Fillet on four lateral edges, then on the top and bottom edges "
  77. sage " nexplode rr e"
  78. sage " blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11"
  79. sage " nexplode result e"
  80. sage " blend result result 2 result_11 3 result_12"
  81. sage " "
  82. blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11
  83. erase rr
  84. erase result
  85. nexplode result e
  86. blend result result 2 result_11 3 result_12
  87. clear
  88. nexplode result f
  89. verase rr
  90. vdisplay result
  91. vfit
  92. sage " Creating a profile on the top face "
  93. sage " nexplode result f"
  94. sage " profile p S result_16 F 10 4 D 1 0 C 2 90. Y 8 C 2 90. X -2 C 2 90. Y -8 C 2 90. X 2
  95. "
  96. sage " "
  97. profile p S result_16 F 10 4 D 1 0 C 2 90. Y 8 C 2 90. X -2 C 2 90. Y -8 C 2 90. X 2
  98. sage " Creating a prism"
  99. sage " prism rr p 0 0 20"
  100. sage " "
  101. prism rr p 0 0 20
  102. sage " Change some attributes : MATERIAL , TRANSPARENCY"
  103. sage " vsetmaterial rr PLASTIC"
  104. sage " vsetcolor rr RED"
  105. sage " vsettransparency result 0.5"
  106. sage " vsetdispmode 1"
  107. sage " "
  108. vdisplay rr
  109. vsetmaterial rr PLASTIC
  110. vsettransparency rr 0.5
  111. vsetcolor rr RED
  112. vsettransparency result 0.5
  113. vsetdispmode 1
  114. vfit
  115. fit
  116. sage " Fusion of this prism with the original part "
  117. sage " fuse result rr result"
  118. sage " "
  119. fuse result rr result
  120. donl result
  121. vdisplay result
  122. vdonly result
  123. vfit
  124. nexplode result f
  125. erase result
  126. fit
  127. sage " Opening the top face"
  128. sage " offsetshape r result -1 0.0001 result_17"
  129. sage " "
  130. nexplode result f
  131. offsetshape r result -1 0.0001 result_17
  132. vdisplay r
  133. vdonly r
  134. vfit
  135. vsetcolor r MATRABLUE
  136. vsettransparency r 0
  137. sage " Creating a cylinder and positioning it"
  138. sage " pcylinder cyl 2 300"
  139. sage " trotate cyl cyl 0 0 0 1 0 0 45"
  140. sage " ttranslate cyl cyl 0 7.5 0"
  141. sage " "
  142. pcylinder cyl 2 30
  143. vdisplay cyl
  144. vsetcolor cyl RED
  145. vfit
  146. trotate cyl cyl 0 0 0 1 0 0 45
  147. ttranslate cyl cyl 0 7.5 0
  148. vdisplay cyl
  149. vsetcolor cyl RED
  150. vfit
  151. vdisplay cyl
  152. vsetcolor cyl RED
  153. vfit
  154. sage "Demo completed"