Convert DXF to FBX in C#

DXF files are used by CAD software to produce 2D or 3D drawings. In particular, a DXF file can be used to produce and save plans for construction projects like roads, bridges, and buildings. In some circumstances, we might need to programmatically export drawings from DXF files to FBX documents. These transformations enable the portable sharing of drawings. This post will teach you how to do a DXF to FBX conversion in C#.

The following topics shall be covered in this article:

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

C# DXF to FBX Converter – Free Download

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

The fundamental class for all forms of drawings in the API is Image. A DXF image is represented by the CadImage class. Using the CadRasterizationOptions class, we may modify the PageWidth and PageHeight attributes. The API’s FbxOptions class enables for the specification of FBX options.

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

PM> Install-Package Aspose.CAD

How to Convert DXF File to FBX using C#

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

  • Load a DXF drawing file.
  • Save DXF as FBX.

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

Convert DXF to FBX Programmatically in C#

Please follow the steps given below to convert a DXF to a FBX:

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

The following code sample shows how to convert a DXF file to a FBX document using C#.

Export DXF to FBX with Options in C#

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

  1. First, open a DXF file using the CadImage class as an input.
  2. Next, make a new instance of the class CadRasterizationOptions.
  3. Next, enter the width and height of the page.
  4. After that, make an instance of the class FbxOptions.
  5. Next, choose CadRasterizationOptions for the VectorRasterizationOptions property.
  6. To save it as an FBX, call the Save() method last. It accepts two arguments: FbxOptions and the path to the output FBX file. The following code sample shows how to specify the page height and width while saving a DXF file as a FBX 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 DXF drawing file;
  • specify page height and width;
  • define save options;
  • save DXF as a FBX in C#.

A file format is just a standardised way in which information is encoded for storage in a file, and software programmes are designed to read specific file formats. Besides converting a DXF to a FBX 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