ModelingDemo.tcl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Copyright (c) 1999-2014 OPEN CASCADE SAS
  2. #
  3. #Category: Demos
  4. #Title: Modeling operations
  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. pload MODELING
  36. smallview
  37. if { [winfo exists .h ] } {
  38. destroy .h
  39. }
  40. sage " Creating a box"
  41. sage " box b -10 -10 -10 20 20 20"
  42. sage " "
  43. box b -10 -10 -10 20 20 20
  44. fit
  45. nexplode b f
  46. erase b
  47. sage " Draft of two lateral faces "
  48. sage " depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1 "
  49. sage " nexplode r f"
  50. sage " depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1 "
  51. sage " "
  52. depouille r b 0 0 -1 b_6 -15 10 -10 10 0 0 -1
  53. clear
  54. nexplode r f
  55. depouille rr r 0 0 -1 r_1 -15 -10 -10 10 0 0 -1
  56. clear
  57. nexplode rr e
  58. sage " Fillet on four lateral edges, then on the top and bottom edges "
  59. sage " nexplode rr e"
  60. sage " blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11"
  61. sage " nexplode result e"
  62. sage " blend result result 2 result_11 3 result_12"
  63. sage " "
  64. blend result rr 3 rr_2 3 rr_3 3 rr_10 3 rr_11
  65. erase rr
  66. erase result
  67. nexplode result e
  68. blend result result 2 result_11 3 result_12
  69. clear
  70. nexplode result f
  71. sage " Creating a profile on the top face "
  72. sage " nexplode result f"
  73. 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
  74. "
  75. sage " "
  76. 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
  77. sage " Creating a prism"
  78. sage " prism rr p 0 0 20"
  79. sage " "
  80. prism rr p 0 0 20
  81. fit
  82. sage " Fusion of this prism with the original part "
  83. sage " fuse result rr result"
  84. sage " "
  85. fuse result rr result
  86. donly result
  87. nexplode result f
  88. erase result
  89. fit
  90. sage " Opening the top face"
  91. sage " offsetshape r result -1 0.0001 result_17"
  92. sage " "
  93. nexplode result f
  94. offsetshape r result -1 0.0001 result_17
  95. sage " Creating a cylinder and positioning it"
  96. sage " pcylinder cyl 2 300"
  97. sage " trotate cyl cyl 0 0 0 1 0 0 45"
  98. sage " ttranslate cyl cyl 0 7.5 0"
  99. sage " "
  100. pcylinder cyl 2 30
  101. trotate cyl cyl 0 0 0 1 0 0 45
  102. ttranslate cyl cyl 0 7.5 0
  103. sage " Display the Shape on Hidden Line Mode "
  104. sage " hlr hid r"
  105. sage ""
  106. donly r
  107. hlr hid r
  108. sage " Display the Shape on HLR Mode "
  109. sage " hlr nohid r"
  110. sage " hlr hlr r"
  111. sage ""
  112. donly r
  113. hlr nohid r
  114. hlr hlr r
  115. sage "Demo completed"