Skip to content

Commit

Permalink
Fix: Fix extruder engine config output (#2104)
Browse files Browse the repository at this point in the history
  • Loading branch information
parachvte authored Mar 31, 2023
1 parent 4a945c7 commit 8500c3f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
7 changes: 3 additions & 4 deletions packages/luban-platform/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './src/machine-definition';
export {
applyParameterModifications,
resolveParameterValues,
resetPresetsContext
applyParameterModifications, getParameterItem, resetPresetsContext, resolveParameterValues
} from './src/parameter-resolver';

export * from './src/machine-definition';

Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,15 @@ interface ParameterResolverOptions {
contextKey?: string;
}

interface ParameterItem {
// eslint-disable-next-line camelcase
default_value: number | string | boolean;
}

export function getParameterItem(key: string): ParameterItem | undefined {
return parameterMap.get(key);
}

export function applyParameterModifications(definition, modifiedParameterItems: ModifyParameterItem[]) {
for (const [key, value] of modifiedParameterItems) {
definition.settings[key].default_value = value;
Expand Down
5 changes: 2 additions & 3 deletions packages/luban-platform/src/parameter-resolver/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export {
applyParameterModifications,
resolveParameterValues,
resetPresetsContext
applyParameterModifications, getParameterItem, resetPresetsContext, resolveParameterValues
} from './common/parameter-resolver';

7 changes: 3 additions & 4 deletions src/app/flux/manager/DefinitionManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
import { cloneDeep, includes } from 'lodash';
// import { resolveDefinition } from '../../../shared/lib/definition-resolver';
import { resolveParameterValues, resetPresetsContext, PrintMode } from '@snapmaker/luban-platform';
import { resolveParameterValues, resetPresetsContext, PrintMode, getParameterItem } from '@snapmaker/luban-platform';

import api from '../../api';
import {
Expand Down Expand Up @@ -416,7 +416,7 @@ class DefinitionManager {

_applyModelExtruderParameters(definition, qualityDefinition, extruderDefinition, limitToExtruderKeys) {
for (const key of Object.keys(extruderDefinition.settings)) {
const settingItem = qualityDefinition.settings[key];
const settingItem = getParameterItem(key);

if (settingItem && settingItem.settable_per_mesh && includes(limitToExtruderKeys, settingItem.limit_to_extruder)) {
if (!definition.settings[key]) {
Expand Down Expand Up @@ -712,11 +712,10 @@ class DefinitionManager {
for (const key of extruderKeysAllowed) {
// FIXME: This is a hot fix only, please correct extruder key later
// do not write to final config file
const settingItem = activeQualityDefinition.settings[key];
const settingItem = getParameterItem(key);
if (settingItem && !settingItem.settable_per_extruder && !settingItem.settable_per_mesh) {
// not in material
if (!includes(this.materialProfileArr, key)) {
console.log('ignore key', key);
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/slicer/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class DefinitionLoader {
this.settings[key].from = definitionId;
this.settings[key].isLeave = (setting.children === undefined);

if (definitionId === 'fdmprinter' || definitionId === 'fdmextruder') {
if (definitionId === 'fdmextruder') {
const isMesh = setting.settable_per_mesh || false;
const isExtruder = setting.settable_per_extruder || false;
this.settings[key].settable_per_extruder = this.settings[key].settable_per_extruder || isExtruder;
Expand Down

0 comments on commit 8500c3f

Please sign in to comment.