Load CAD document with options
Leave feedback
On this page
GroupDocs.Conversion provides CadLoadOptions to give you control over how the source CAD document will be processed. The following options could be set:
Option | Description |
---|---|
Format | The source document type is auto-detected, but you could set the source document format explicitly with this property. Available options are: Dxf, Dwg, Dgn, Dwf, Stl, Ifc, Plt, Igs, Dwt |
BackgroundColor | Specifies the background color for a CAD document. |
DrawType | Specifies the type of drawing of a CAD document. |
Width | Sets the desired page width |
Height | Sets the desired page height |
LayoutNames | Specifies which CAD layout to be converted |
The following code snippet shows how to convert a CAD document and convert only certain layouts:
With v24.10 and later:
Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new CadLoadOptions
{
LayoutNames = new []{ "Layout1", "Layout3" }
};
using (Converter converter = new Converter("with_layers_and_layouts.dwg", getLoadOptions))
{
PdfConvertOptions options = new PdfConvertOptions();
converter.Convert("converted.pdf", options);
}
Before v24.10:
Func<LoadOptions> getLoadOptions = () => new CadLoadOptions
{
LayoutNames = new []{ "Layout1", "Layout3" }
};
using (Converter converter = new Converter("with_layers_and_layouts.dwg", getLoadOptions))
{
PdfConvertOptions options = new PdfConvertOptions();
converter.Convert("converted.pdf", options);
}
The following code snippet shows how to convert a CAD document and specify its desired background color:
With v24.10 and later:
Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new CadLoadOptions
{
BackgroundColor = System.Drawing.Color.White
};
using (Converter converter = new Converter("sample.dwg", getLoadOptions))
{
PdfConvertOptions options = new PdfConvertOptions();
converter.Convert("converted.pdf", options);
}
Before v24.10:
Func<LoadOptions> getLoadOptions = () => new CadLoadOptions
{
BackgroundColor = System.Drawing.Color.White
};
using (Converter converter = new Converter("sample.dwg", getLoadOptions))
{
PdfConvertOptions options = new PdfConvertOptions();
converter.Convert("converted.pdf", options);
}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.