Hide Table of Contents
LoadFile4 Method (ISldWorks)

Loads a non-native SOLIDWORKS file (for example, *.igs, *.dxf, and so on) into a new model document.

.NET Syntax

Visual Basic (Declaration) 
Function LoadFile4( _
   ByVal FileName As System.String, _
   ByVal ArgString As System.String, _
   ByVal ImportData As System.Object, _
   ByRef Errors As System.Integer _
) As ModelDoc2
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim FileName As System.String
Dim ArgString As System.String
Dim ImportData As System.Object
Dim Errors As System.Integer
Dim value As ModelDoc2
value = instance.LoadFile4(FileName, ArgString, ImportData, Errors)
ModelDoc2 LoadFile4( 
   System.string FileName,
   System.string ArgString,
   System.object ImportData,
   out System.int Errors
ModelDoc2^ LoadFile4( 
&   System.String^ FileName,
&   System.String^ ArgString,
&   System.Object^ ImportData,
&   [Out] System.int Errors


Full path and file name of the non-native SOLIDWORKS file to import
Space-separated string that allows optional arguments to be specified when opening a foreign file (see Remarks)
IImportIgesDataIImportDxfDwgData, or IImportStepData object (see Remarks)

Errors as defined in swFileLoadError_e

Return Value

Model document



The general form of ArgString is Boolean and enumerator arguments, which should be passed as a string.

If importing...


Non-native files

Set ArgString to FWNS to display a FeatureWorks dialog after opening

Pro/E files

  • To import features, set ArgString to R

  • To import geometry, set ArgString to :

    • B Direct geometry import with knitting

    • C Direct geometry import without knitting

    • D Geometry import with knitting

    • E Geometry import without knitting

    • S Surface geometry import with knitting

These arguments are case sensitive. Specifying one of these options suppresses dialog.

Non DXF/DWG and Pro/E files

  • To import the foreign file into a new SOLIDWORKS document, set ArgString to r

  • To insert the foreign file into an existing SOLIDWORKS part document, set ArgString to i

For example, to import an IGES file named cup.igs into a new SOLIDWORKS document:

Set swModel = swApp.LoadFile4 "D:\Samples\cup.IGS", "r", importData, Err

See IImportIgesData for details about importing IGES data.


  • Whether the result is a surface or solid depends on the import options. See Import and Export File Options for details.

  • If ArgString is set to an empty string, then dialogs may be presented to the end-user during translation.


DXF/DWG files

You can:

  • Let SOLIDWORKS determine the default values:

    • Paper size and sheet scale are computed to fit the input data.

    • Length unit is determined from the header of the input DXF/DWG file.

    • Sheet name is the same as the layout name in the input DXF/DWG file.

 - or -

See IImportDxfDwgData for details about importing DXF/DWG data.


  • Getting the IImportDxfDwgData interface does not get default values from the input file. Any values not set by you are set to the values computed by SOLIDWORKS.

  • If the DWG/DXF file has multiple sheets, use these methods with a valid layout name in the Sheet argument to set up sheet specific settings, which overrides the default settings. If any of the individual items are not specified for a given layout name, the value used is from the defaults (layout name ""). If the default value is not specified, SOLIDWORKS computes and uses a meaningful value for that item.



See Also


SOLIDWORKS 2006 SP1, Revision Number 14.1

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:   LoadFile4 Method (ISldWorks)
*   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.