Hide Table of Contents
ExportToDWG2 Method (IPartDoc)

Saves various aspects of a part (sheet metal, faces, loops, and annotation views) to one or more DXF/DWG files, preserving the specified filename.

.NET Syntax

Visual Basic (Declaration) 
Function ExportToDWG2( _
   ByVal FilePath As System.String, _
   ByVal ModelName As System.String, _
   ByVal Action As System.Integer, _
   ByVal ExportToSingleFile As System.Boolean, _
   ByVal Alignment As System.Object, _
   ByVal IsXDirFlipped As System.Boolean, _
   ByVal IsYDirFlipped As System.Boolean, _
   ByVal SheetMetalOptions As System.Integer, _
   ByVal Views As System.Object _
) As System.Boolean
Visual Basic (Usage) 
Dim instance As IPartDoc
Dim FilePath As System.String
Dim ModelName As System.String
Dim Action As System.Integer
Dim ExportToSingleFile As System.Boolean
Dim Alignment As System.Object
Dim IsXDirFlipped As System.Boolean
Dim IsYDirFlipped As System.Boolean
Dim SheetMetalOptions As System.Integer
Dim Views As System.Object
Dim value As System.Boolean
value = instance.ExportToDWG2(FilePath, ModelName, Action, ExportToSingleFile, Alignment, IsXDirFlipped, IsYDirFlipped, SheetMetalOptions, Views)
System.bool ExportToDWG2( 
   System.string FilePath,
   System.string ModelName,
   System.int Action,
   System.bool ExportToSingleFile,
   System.object Alignment,
   System.bool IsXDirFlipped,
   System.bool IsYDirFlipped,
   System.int SheetMetalOptions,
   System.object Views
System.bool ExportToDWG2( 
&   System.String^ FilePath,
&   System.String^ ModelName,
&   System.int Action,
&   System.bool ExportToSingleFile,
&   System.Object^ Alignment,
&   System.bool IsXDirFlipped,
&   System.bool IsYDirFlipped,
&   System.int SheetMetalOptions,
&   System.Object^ Views


Path and filename of the exported DXF/DWG file
Path and filename of the active part document
Export action as defined in swExportToDWG_e
True to save as one file; false to save as multiple files

Array of 12 double values that contain information related to output alignment

True to flip the x direction; false otherwise
True to flip the y direction; false otherwise

Bitmask that contains sheet metal export options; valid only if Action = swExportToDWG_e.swExportToDWG_ExportSheetMetal

Array of annotation view names to export; valid only if Action = swExportToDWG_e.swExportToDWG_ExportAnnotationViews

Return Value

True if export is successful; false if not



This method supersedes IPartDoc::IExportToDWG by:

  • Adding an option to SheetMetalOptions to export a sheet metal bounding box.
  • Not prepending the flat-pattern name to the FilePath filename of the exported DXF/DWG when ExportToSingleFile is false.

Alignment array is as follows:

Array[0], Array[1], Array[2] - XYZ coordinates of new origin

Array[3], Array[4], Array[5] - coordinates of new x direction vector

Array[6], Array[7], Array[8] - coordinates of new y direction vector

Array[9], Array[10], Array[11] - coordinates of the vector that is normal to the selected faces or loops

The last three elements of the array are valid only if Action = 2.

The bitmask for SheetMetalOptions is {12 11 10 9 8 7 6 5 4 3 2 1}, where each bit is either 0 or 1 as follows:

Bit #1: 1 to export flat-pattern geometry; 0 to not

Bit #2: 1 to include hidden edges; 0 to not

Bit #3: 1 to export bend lines; 0 to not

Bit #4: 1 to include sketches; 0 to not

Bit #5: 1 to merge coplanar faces; 0 to not

Bit #6: 1 to export library features; 0 to not

Bit #7: 1 to export forming tools; 0 to not

Bit #8: 0

Bit #9: 0

Bit #10: 0

Bit #11: 0

Bit #12: 1 to export bounding box; 0 to not


If you want to export flat-pattern geometry, bend lines, and sketches, then Bits 1, 3, and 4 are 1, the bitmask is 0001101, and you need to set SheetMetalOptions = 2^0 + 2^2 + 2^3 = 1 + 4 + 8 = 13.

If you want to export only the bounding box, then Bit 12 is 1, the bitmask is 100000000000, and you need to set SheetMetalOptions = 2^11 = 2048.


See Also


SolidWorks 2014 FCS, Revision Number 22.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:   ExportToDWG2 Method (IPartDoc)
*   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) 2014 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.