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 / Get Layer Names.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  1.2 KB  |  41 lines

  1. ' This simple macro gathers layer names for an entire drawing.
  2. '
  3. ' It first asks the user for the name of an output file, 
  4. ' then creates that file.  Next it cycles through the drawing, 
  5. ' and writes all the Layer names to the open ASCII text file, 
  6. ' reporting the number of names written when finished.
  7. '
  8. ' This version only checks the first 50 layers, (1-50, Not 0), but
  9. ' you can change the value of Count on the line below to add layers
  10. ' to the output.  Count can be changed to values between 1 and 255.
  11.   Count = 50    
  12. '
  13. ' Get Output filename from user
  14.   Input "Output filename?   (remember to add .TXT)", Outfile$
  15. ' Truncate numbers to the right of the decimal.
  16.   Precision 0
  17. '
  18. ' Open the Data file, it's created in whatever directory the macro is in
  19.     open "o", 1, Outfile$
  20. ' Loop for Layers 1-50
  21.   for a = 1 to Count
  22.   ' Set the Current Layer to a
  23.     Sys(3) = a
  24.   ' Check for Layer Name
  25.     if SYS$(93) = "" then
  26.        goto NextLoop
  27.     else
  28.        LayName$ = Sys$(93)
  29.        print #1, LayName$
  30.        b = b + 1
  31.     end if
  32. ' Loop for next layer
  33.   NextLoop:
  34.   next a
  35. ' Remember to close the file
  36.   Close #1
  37. ' Display Results
  38.   Message b, " Layer Names written to ",Outfile$
  39. End
  40.