PHP Classes

PHP DXF Create: Generate CAD files in the AutoCAD DXF format

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 51%Total: 1,229 This week: 1All time: 3,112 This week: 34Up
Version License PHP version Categories
dxf-writer 0.1GNU General Publi...4.0Graphics
Description 

Author

This class can generate CAD files in the AutoCAD DXF format.

It can add different types of vectorial graphics elements to the composition of a drawing like lines, circles and text.

The class supports multiple layers, each with its own color and line type. Each element may be added to a distinct layer.

The composed drawing generated in AutoCAD DXF format and returned as a string or served as file for download.

Innovation Award
PHP Programming Innovation award nominee
March 2013
Number 4
DXF is a well known file format used by applications like AutoCAD to export and import vectorial graphics drawings.

This class can create drawings and export them in the DXF format.

Manuel Lemos
Picture of Alessandro Vernassa (speleoalex)
Name: Alessandro Vernassa ... is available for providing paid consulting. Contact Alessandro Vernassa ... .
Classes: 3 packages by
Country: Italy Italy
Age: 46
All time rank: 106040 in Italy Italy
Week rank: 44 Up2 in Italy Italy Up
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Example

<?php
/**
 * @author Alessandro Vernassa
 */
ob_start();
require_once
'dxfwriter.php';
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>DXF Writer</title>
    </head>
    <body>
        <pre>CODE:
        $shape = new DXF();
        $shape->addLayer("mylayer", DXF_COLOR_RED);
        $shape->addLayer("text", DXF_COLOR_BLUE);
        $shape->addText(12, 110, 0, "HELLO WORLD", 5, "text");
        $shape->addCircle(50, 100, 0, 50, "mylayer");
        $shape->addLine(0, 100, 0, 100, 100, 0, "mylayer");
        </pre>
        <a href="?download">download dxf</a><br />
        <?php
        $shape
= new DXF();
       
$shape->addLayer("mylayer", DXF_COLOR_RED);
       
$shape->addLayer("text", DXF_COLOR_BLUE);
       
$shape->addText(12, 110, 0, "HELLO WORLD", 5, "text");
       
$shape->addCircle(50, 100, 0, 50, "mylayer");
       
$shape->addLine(0, 100, 0, 100, 100, 0, "mylayer");
        if (isset(
$_GET['download']))
        {
           
$shape->SaveFile("myFile.dxf");
        }
       
$dxfstring = $shape->getString();
       
        echo
"<h2>dxf string:</h2><pre>$dxfstring</pre>";
       
?>
</body>
</html>


  Files folder image Files (2)  
File Role Description
Plain text file dxfwriter.php Class DXF class source
Accessible without login Plain text file example.php Example example

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,229
This week:1
All time:3,112
This week:34Up
User Ratings User Comments (1)
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:66%StarStarStarStar
Tests:-
Videos:-
Overall:51%StarStarStar
Rank:2521