mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-18 05:10:07 -07:00
Fix loading of keywords
This commit is contained in:
parent
b712678a2c
commit
fb0a26901d
@ -58,7 +58,7 @@ class LDModelParser
|
|||||||
if (!$firstLine) {
|
if (!$firstLine) {
|
||||||
$array = explode(' ', ltrim(trim($line, 2), '=_~'));
|
$array = explode(' ', ltrim(trim($line, 2), '=_~'));
|
||||||
$model['category'] = isset($array[0]) ? $array[0] : '';
|
$model['category'] = isset($array[0]) ? $array[0] : '';
|
||||||
$model['name'] = preg_replace('/ {2,}/', ' ', ltrim($line, '=_'));
|
$model['name'] = preg_replace('/ {2,}/', ' ', ltrim($line, '_'));
|
||||||
|
|
||||||
$firstLine = true;
|
$firstLine = true;
|
||||||
}
|
}
|
||||||
@ -68,7 +68,13 @@ class LDModelParser
|
|||||||
}
|
}
|
||||||
// 0 !KEYWORDS <first keyword>, <second keyword>, ..., <last keyword>
|
// 0 !KEYWORDS <first keyword>, <second keyword>, ..., <last keyword>
|
||||||
elseif (strpos($line, '!KEYWORDS ') === 0) {
|
elseif (strpos($line, '!KEYWORDS ') === 0) {
|
||||||
$model['keywords'] = explode(', ', preg_replace('/^!KEYWORDS /', '', $line));
|
$keywords = explode(',', preg_replace('/^!KEYWORDS /', '', $line));
|
||||||
|
foreach ($keywords as $keyword) {
|
||||||
|
$keyword = trim($keyword);
|
||||||
|
if($keyword) {
|
||||||
|
$model['keywords'][] = $keyword;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 0 Name: <Filename>.dat
|
// 0 Name: <Filename>.dat
|
||||||
elseif (strpos($line, 'Name: ') === 0 && !isset($header['id'])) {
|
elseif (strpos($line, 'Name: ') === 0 && !isset($header['id'])) {
|
||||||
@ -100,7 +106,7 @@ class LDModelParser
|
|||||||
$id = strtolower($reference['id']);
|
$id = strtolower($reference['id']);
|
||||||
$color = strtolower($reference['color']);
|
$color = strtolower($reference['color']);
|
||||||
|
|
||||||
// group subparts by color and id
|
// group subparts by color and id
|
||||||
if (isset($model['subparts'][$id][$color])) {
|
if (isset($model['subparts'][$id][$color])) {
|
||||||
$model['subparts'][$id][$color] = $model['subparts'][$id][$color] + 1;
|
$model['subparts'][$id][$color] = $model['subparts'][$id][$color] + 1;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user