Skip to content

GettingStarted

Joe Pietler edited this page Dec 30, 2016 · 1 revision

To start with DXFighter just download or clone the repository to your project and include the DXFighter.php file in your .php file using

<?php
require_once('DXFighter.php');

Now you are able to use DXFighter by creating an instance of a DXFighter and add some Elements to it.

<?php
require_once('DXFighter.php');

$fighter = new \DXFighter\DXFighter(); //Create an Instance of the DXFighter class

$fighter->addEntity(new \DXFighter\lib\Line(array(0, 0, 0), array(10, 10, 0))); //Draw a line from Point (0|0|0) to (10|10|0)

$fighter->addEntity(new \DXFighter\lib\Circle(array(5, 0, 0), 3)); //Draw a circle centered on (5|0|0) with a radius of 3

Now that our fighter has some elements stored we can export the DXF equivalent of these objects

$fighter->to_string(); //Output the DXF using echo

$fighter->saveAs('dxfighter.dxf'); //Write the DXF to a file named dxfighter.dxf
Clone this wiki locally