markers.tcl 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Markers demo
  2. #
  3. # It shows the various marker types supported by OCCT.
  4. #Category: Visualization
  5. #Title: Markers in 3d viewer
  6. pload MODELING VISUALIZATION
  7. # reflects Aspect_TypeOfMarker enumeration
  8. set aMarkerTypeNames {
  9. Aspect_TOM_POINT
  10. Aspect_TOM_PLUS
  11. Aspect_TOM_STAR
  12. Aspect_TOM_X
  13. Aspect_TOM_O
  14. Aspect_TOM_O_POINT
  15. Aspect_TOM_O_PLUS
  16. Aspect_TOM_O_STAR
  17. Aspect_TOM_O_X
  18. Aspect_TOM_RING1
  19. Aspect_TOM_RING2
  20. Aspect_TOM_RING3
  21. Aspect_TOM_BALL
  22. Aspect_TOM_USERDEFINED
  23. }
  24. # custom marker
  25. set aCustom1 [locate_data_file images/marker_box1.png]
  26. set aCustom2 [locate_data_file images/marker_box2.png]
  27. set aCustom3 [locate_data_file images/marker_kr.png]
  28. set aCustom4 [locate_data_file images/marker_dot.png]
  29. set aFontFile ""
  30. catch { set aFontFile [locate_data_file DejaVuSans.ttf] }
  31. set aLabelFont "Arial"
  32. if { "$aFontFile" != "" } {
  33. vfont add "$aFontFile" SansFont
  34. set aLabelFont "SansFont"
  35. }
  36. # reset the viewer
  37. vclear
  38. vclose ALL
  39. vinit name=View1 l=32 t=32 w=512 h=512
  40. puts "Draw box in advance which should fit all our markers"
  41. box b -8 -8 0 16 16 2
  42. vbottom
  43. vdisplay -noupdate -dispmode 0 b
  44. vfit
  45. vremove -noupdate b
  46. puts "Draw markers of different type and size"
  47. for { set aMarkerType 0 } { $aMarkerType <= 13 } { incr aMarkerType } {
  48. set aRow [expr $aMarkerType - 7]
  49. set aCol 5
  50. set aName [lindex $aMarkerTypeNames $aMarkerType]
  51. vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 7FFFFF -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont -noupdate
  52. vdisplay -top -noupdate "$aName"
  53. if { $aMarkerType == 13 } {
  54. vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1
  55. set aCol [expr $aCol - 1]
  56. vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom2
  57. set aCol [expr $aCol - 1]
  58. vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom3
  59. set aCol [expr $aCol - 1]
  60. vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom4
  61. } else {
  62. for { set aMarkerScale 1.0 } { $aMarkerScale <= 7 } { set aMarkerScale [expr $aMarkerScale + 0.5] } {
  63. vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 MarkerType=$aMarkerType Scale=$aMarkerScale PointsOnSide=1
  64. set aCol [expr $aCol - 1]
  65. }
  66. }
  67. }
  68. puts "All markers have been displayed"