home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / DesignCAD 3D Max PLUS trial 30 / DATA1.CAB / Example_Files / Sample_Macros / Text Font Change.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  1.7 KB  |  65 lines

  1. ' This macro changes the font of existing text
  2. '
  3. ' Array to hold selected items
  4.     Dim ent(500)
  5. count = sys(9)            
  6. For a = 1 To count        
  7.     Entity(a)
  8.     etype = Sys(90)            
  9.     if etype=3 then         
  10.     putattr a, 3, 1        
  11.     >converttext
  12.     {
  13.     }
  14.     'getselect a, ent(a)
  15.     endif
  16. next a
  17. farx=sys(122)        'get the max x value for entire drawing
  18.             'so a point can be place away from the drawing
  19.             'deselecting anything in the drawing, as
  20.             'anything selected will later be deleted
  21. >pointselect                
  22. {
  23. <type 0
  24. <pointxyz [farx+25,12]
  25. }
  26. dim jx(200), jy(200), jz(200)    'initilize my arrays
  27. count = sys(9)            'find total number of entities
  28. For i = 1 To count        'cycle through all entities
  29.    Entity(i)            'get each entity
  30. etype = Sys(90)            'find out what entity you have is
  31. if etype=13 then         'if its 2-D text
  32. putattr i, 13, 1        'select it
  33. goto nexoop            'skip to the main part of macro
  34. endif
  35. goto bottom            'skip over main part if not 2-D text
  36. nexoop:
  37.                 'make it 3-D text...better point representation
  38. >converttext
  39. {
  40. }
  41. For j = 1 To sys(1)        'cycle through the points
  42. pointval jx(j) jy(j) jz(j) j    'put them in an array
  43. next j
  44. angles=sys(97)*sys(32)        'find the angle of the text
  45. text$=Sys$(1)            'get the content of the text
  46. just=sys(257)            'find the justification
  47. squaredx=sqr(jx(1)-jx(3))    'do some math to find the height
  48. squaredy=sqr(jy(1)-jy(3))    'of the text...square root of x distance
  49. height=sqrt(squaredx+squaredy)    'squared+y distance squared
  50.                 'place that text
  51. >text2D
  52. {
  53. <justification [just]
  54. <font "Times New Roman"
  55. <text [text$]
  56. <size [height]
  57. <pointxyz [jx(1),jy(1),jz(1)]
  58. <pointpolar 10,[angles],0
  59. }
  60. bottom:                'this is where you would end up if you weren't 2-D text
  61. next i                'go get the next entity
  62. >selectdelete
  63. {
  64. }
  65. End                'the end