Convert CF2 to OBJ in C#

CAD applications use CF2 files for creating 2D or 3D drawings. Specifically, we can create and save designs for construction projects such as highways, bridges, and buildings in a CF2 file. In certain cases, we may need to export drawings from CF2 files to OBJ documents programmatically. Such conversions allow sharing of drawings in a portable format. In this article, we will learn how to convert a CF2 file to a OBJ in C#.

The following topics shall be covered in this article:

  1. C# CF2 to OBJ Converter – Free Download
  2. Steps to Convert CF2 File to OBJ Document
  3. Convert CF2 to OBJ Programmatically
  4. Export CF2 to OBJ with Options

C# CF2 to OBJ Converter – Free Download

To convert a CF2 file to a OBJ document, we will be using the Aspose.CAD for .NET API. It allows creating, editing, and manipulating CF2 files and several other file formats.

The Image class of the API is the base class for all types of drawings. The Cf2Image class represents a CF2 image. We can set PageWidth and PageHeight properties using the CadRasterizationOptions class. The ObjOptions class of the API allows specifying the OBJ options.

Please either download the DLL of the API or install it using NuGet.

PM> Install-Package Aspose.CAD

How to Convert CF2 File to OBJ using C#

We can easily convert a CF2 file to a OBJ document using Aspose.CAD for .NET by following the steps given below:

  • Load a CF2 drawing file.
  • Save CF2 as OBJ.

Now, let’s see how to perform these steps in C# to convert a CF2 file to a OBJ document.

Convert CF2 to OBJ Programmatically in C#

Please follow the steps given below to convert a CF2 to a OBJ:

  1. Firstly, load an input CF2 file using the Image class.
  2. After that, create an instance of the ObjOptions class.
  3. Finally, call Save() method to save it as a OBJ. It takes the output OBJ file path and ObjOptions as arguments.

The following code sample shows how to convert a CF2 file to a OBJ document using C#.

Export CF2 to OBJ with Options in C#

We can specify OBJ save options while converting a CF2 file to a OBJ document by following the steps given below:

  1. Firstly, load an input CF2 file using the Image class.
  2. Next, create an instance of the CadRasterizationOptions class.
  3. Then, specify the page height and width.
  4. Next, create an instance of the ObjOptions class.
  5. After that, set the VectorRasterizationOptions property as CadRasterizationOptions.
  6. Finally, call Save() method to save it as a OBJ. It takes the output OBJ file path and ObjOptions as arguments.

The following code sample shows how to specify the page height and width while saving a CF2 file as a OBJ document using C#.

Get Free Temporary License

You can get a free temporary license to try the library without evaluation limitations.

Conclusion

In this article, we have learned how to:

  • load an existing CF2 drawing file;
  • specify page height and width;
  • define save options;
  • save CF2 as a OBJ in C#.

Besides converting a CF2 to a OBJ in C#, you can learn more about Aspose.CAD for .NET API using the documentation. In case of any ambiguity, please feel free to contact us on our free support forum.

See Also