mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-29 10:10:25 -07:00
Fix LDraw entities persistence annotation
This commit is contained in:
parent
36a4e0e73d
commit
04a2754425
@ -18,7 +18,7 @@ class Alias
|
||||
/**
|
||||
* @var Model
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\LDraw\Model", inversedBy="aliases", cascade={"persist"})
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\LDraw\Model", inversedBy="aliases")
|
||||
*/
|
||||
private $model;
|
||||
|
||||
|
@ -5,6 +5,7 @@ namespace AppBundle\Entity\LDraw;
|
||||
use AppBundle\Entity\Traits\NumberTrait;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
@ -41,7 +42,7 @@ class Model
|
||||
/**
|
||||
* @var ArrayCollection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\LDraw\Subpart", mappedBy="parent")
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\LDraw\Subpart", mappedBy="parent", cascade={"persist"})
|
||||
*/
|
||||
private $subparts;
|
||||
|
||||
@ -269,6 +270,21 @@ class Model
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Subpart $subpart
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addSubpart($subpart)
|
||||
{
|
||||
if (!$this->subparts->contains($subpart)) {
|
||||
$this->subparts->add($subpart);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ class Subpart
|
||||
* @var Model
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\LDraw\Model", inversedBy="subparts", cascade={"persist"})
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\LDraw\Model", inversedBy="subparts")
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
|
@ -26,6 +26,8 @@ class LDViewService
|
||||
*/
|
||||
private $ldrawLibraryFilesystem;
|
||||
|
||||
private $rewrite = false;
|
||||
|
||||
/**
|
||||
* LDViewService constructor.
|
||||
*
|
||||
@ -64,7 +66,7 @@ class LDViewService
|
||||
|
||||
$newFile = 'ldraw'.DIRECTORY_SEPARATOR.'models'.DIRECTORY_SEPARATOR.basename($file,'.dat').'.stl';
|
||||
|
||||
if (!file_exists($newFile)) {
|
||||
if (!file_exists($newFile) || $this->rewrite) {
|
||||
$this->runLDView([
|
||||
$file,
|
||||
'-LDrawDir='.$this->ldrawLibraryFilesystem->getAdapter()->getPathPrefix(),
|
||||
@ -73,6 +75,8 @@ class LDViewService
|
||||
'-ExportsDir='.$this->mediaFilesystem->getAdapter()->getPathPrefix().'ldraw'.DIRECTORY_SEPARATOR.'models',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
// Check if file created successfully
|
||||
if (!$this->mediaFilesystem->has($newFile)) {
|
||||
throw new LogicException($newFile.': new file not found'); //TODO
|
||||
@ -98,18 +102,22 @@ class LDViewService
|
||||
|
||||
$newFile = 'ldraw'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.basename($file,'.dat').'.png';
|
||||
|
||||
if (!$this->mediaFilesystem->has($newFile)) {
|
||||
if (!$this->mediaFilesystem->has($newFile) || $this->rewrite) {
|
||||
$this->runLDView([
|
||||
$file,
|
||||
'-LDrawDir='.$this->ldrawLibraryFilesystem->getAdapter()->getPathPrefix(),
|
||||
'-AutoCrop=0',
|
||||
'-SaveAlpha=1',
|
||||
'-SaveAlpha=0',
|
||||
'-BackgroundColor3=0xFFFFFF',
|
||||
'-DefaultColor3=0x136FC3',
|
||||
'-SnapshotSuffix=.png',
|
||||
'-HiResPrimitives=1',
|
||||
'-CurveQuality=10',
|
||||
'-DefaultLatLong=40,35',
|
||||
'-UseQualityStuds=1',
|
||||
'-UseQualityLighting=1',
|
||||
'-SaveHeight=600',
|
||||
'-SaveWidth=800',
|
||||
'-CurveQuality=12',
|
||||
'-DefaultLatLong=45,40',
|
||||
'-SaveDir='.$this->mediaFilesystem->getAdapter()->getPathPrefix().'ldraw'.DIRECTORY_SEPARATOR.'images',
|
||||
'-SaveSnapshots=1',
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user