PHP Library for AutoCAD DXF Files Reading & Writing
Open Source PHP CAD library that enables programmers to read and write AutoCAD DXF Files. It supports basic DXF exports & read lines from file.
DXFighter is a very useful open source PHP library that allows computer programmers to work with AutoCAD DXF Files inside their own PHP applications. AutoCAD DXF is a very popular CAD data file format created by Autodesk for enabling data interoperability between AutoCAD and other software packages. DXFighter is a great tool for basic DXF exports which don't rely on the newest DXF version.
The DXFighter has included reading and writing support and outputs AC1012 (R15) DXF files using PHP. The library is very simple to handle and allows developers to work with basic diagramming entities inside their own apps. It provides writing support for entities like Arcs, Circles, Ellipses, Lines, WPolyline, Points, Polyline, Text, Spline, and Insert. The library also provides reading support for some very useful entity types such as Ellipses, Lines, Polyline, Text, Spline, and Insert. This DXFighter library is published under BSD 3-Clause license.
Getting Started with DXFighter
The recommended way to install DXFighter is using GitHub. Please use the following command a smooth installation.
Clone DXFighter via NuGet GitHub
git clone https://github.com/enjoping/DXFighter.git
You can also install it manually; download the latest release files directly from GitHub repository.
Generate AutoCAD DXF Drawing via PHP Library
The open source DXFighter library has incorporated complete functionality for generating AutoCAD DXF documents inside PHP applications. Once the DXF file is created, users can add and manage different kinds of entities inside the drawings such as Arcs, Circles, Ellipses, Lines, WPolyline, Points, Polyline, Text, Spline, and Insert. At the moment the library only allows to add entities and update their properties, other will follow soon.
AutoCAD DXF File Reading inside PHP Apps
The DXFighter library has included a powerful reader that enables software developers to open and read the contents of AutoCAD DXF documents with just a couple of lines of code. At the moment the library has included support for reading some important entities such as Ellipses, Lines, Polyline, Text, Spline and Insert.
How to Read Lines from DXF File via PHP API
The open source DXFighter library allows software developers to open an AutoCAD DXF documents and read some lines from it using just a couple of PHP commands. To achieve this task user need to get the Line object from the Entities array and access its properties. The following example demonstrates how to read lines from DXF File.
Read Lines from DXF File via PHP API
use DXFighter\DXFighter;
$dxf = new DXFighter('some-file.dxf');
echo "Loaded OK.\n";
$entities = $dxf->getEntities();
$line = $entities[0];
$end = $line->getEnd();
echo "Saw line to {$end[0]},{$end[1]},{$end[2]}\n";
}