home *** CD-ROM | disk | FTP | other *** search
- 'Program to get the id and name of each layer in the drawing
-
- Sub Main()
-
- Dim dActive As Long
- Dim hDrawing As Long
- Dim count As Long
- Dim i As Long
- Dim k As Long
- Dim LayerID As Long
- Dim LayVar As String
- Dim LayVis As String
- Dim Result As Variant
- Dim Vis As Long
- Dim CountVis As Long
- Dim DirName As String
- Dim FileName As String
-
- DirName = InputBox("Type in the directory where TurboCAD is installed:","TurboCAD","c:\imsi\tcw40")
- if DirName<>"" Then
- FileName = DirName+"\Samples\mouse.tcw"
- hDrawing = TCWDrawingOpen(FileName)
- if hDrawing = 0 then
- Stop
- end if
- count = TCWLayersCount()+1
- k = 1
- LayVar = "Name"
- LayVis= "Visible"
- Do While (k<count)
- LayerID = TCWLayersAt(k)
- Result=TCWLayerPropertySet(LayerID,LayVis,0)
- k = k + 1
- Loop
- Result=TCWViewRedraw()
-
- i=1
-
- Do While (i < count)
- k=1
- Do While(k<i)
- LayerID = TCWLayersAt(k)
- Result = TCWLayerPropertySet(LayerID,LayVis,0)
- k=k + 1
- Loop
-
- k=i + 1
- Do While(k<count)
- LayerID = TCWLayersAt(k)
- Result = TCWLayerPropertySet(LayerID,LayVis,0)
- k=k + 1
- Loop
- LayerID = TCWLayersAt(i)
- Result = TCWLayerPropertySet(LayerID,LayVis,1)
- Result=TCWViewRedraw()
- Result = TCWLayerPropertyGet(LayerID, LayVar)
- MsgBox "Layer "&Str(LayerID) & Chr(10) & Chr(34) & Result & Chr(34)
- i = i + 1
- Loop
-
- k=count - 1
- LayerID = TCWLayersAt(k)
- Result = TCWLayerPropertySet(LayerID,LayVis,0)
- Result=TCWViewRedraw()
-
- 'MsgBox "All layers:"
-
- 'i=1
- 'Do While (i < count)
- ' LayerID = TCWLayersAt(i)
- ' Result = TCWLayerPropertySet(LayerID,LayVis,1)
- ' i=i + 1
- 'Loop
-
- 'Result=TCWViewRedraw()
-
- MsgBox "Finished"
- TCWDrawingClose(0)
-
- End If
- End Sub
-
-
-
-
-
-