public function toString() { $content = ""; $content .= empty($this->preBody) ? "" : $this->preBody->toString(); $content .= parent::toString(); $content .= empty($this->postBody) ? "" : $this->postBody->toString(); return $content; }
<?php // test code for DFXwriter require 'DXFwriter.php'; $d = new DxfWriter(); $b = new DxfBlock(array('name' => 'test')); $b->append(new DxfSolid(array('points' => array(array(0, 0), array(1, 0), array(1, 1), array(0, 1)), 'color' => 1))); $b->append(new DxfArc(array('center' => array(1, 0), 'color' => 2))); $d->appendBlock($b); $d->appendStyle(new DxfStyle()); $d->appendView(new DxfView(array('name' => 'Normal'))); $d->appendView(DxfViewByWindow('Window', array(1, 0), array(2, 1))); $d->appendLineType(new DxfLineType(array('name' => 'DASHED', 'description' => '- - -', 'elements' => array(array('length' => 0.8), array('length' => -0.2))))); $d->append(new DxfCircle(array('center' => array(1, 1), 'color' => 3))); $d->append(new DxfFace(array('points' => array(array(0, 0), array(1, 0), array(1, 1), array(0, 1)), 'color' => 4))); $d->append(new DxfInsert(array('name' => 'test', 'point' => array(3, 3), 'cols' => 5, 'colspacing' => 2))); $d->append(new DxfLine(array('lineType' => 'DASHED', 'points' => array(array(0, 0), array(5, 5))))); /* $d->append(new DxfLwPolyLine(array('points'=>array(array(0, 0), array(1, 0), array(1, 1), array(0, 1)), 'flag'=>129, 'layer' => "DXFWRITER", 'color'=>7, 'width'=>1, 'lineType'=>'CONTINUOUS', 'lineWeight' => 0) )); */ $d->append(new DxfPolyLine(array('points' => array(array(1, 1), array(20, 10), array(20, 20), array(1, 15)), 'lineType' => 'DASHED', 'flag' => 0)));
public function toBlock() { $block = new DxfBlock(); $block->add(0, "BLOCK"); $block->add(5, $this->handle); $block->add(330, $this->blockRecordHandle); $block->add(100, "AcDbEntity"); $block->add(8, 0); $block->add(100, "AcDbBlockBegin"); $block->add(2, $this->name); $block->add(70, 0); $block->add(10, $this->basePoint[0]); $block->add(20, $this->basePoint[1]); $block->add(30, "0.0"); $block->add(3, $this->name); $block->add(1, ""); $block->addBlock($this->content); $block->add(0, "ENDBLK"); $block->add(5, $this->endHandle); $block->add(330, $this->blockRecordHandle); $block->add(100, "AcDbEntity"); $block->add(8, 0); $block->add(100, "AcDbBlockEnd"); return $block; }
public function toBlock() { $record = new DxfBlock(); $record->add(0, "BLOCK_RECORD"); $record->add(5, $this->handle); $record->add(330, 1); $record->add(100, "AcDbSymbolTableRecord"); $record->add(100, "AcDbBlockTableRecord"); $record->add(2, $this->name); $record->add(340, 0); if (count($this->refs) > 0) { $record->add(102, "{BLKREFS"); foreach ($this->refs as $ref) { $record->add(331, $ref); } $record->add(102, "}"); } $record->add(70, 0); $record->add(280, 1); $record->add(281, 0); return $record; }