Adjusting CAD Drawing Size
Adjusting CAD drawing size
Aspose.CAD for Python provides the UnitType enumeration to adjust the size of the drawing during the conversion of the CAD format. There are two ways to adjust the drawing size.
- Automatic size adjustment.
- Adjust size by using the UnitType enumeration of the ImageOptions class
For automatically adjusting the size, developers do not need to provide the Width and Height properties of the CadRasterizationOptions class. Below provided code snippet is an example of automatic sizing.
import aspose.cad as cad | |
cadImage = cad.Image.load(...) | |
rasterizationOptions = cad.imageoptions.CadRasterizationOptions() | |
bmpOptions = cad.imageoptions.BmpOptions() | |
rasterizationOptions.unit_type = cad.imageoptions.UnitType.CENTIMENTER | |
rasterizationOptions.layouts = ["Model"] | |
bmpOptions.vector_rasterization_options = rasterizationOptions | |
cadImage.save("result.bmp", bmpOptions) |
The UnitType enumeration gives the ability to adjust scaling when Width and Height properties are not set. Below provided code snippet demonstrate how to use UnitType.
import aspose.cad as cad | |
cadImage = cad.Image.load(...) | |
rasterizationOptions = cad.imageoptions.CadRasterizationOptions() | |
bmpOptions = cad.imageoptions.BmpOptions() | |
rasterizationOptions.unit_type = cad.imageoptions.UnitType.CENTIMENTER | |
rasterizationOptions.layouts = ["Model"] | |
bmpOptions.vector_rasterization_options = rasterizationOptions | |
cadImage.save("result.bmp", bmpOptions) |