Hide Table of Contents
SetImportLayerVisibility Method (IImportDxfDwgData)

Sets whether the specified layers are imported hidden or visible.

.NET Syntax

Visual Basic (Declaration) 
Function SetImportLayerVisibility( _
   ByVal Layers As System.Object, _
   ByVal Visibility As System.Integer _
) As System.Boolean
Visual Basic (Usage) 
Dim instance As IImportDxfDwgData
Dim Layers As System.Object
Dim Visibility As System.Integer
Dim value As System.Boolean
value = instance.SetImportLayerVisibility(Layers, Visibility)
System.bool SetImportLayerVisibility( 
   System.object Layers,
   System.int Visibility
System.bool SetImportLayerVisibility( 
&   System.Object^ Layers,
&   System.int Visibility


Array of strings of the names of the layers (see Remarks)
Visibility of the layers as defined in swImportDxfDwg_LayerVisibility_e

Return Value

True if setting the visibility of these layers is successful, false if not


This method only supports importing to a drawing; it does not support importing to a part sketch.


The Layers argument can contain either a string or an array of strings, where the strings are the layer names with which to work. You can also specify the argument as empty, which indicates all layers. If this method is not used, the default behavior is to import all layers with the same visibility as they have in the DXF/DWG file.  


The layer visibility is the same for all sheets that are imported; you cannot specify the layer visibility on a sheet-by-sheet basis.


Hidden layers are always imported to the drawing sheet.


You should first specify the behavior that applies to all layers, using an empty VARIANT, because this overrides any information you have previously entered for specific layers. Then, you should use this method with layer names in the VARIANT, to override that default behavior on a layer-by-layer basis.

Visual Basic for Applications (VBA) Example

To import all layers with the same visibility as in the DXF/DWG file (this is the default behavior):

boolstatus = ImportDxfDwgData.SetImportLayerVisibility (emptyVariant, swImportDxfDwg_LayerMaintain)


To import layer "A" hidden and the remaining layers visible:

boolstatus = ImportDxfDwgData.SetImportLayerVisibility (emptyVariant, swImportDxfDwg_LayerVisible)

layerName = "A"

layerVariant = layerName


boolstatus = ImportDxfDwgData.SetImportLayerVisibility ((layerVariant), swImportDxfDwg_LayerHidden)


See Also


SOLIDWORKS 2007 FCS, Revision Number 15.0

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   SetImportLayerVisibility Method (IImportDxfDwgData)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2015 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.