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 / Symbol Keys.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  7.2 KB  |  416 lines

  1. ' Please follow these steps to use this program.
  2. '
  3. ' 1) Copy your symbols to a folder off the C drive
  4. '    that has 3 letters in it's name, c:\CAD for 
  5. '    example.
  6. '
  7. ' 2) Go to that directory at DOS and type:
  8. '    DIR /B >Files.txt.  This creates the ASCII text
  9. '    file containing the files to be opened.
  10. '
  11. ' 3) Copy files.txt to files2.txt, which creates the 
  12. '    file of filenames to be used.
  13. '
  14. ' 4) Create an ASCII text file called count.txt in that
  15. '    same directory that contains 20 lines, each with
  16. '    a single number on it, 1-20.
  17. '
  18. ' 5) Go to DesignCAD and setup the file locations tab
  19. '    for Drawings to read to that directory, then 
  20. '    Save as Default.
  21. '
  22. ' About Running the Program . . .
  23. ' 1) This program makes copies of each symbol in the 
  24. '    group, so make sure your directory you are working
  25. '    with is a copy of the origional, because it will
  26. '    end up being twice as large as you wanted it to be.
  27. ' 2) When prompted, please enter an output filename 
  28. '    simular to c:\1.dc to avoid confusion.  There is
  29. '    no error trapping for overwriting an existing file.
  30. '    You need large amounts of free HD space.
  31. '
  32. ' Get imput from user
  33. Start:
  34. Input "Please type the Archive Name & press Enter:", ARC$
  35. Input "Please type the Group Description & press Enter", DIS$
  36. Input "Please type the Symbol Group ID", GID$
  37. Window 10, 80
  38. Print "Archive          " + ARC$
  39. Print "Description    " + DIS$
  40. Print "Group ID        " + GID$
  41. Print ""
  42. Print "Is this correct? Y/N"
  43. Anykey F$
  44. if F$ = "n" then 
  45.     goto Start
  46. endif
  47. if F$ = "N" then
  48.     goto Start
  49. endif
  50. Count = 0
  51. ' Set's the target file to open
  52.     Root$ = Sys$(20)
  53.     File$ = Root$ + "\" + "Files.txt"
  54.     File2$ = Root$ + "\" + "Count.txt"
  55.     File3$ = Root$ + "\" + "Files2.txt"
  56. ' Opens the files
  57.     open "i", 1, File$
  58.     open "i", 4, File3$
  59. ' Loop Until End of File
  60. Back2:
  61.     open "o", 3, "c:\List.txt"
  62.     open "i", 2, File2$
  63.     do while eof(1) = 0
  64.         if Count = 20 then goto Full
  65.         Input #1, A$
  66.         Input #2, FName$
  67.     B$ = Root$ + "\" + A$
  68. ' Opens the file, Fits it to Window
  69.         >Open
  70.           {
  71.         <Filename [B$]
  72.           }
  73.         >FitToAllWindow
  74.          {
  75.           }
  76.     MinX = Sys(120)
  77.     MinY = Sys(121)
  78.     MaxX = Sys(122)
  79.     MaxY = Sys(123)
  80. ' Sets the new drawing handles for each file
  81.     >DrawingHandle
  82.     {
  83.       <PointXYZ [MinX, MinY, 0]
  84.       <PointXYZ [MaxX, MinY, 0]
  85.         }
  86. ' Saves the incremental File
  87.     FName2$ = Root$ + "\" + FName$ + A$
  88.     >SaveAs
  89.      {
  90.     <SaveChanges 0
  91.     <FileName [FName2$]
  92.      }
  93. ' Writes Value to Third ASCII Text File
  94.     print #3, FName2$
  95. ' Closes Current Drawing File
  96.     >Close
  97.     {
  98.     }
  99.     Count = Count + 1
  100.       loop
  101. '    close 1
  102. end
  103.  
  104. Full:
  105. ' Close All open ASCII text files
  106. '    Close 1
  107.     Close 2
  108.     Close 3
  109. ' Close the Current Document and open a New One
  110.     Count = 0
  111.     >Close
  112.     {
  113.     }
  114.     >New
  115.     {
  116.     }
  117. ' Draws the First Box
  118.     >2DBox
  119.     {
  120.       <Color 0,0,0
  121.       <Layer 1
  122.       <LineStyle 0,2.0000,0.0000
  123.       <PointXYZ 0,0,0
  124.       <PointXYZ 4,-5,0
  125.       <Type 1
  126.       <Orientation 0
  127.     }
  128. ' Selects the Box
  129.     >PointSelect
  130.     {
  131.       <PointXYZ 0,0,0
  132.       <Type 0
  133.     }
  134. ' Makes Copies of the Box in a Row
  135.     >Array
  136.     {
  137.       <PointXYZ 4,0,0
  138.       <PointXYZ 0,-5,0
  139.       <NCopy 5,4,1
  140.       <AlongCurve 0
  141.       <Perpendicular 0
  142.     }
  143. ' Fits the drawing to the current window
  144.     >FitToWindow
  145.     {
  146.     }
  147. ' Adds the 1
  148.     >Text
  149.     {
  150.       <Color 0,0,0
  151.       <Layer 1
  152.       <PointXYZ [.3, -4, 0]
  153.       <PointXYZ [.3, -4, 0]
  154.       <Style 0
  155.       <Justification 0
  156.       <Size .25
  157.       <Angle 0.0000
  158.       <Font "Arial"
  159.       <Text "1"
  160.       }
  161. ' Selects the 1
  162.     >PointSelect
  163.     {
  164.       <PointXYZ .3, -4, 0
  165.       <Type 0
  166.     }
  167. ' Arrays the 1
  168.     >Array
  169.     {
  170.       <PointXYZ 4.3, -4, 0
  171.       <PointXYZ .3, -9, 0
  172.       <NCopy 5,4,1
  173.       <AlongCurve 0
  174.       <Perpendicular 0
  175.     }
  176. ' Adds the 2
  177.     >Text
  178.     {
  179.       <Color 0,0,0
  180.       <Layer 1
  181.       <PointXYZ [3.7, -4, 0]
  182.       <PointXYZ [3.7, -4, 0]
  183.       <Style 0
  184.       <Justification 0
  185.       <Size .25
  186.       <Angle 0.0000
  187.       <Font "Arial"
  188.       <Text "2"
  189.       }
  190. ' Selects the 2
  191.     >PointSelect
  192.     {
  193.       <PointXYZ 3.7, -4, 0
  194.       <Type 0
  195.     }
  196. ' Arrays the 2
  197.     >Array
  198.     {
  199.       <PointXYZ 7.7, -4, 0
  200.       <PointXYZ 3.7, -9, 0
  201.       <NCopy 5,4,1
  202.       <AlongCurve 0
  203.       <Perpendicular 0
  204.     }
  205. ' Loop for Symbols
  206.     XD = 0
  207.     YD = -5
  208.     XA = .5
  209.     YA = -4
  210.     XB = 3.5
  211.     YB = -4
  212.     Count2 = 0
  213.     open "i", 3, "c:\list.txt"
  214.     For A = 1 to 20
  215.     Count2 = Count2 + 1
  216.     Input #3, C$
  217. ' Loads the Symbol
  218.     >Merge
  219.     {
  220.       <Layer 1
  221.       <PointXYZ [XA, YA, 0]
  222.       <PointXYZ [XB, YB, 0]
  223.       <Filename [C$]
  224.       <Type 1
  225.       <Scale 0
  226.       <Reference 0
  227.     }
  228.     XA = XA + 4
  229.     XB = XB + 4
  230.     if Count2 = 5 then 
  231.         YA = YA - 5
  232.         YB = YB - 5
  233.         XA = .5
  234.         XB = 3.5
  235.     endif
  236.     if Count2 = 10 then 
  237.         YA = YA - 5
  238.         YB = YB - 5
  239.         XA = .5
  240.         XB = 3.5
  241.     endif
  242.     if Count2 = 15 then
  243.         YA = YA - 5
  244.         YB = YB - 5
  245.         XA = .5
  246.         XB = 3.5
  247.     endif
  248. ' Draws the New Line
  249.     >Line
  250.     {
  251.       <Color 0,0,0
  252.       <Layer 1
  253.       <LineStyle 0,2.0000,0.0000
  254.       <PointXYZ [XD, YD, 0]
  255.       <PointXYZ [XD + 2, YD, 0]
  256.       <PointXYZ [XD + 2, YD + .25, 0]
  257.       }
  258. ' Selects the line just drawn
  259.     >PointSelect
  260.     {
  261.       <PointXYZ [XD + 2, YD + .25, 0]
  262.       <Type 0
  263.     }
  264. ' Deletes that line
  265.     >SelectDelete
  266.     {
  267.     }
  268. ' Adds text to the box
  269.     Input #4, Z$
  270.     Chop = LEN(Z$)
  271.     Chop2 = Chop - 3
  272.     Y$ = LEFT$(Z$, Chop2)
  273.     X$ = "(" + Y$ + ")"
  274.         >Text
  275.     {
  276.       <Color 0,0,0
  277.       <Layer 1
  278.       <PointXYZ [XD + 2, YD + .25, 0]
  279.       <PointXYZ [XD + 2, YD + .25, 0]
  280.       <Style 0
  281.       <Justification 0
  282.       <Size .25
  283.       <Angle 0.0000
  284.       <Font "Arial"
  285.       <Text [X$]
  286.       }
  287.     XD = XD + 4
  288.     if Count2 = 5 then
  289.         YD = YD -5
  290.         XD = 0
  291.     endif
  292.     if Count2 = 10 then
  293.         YD = YD -5
  294.         XD = 0
  295.     endif
  296.     if Count2 = 15 then
  297.         YD = YD -5
  298.         XD = 0
  299.     endif
  300. Next a
  301. ' Draws the Top Box
  302.     >2DBox
  303.     {
  304.       <Color 0,0,0
  305.       <Layer 1
  306.       <LineStyle 0,2.0000,0.0000
  307.       <PointXYZ 0, 0, 0 
  308.       <PointXYZ 20, .5, 0
  309.       <Type 1
  310.       <Orientation 0
  311.     }
  312. ' Draws the Inner Border
  313.     >2DBox
  314.     {
  315.       <Color 0,0,0
  316.       <Layer 1
  317.       <LineStyle 0,2.0000,0.0000
  318.       <PointXYZ 0, 2, 0 
  319.       <PointXYZ 20, -20, 0
  320.       <Type 1
  321.       <Orientation 0
  322.     }
  323. ' Fits the drawing to the window
  324.     >FitToWindow
  325.     {
  326.     }
  327. ' Adds the Description
  328.     >Text
  329.     {
  330.       <Color 0,0,0
  331.       <Layer 1
  332.       <PointXYZ [21, 1, 0]
  333.       <PointXYZ [21, 1, 0]
  334.       <PointXYZ [21, 1, 0]
  335.       <Style 0
  336.       <Justification 2
  337.       <Size .25
  338.       <Angle 0.0000
  339.       <Font "Arial"
  340.       <Text [DIS$]
  341.       }
  342. ' Adds the DesignCAD
  343.     >Text
  344.     {
  345.       <Color 0,0,0
  346.       <Layer 1
  347.       <PointXYZ [.5, .75, 0]
  348.       <Style 0
  349.       <Justification 0
  350.       <Size 1
  351.       <Angle 0.0000
  352.       <Font "Arial"
  353.       <Text "DesignCAD"
  354.       }
  355. ' Draws the Outer Border
  356.     >2DBox
  357.     {
  358.       <Color 0,0,0
  359.       <Layer 1
  360.       <LineStyle 0,2.0000,0.0000
  361.       <PointXYZ -.5, 2.5, 0 
  362.       <PointXYZ 20.5, -21, 0
  363.       <Type 1
  364.       <Orientation 0
  365.     }
  366. ' Adds the Archive Filename
  367.     Name$ = "Archive Filename:  " + ARC$
  368.     >Text
  369.     {
  370.       <Color 0,0,0
  371.       <Layer 1
  372.       <PointXYZ [0, -20.75, 0]
  373.       <Style 0
  374.       <Justification 0
  375.       <Size .25
  376.       <Angle 0.0000
  377.       <Font "Arial"
  378.       <Text [Name$]
  379.       }
  380. ' Adds the Group ID
  381.     >Text
  382.     {
  383.       <Color 0,0,0
  384.       <Layer 1
  385.       <PointXYZ [20, 2.1, 0]
  386.       <Style 0
  387.       <Justification 2
  388.       <Size .25
  389.       <Angle 0.0000
  390.       <Font "Arial"
  391.       <Text [GID$]
  392.       }
  393. ' Fits the drawing to the window
  394.     >FitToWindow
  395.     {
  396.     }
  397. ' Saves the file
  398.     Input "Please enter the drawing filename . . .", FN$
  399.     >SaveAs
  400.      {
  401.     <SaveChanges 0
  402.     <FileName [FN$]
  403.      }
  404.     >Close
  405.     {
  406.     }
  407.     >New
  408.     {
  409.     }
  410. close 3
  411. Count = 0
  412. goto Back2
  413. End
  414.