home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / turbocad / V4 / tcw.z / layer.bas < prev    next >
BASIC Source File  |  1997-10-28  |  2KB  |  87 lines

  1. 'Program to get the id and name of each layer in the drawing
  2.  
  3. Sub Main()
  4.  
  5. Dim dActive As Long
  6. Dim hDrawing As Long
  7. Dim count As Long
  8. Dim i As Long
  9. Dim k As Long
  10. Dim LayerID As Long
  11. Dim LayVar As String
  12. Dim LayVis As String
  13. Dim Result As Variant
  14. Dim Vis As Long
  15. Dim CountVis As Long
  16. Dim DirName As String
  17. Dim FileName As String
  18.  
  19.  DirName = InputBox("Type in the directory where TurboCAD is installed:","TurboCAD","c:\imsi\tcw40")
  20.  if DirName<>"" Then              
  21. FileName = DirName+"\Samples\mouse.tcw"
  22. hDrawing = TCWDrawingOpen(FileName)
  23. if hDrawing = 0 then
  24. Stop
  25. end if
  26. count = TCWLayersCount()+1
  27. k = 1
  28. LayVar = "Name"
  29. LayVis= "Visible"
  30. Do While (k<count)
  31.     LayerID = TCWLayersAt(k)
  32.     Result=TCWLayerPropertySet(LayerID,LayVis,0)
  33.                 k = k + 1
  34. Loop
  35.                 Result=TCWViewRedraw()
  36.  
  37. i=1
  38.  
  39. Do While (i < count)
  40.   k=1
  41. Do While(k<i)
  42.     LayerID = TCWLayersAt(k)
  43.     Result = TCWLayerPropertySet(LayerID,LayVis,0)
  44.                 k=k + 1
  45. Loop
  46.              
  47.   k=i + 1
  48. Do While(k<count)
  49.     LayerID = TCWLayersAt(k)
  50.     Result = TCWLayerPropertySet(LayerID,LayVis,0)
  51.                 k=k + 1
  52. Loop
  53.     LayerID = TCWLayersAt(i)
  54.     Result = TCWLayerPropertySet(LayerID,LayVis,1)
  55.                 Result=TCWViewRedraw()
  56.                 Result = TCWLayerPropertyGet(LayerID, LayVar)
  57.     MsgBox "Layer "&Str(LayerID) & Chr(10) & Chr(34) & Result & Chr(34) 
  58.     i = i + 1
  59. Loop
  60.  
  61. k=count - 1
  62.     LayerID = TCWLayersAt(k)
  63.     Result = TCWLayerPropertySet(LayerID,LayVis,0)
  64.                 Result=TCWViewRedraw()
  65.  
  66. 'MsgBox "All layers:"
  67.  
  68. 'i=1
  69. 'Do While (i < count)
  70. '    LayerID = TCWLayersAt(i)
  71. '    Result = TCWLayerPropertySet(LayerID,LayVis,1)
  72. '                i=i + 1
  73. 'Loop
  74.  
  75. 'Result=TCWViewRedraw()
  76.  
  77. MsgBox "Finished"
  78. TCWDrawingClose(0)
  79.  
  80. End If
  81. End Sub
  82.  
  83.  
  84.  
  85.  
  86.  
  87.