Geometry.tcl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright (c) 1999-2014 OPEN CASCADE SAS
  2. #
  3. # This file is part of Open CASCADE Technology software library.
  4. #
  5. # This library is free software; you can redistribute it and/or modify it under
  6. # the terms of the GNU Lesser General Public License version 2.1 as published
  7. # by the Free Software Foundation, with special exception defined in the file
  8. # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
  9. # distribution for complete text of the license and disclaimer of any warranty.
  10. #
  11. # Alternatively, this file may be used under the terms of Open CASCADE
  12. # commercial license or contractual agreement.
  13. proc cmp {} {
  14. dtyp .
  15. set name [lastrep id x y b]
  16. global $name
  17. lastrep id x1 y1 z1 b
  18. cfindp $name id x y pole
  19. if {[dval pole] == 0} return
  20. dset x0 x1 y0 y1 z0 z1 b 0
  21. draw id 6 $name
  22. while {[dval b] == 0} {
  23. pick id x2 y2 z2 b nowait
  24. dset dx x2-x1 dy y2-y1 dz z2-z1 x1 x2 y1 y2 z1 z2
  25. draw id 6 $name
  26. cmovep $name pole dx dy dz
  27. draw id 6 $name
  28. }
  29. draw id 6 $name
  30. if {[dval b] == 1} return;
  31. dset dx x0-x2 dy y0-y2 dz z0-z2
  32. cmovep $name pole dx dy dz
  33. }
  34. proc smp {} {
  35. dtyp .
  36. set name [lastrep id x y b]
  37. global $name
  38. lastrep id x1 y1 z1 b
  39. sfindp $name id x y upole vpole
  40. if {[dval upole] == 0} return
  41. dset x0 x1 y0 y1 z0 z1 b 0
  42. draw id 6 $name
  43. while { [dval b] == 0} {
  44. pick id x2 y2 z2 b nowait
  45. dset dx x2-x1 dy y2-y1 dz z2-z1 x1 x2 y1 y2 z1 z2
  46. draw id 6 $name
  47. movep $name upole vpole dx dy dz
  48. draw id 6 $name
  49. }
  50. draw id 6 $name
  51. if {[dval b] == 1} return
  52. dset dx x0-x2 dy y0-y2 dz z0-z2
  53. movep $name upole vpole dx dy dz
  54. }
  55. #################################################
  56. # smooth
  57. #################################################
  58. help smooth {smooth cname tol [filename] } "DRAW Variables management"
  59. proc smooth {name tol {file ""}} {
  60. if {$file == ""} {
  61. uplevel #0 "bsmooth $name $tol"
  62. } else {
  63. global Draw_DataDir
  64. uplevel #0 "bsmooth $name $tol $Draw_DataDir/$file"
  65. }
  66. return $name
  67. }
  68. #################################################
  69. # beziersmooth
  70. #################################################
  71. help beziersmooth { beziersmooth cname tol deg [-GR -VA -PR] [filename] } "DRAW Variables management"
  72. proc beziersmooth {name tol deg option {file ""}} {
  73. if {$file == ""} {
  74. uplevel #0 "bzsmooth $name $tol $deg $option"
  75. } else {
  76. global Draw_DataDir
  77. uplevel #0 "bzsmooth $name $tol $deg $option $Draw_DataDir/$file"
  78. }
  79. return $name
  80. }
  81. help pickf {name : extract picked with mouse face as a new variable\
  82. } {DRAW Variables management}
  83. proc pickf {name} {
  84. global $name
  85. eval renamevar "[pickface]" $name
  86. }