The SOLIDWORKS API recommends using the method ISldWorks::LoadFile4
to load non-native files.
This is what the API docs say aboot dwg files with the LoadFile4.
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.
Set your own values by using:
ISldWorks::GetImportFileData to obtain the IImportDxfDwgData
interface.
Use the following methods with a Sheet argument of "" (an empty
string) to set up your defaults before loading the file:
IImportDxfDwgData::GetPaperSize
IImportDxfDwgData::GetPosition
IImportDxfDwgData::GetSheetScale
IImportDxfDwgData::ImportMethod
IImportDxfDwgData::LengthUnit
IImportDxfDwgData::SetPaperSize
IImportDxfDwgData::SetPosition
IImportDxfDwgData::SetSheetScale
IImportDxfDwgData::SheetName
See IImportDxfDwgData for details about importing DXF/DWG data.
NOTES:
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.