mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-17 21:00:09 -07:00
Improve models quality
Use high-quality studs
This commit is contained in:
parent
50248d4d69
commit
4cd5ce1874
@ -59,5 +59,10 @@ This command consists of multiple subcommands that can be called separately:
|
||||
4. Download images of models from rebrickable.com `$ bin/console app:load:images [--color=INT] [--rebrickable] [--missing]`
|
||||
5. Populate Elastisearch index `$ bin/console fos:elastica:populate`
|
||||
|
||||
##### Adding part relation
|
||||
Relations between LDraw models and Rebrickable parts are matched automatically by identical (or similar) id/name when executing command `$ bin/console app:load:relation`.
|
||||
|
||||
Unmatched relations can be specified by adding relation of IDs to `app/Resources/relations/part_model.yml`
|
||||
|
||||
## Testing
|
||||
You can run complete system tests by `$ phpunit`. These should cover the main system functions and the functionality of calling the third-party programs that are required are needed to seamlessly retrieve the necessary application data.
|
||||
|
@ -12,7 +12,7 @@ parameters:
|
||||
name: "PrintABrick"
|
||||
# rebrickable csv files root URL (http://rebrickable.com/media/downloads/ or local dir containing csv files)
|
||||
app.rebrickable_downloads_url: 'http://rebrickable.com/media/downloads/'
|
||||
app.ld_library_download_url: 'http://www.ldraw.org/library/updates/completeCA.zip'
|
||||
app.ld_library_download_url: 'http://www.ldraw.org/library/updates/complete.zip'
|
||||
|
||||
app.media_root: "%kernel.root_dir%/../var/media/"
|
||||
|
||||
|
@ -36,13 +36,13 @@ class ModelController extends Controller
|
||||
{
|
||||
$modelSearch = new ModelSearch();
|
||||
|
||||
$form = $formFactory->createNamedBuilder('', ModelSearchType::class, $modelSearch)->getForm();
|
||||
$form = $formFactory->createNamedBuilder('model', ModelSearchType::class, $modelSearch)->getForm();
|
||||
$form->handleRequest($request);
|
||||
|
||||
/** @var Paginator $paginator */
|
||||
$paginator = $this->get('knp_paginator');
|
||||
$models = $paginator->paginate(
|
||||
$searchService->searchModels($modelSearch),
|
||||
$searchService->searchModels($modelSearch,500),
|
||||
$request->query->getInt('page', 1)/*page number*/,
|
||||
$request->query->getInt('limit', 30)/*limit per page*/
|
||||
);
|
||||
|
@ -45,9 +45,6 @@ class ModelLoader extends BaseLoader
|
||||
/** @var RelationMapper */
|
||||
private $relationMapper;
|
||||
|
||||
/** @var string */
|
||||
private $LDLibraryUrl;
|
||||
|
||||
/** @var bool */
|
||||
private $rewrite = false;
|
||||
|
||||
@ -90,6 +87,12 @@ class ModelLoader extends BaseLoader
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download library form $url, unzip archive and return directory path with library
|
||||
*
|
||||
* @param $url
|
||||
* @return bool|string
|
||||
*/
|
||||
public function downloadLibrary($url)
|
||||
{
|
||||
$this->writeOutput([
|
||||
@ -116,6 +119,11 @@ class ModelLoader extends BaseLoader
|
||||
|
||||
$this->writeOutput(['<info>LDraw libary downloaded</info>']);
|
||||
|
||||
// return ldraw directory if in zip file
|
||||
if(file_exists($temp_dir.'/ldraw/')) {
|
||||
return $temp_dir.'/ldraw/';
|
||||
}
|
||||
|
||||
return $temp_dir;
|
||||
}
|
||||
|
||||
@ -160,6 +168,7 @@ class ModelLoader extends BaseLoader
|
||||
]);
|
||||
|
||||
$files = $this->ldrawLibraryContext->listContents('parts', false);
|
||||
|
||||
$this->initProgressBar(count($files));
|
||||
|
||||
$index = 0;
|
||||
@ -274,7 +283,7 @@ class ModelLoader extends BaseLoader
|
||||
|
||||
try {
|
||||
// update model only if newer version
|
||||
if (!$model->getModified() || ($model->getModified() < $modelArray['modified'])) {
|
||||
if ($this->rewrite || ($model->getModified() < $modelArray['modified'])) {
|
||||
$stl = $this->stlConverter->datToStl($file, $this->rewrite)->getPath();
|
||||
|
||||
$model->setPath($stl);
|
||||
|
@ -83,6 +83,7 @@ class StlConverterService
|
||||
'-LDrawDir='.$this->ldrawLibraryContext->getAdapter()->getPathPrefix(),
|
||||
'-ExportFiles=1',
|
||||
'-ExportSuffix=.stl',
|
||||
'-UseQualityStuds=1',
|
||||
'-ExportsDir='.$this->mediaFilesystem->getAdapter()->getPathPrefix().'models',
|
||||
]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user