ArcObjects Library Reference  (DataSourcesFile)    

ICadDrawingLayers Example

[Visual Basic 6.0]

Public Sub CadDrawingLayers()

  'Set the Workspace Factory
  Dim pWorkspaceFact As IWorkspaceFactory
  Set pWorkspaceFact = New CadWorkspaceFactory

  'Open the Workspace
  Dim pWorkspace As IWorkspace
  Set pWorkspace = pWorkspaceFact.OpenFromFile("c:\data", 0)

  'Set the Feature Workspace
  Dim pFeatureWorkspace As IFeatureWorkspace
  Set pFeatureWorkspace = pWorkspace

  'Open the Feature Class
  Dim pFeatClass As IFeatureClass
  Set pFeatClass = pFeatureWorkspace.OpenFeatureClass("Parcels.dwg:Polyline")

  'Set the Feature Layer to the Feature Class
  Dim pFeatLayer As IFeatureLayer
  Set pFeatLayer = New CadFeatureLayer
  Set pFeatLayer.FeatureClass = pFeatClass

  'Set the CadDrawingLayer to the Feature Layer
  Dim pCadDwgLayers As ICadDrawingLayers
  Set pCadDwgLayers = pFeatLayer

  'List the Drawing Layer Count
  Debug.Print "Drawing layer count: " & pCadDwgLayers.DrawingLayerCount
  Dim i As Integer

  'Loop through the drawing layers
  For i = 0 To pCadDwgLayers.DrawingLayerCount - 1
    'List the drawing layer names
    Debug.Print "Drawing layer name:                  " & pCadDwgLayers.DrawingLayerName(i)
    'List the drawing layer's visibility
    Debug.Print "Is drawing layer visible?            " & pCadDwgLayers.DrawingLayerVisible(i)
    'List the drawing layer's original visibility
    Debug.Print "Is drawing layer originally visible? " &     pCadDwgLayers.OriginalDrawingLayerVisible(i)
  Next i
 
End Sub


[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter button Language Filter in the upper-left corner of the page.