Skip to content

Commit 9e5e7b7

Browse files
committed
Update Creator.php
Update "addText" method (position and angle)
1 parent 0a3a9c2 commit 9e5e7b7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Creator.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,15 @@ public function addLine($x, $y, $z, $x2, $y2, $z2)
281281
* @param float $z
282282
* @param string $text
283283
* @param float $textHeight Text height
284+
* @param integer $position Position of text from point: 1 = top-left; 2 = top-center; 3 = top-right; 4 = center-left; 5 = center; 6 = center-right; 7 = bottom-left; 8 = bottom-center; 9 = bottom-right
285+
* @param float $angle Angle of text in degrees (rotation)
284286
* @return Creator Instance
285287
* @see http://www.autodesk.com/techpubs/autocad/acad2000/dxf/text_dxf_06.htm
286288
*/
287-
public function addText($x, $y, $z, $text, $textHeight)
289+
public function addText($x, $y, $z, $text, $textHeight, $position = 7, $angle = 0)
288290
{
289-
$this->shapes[] = "TEXT\n8\n{$this->layerName}\n 10\n{$x}\n 20\n{$y}\n 30\n{$z}\n 40\n{$textHeight}\n 1\n{$text}\n 0\n";
291+
$angle = deg2rad($angle);
292+
$this->shapes[] = "TEXT\n8\n{$this->layerName}\n10\n{$x}\n20\n{$y}\n30\n{$z}\n40\n{$textHeight}\n71\n{$position}\n1\n{$text}\n50\n{$angle}\n0\n";
290293
return $this;
291294
}
292295

0 commit comments

Comments
 (0)