ENH: filament just show bundle machine

Change-Id: If0a35037dc4b08df7cd3aaf88662638a334196e3
(cherry picked from commit 5ebd67880a679c3013fe10b63b509761eab30670)
This commit is contained in:
zorro.zhang 2022-08-10 17:25:53 +08:00 committed by Lane.Wei
parent 6e1e56be18
commit 2ac9267e42
4 changed files with 683 additions and 602 deletions

View file

@ -62,7 +62,7 @@ function SortUI()
let OneMode=m_ProfileItem["model"][n]; let OneMode=m_ProfileItem["model"][n];
if( OneMode["nozzle_selected"]!="" ) if( OneMode["nozzle_selected"]!="" )
ModelList.push(OneMode["model"]); ModelList.push(OneMode);
} }
//machine //machine
@ -89,14 +89,14 @@ function SortUI()
// $('#MachineList').hide(); // $('#MachineList').hide();
// } // }
//machine //model
let HtmlMode=''; let HtmlMode='';
nMode=ModelList.length; nMode=ModelList.length;
for(let n=0;n<nMode;n++) for(let n=0;n<nMode;n++)
{ {
let sModel=ModelList[n]; let sModel=ModelList[n];
HtmlMode+='<div><input type="checkbox" mode="'+sModel+'" onChange="MachineClick()" />'+sModel+'</div>'; HtmlMode+='<div><input type="checkbox" mode="'+sModel['model']+'" nozzle="'+sModel['nozzle_selected']+'" onChange="MachineClick()" />'+sModel['model']+'</div>';
} }
$('#MachineList .CValues').append(HtmlMode); $('#MachineList .CValues').append(HtmlMode);
@ -122,14 +122,16 @@ function SortUI()
let fSelect=OneFila['selected']; let fSelect=OneFila['selected'];
let fModel=OneFila['models'] let fModel=OneFila['models']
// if(OneFila['name'].indexOf("K5 PLA Wood")>0) // if(OneFila['name'].indexOf("Bambu PA-CF")>=0)
// { // {
// alert( fShortName+' - '+fVendor+' - '+fType+' - '+fSelect+' - '+fModel )
//
// let b=1+2; // let b=1+2;
// } // }
let bFind=false; let bFind=false;
let bCheck=$("#MachineList input:first").prop("checked"); //let bCheck=$("#MachineList input:first").prop("checked");
if(bCheck) if( fModel=='')
{ {
bFind=true; bFind=true;
} }
@ -141,13 +143,22 @@ function SortUI()
{ {
let sOne=ModelList[m]; let sOne=ModelList[m];
if(fModel.indexOf(sOne)>=0) let OneName=sOne['model'];
let NozzleArray=sOne["nozzle_selected"].split(';');
let nNozzle=NozzleArray.length;
for( let b=0;b<nNozzle;b++ )
{
let nowModel= OneName+"++"+NozzleArray[b];
if(fModel.indexOf(nowModel)>=0)
{ {
bFind=true; bFind=true;
break; break;
} }
} }
} }
}
if(bFind) if(bFind)
{ {
@ -335,7 +346,24 @@ function SortFilament()
for(let n=0;n<nModel;n++) for(let n=0;n<nModel;n++)
{ {
let OneModel=pModel[n]; let OneModel=pModel[n];
ModelList.push( OneModel.getAttribute("mode") );
let mName=OneModel.getAttribute("mode");
if( mName=='all' )
{
continue;
}
else
{
let mNozzle=OneModel.getAttribute("nozzle");
let NozzleArray=mNozzle.split(';');
for( let bb=0;bb<NozzleArray.length;bb++ )
{
let NewModel='['+mName+'++'+NozzleArray[bb]+']';
ModelList.push( NewModel );
}
}
} }
//TypeList //TypeList
@ -373,11 +401,11 @@ function SortFilament()
if(TypeList.in_array(fType) && VendorList.in_array(fVendor)) if(TypeList.in_array(fType) && VendorList.in_array(fVendor))
{ {
let HasModel=false; let HasModel=false;
for(let m=0;m<nModel;m++) for(let m=0;m<ModelList.length;m++)
{ {
let ModelSrc=ModelList[m]; let ModelSrc=ModelList[m];
if( ModelSrc=="all" || fModel.indexOf(ModelSrc)>=0) if( fModel.indexOf(ModelSrc)>=0)
{ {
HasModel=true; HasModel=true;
break; break;

View file

@ -1,511 +1,364 @@
var cData={ var cData={
"filament": { "filament": {
"BBL PA-CF @BBL": { "Bambu ABS @BBL X1C": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4][Bambu Lab X1 Carbon++0.6]",
"name": "BBL PA-CF @BBL", "name": "Bambu ABS @BBL X1C",
"selected": 1, "selected": 1,
"sub_path": "filament/BBL PA-CF @BBL.json", "sub_path": "filament/Bambu ABS @BBL X1C.json",
"type": "PA6+CF", "type": "ABS",
"vendor": "BBL" "vendor": "Bambu Lab"
},
"Bambu ABS @BBL X1C 0.2 nozzle": {
"models": "[Bambu Lab X1 Carbon++0.2]",
"name": "Bambu ABS @BBL X1C 0.2 nozzle",
"selected": 1,
"sub_path": "filament/Bambu ABS @BBL X1C 0.2 nozzle.json",
"type": "ABS",
"vendor": "Bambu Lab"
},
"Bambu ABS @BBL X1C 0.8 nozzle": {
"models": "[Bambu Lab X1 Carbon++0.8]",
"name": "Bambu ABS @BBL X1C 0.8 nozzle",
"selected": 1,
"sub_path": "filament/Bambu ABS @BBL X1C 0.8 nozzle.json",
"type": "ABS",
"vendor": "Bambu Lab"
},
"Bambu PA-CF @BBL X1C": {
"models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Bambu PA-CF @BBL X1C",
"selected": 0,
"sub_path": "filament/Bambu PA-CF @BBL X1C.json",
"type": "PA-CF",
"vendor": "Bambu Lab"
},
"Bambu PC @BBL X1C": {
"models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4][Bambu Lab X1 Carbon++0.6]",
"name": "Bambu PC @BBL X1C",
"selected": 1,
"sub_path": "filament/Bambu PC @BBL X1C.json",
"type": "PC",
"vendor": "Bambu Lab"
},
"Bambu PC @BBL X1C 0.8 nozzle": {
"models": "[Bambu Lab X1 Carbon++0.8]",
"name": "Bambu PC @BBL X1C 0.8 nozzle",
"selected": 1,
"sub_path": "filament/Bambu PC @BBL X1C 0.8 nozzle.json",
"type": "PC",
"vendor": "Bambu Lab"
},
"Bambu PLA Basic @BBL X1": {
"models": "[Bambu Lab X1++0.4]",
"name": "Bambu PLA Basic @BBL X1",
"selected": 1,
"sub_path": "filament/Bambu PLA Basic @BBL X1.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu PLA Basic @BBL X1C": {
"models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1 Carbon++0.6]",
"name": "Bambu PLA Basic @BBL X1C",
"selected": 1,
"sub_path": "filament/Bambu PLA Basic @BBL X1C.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu PLA Basic @BBL X1C 0.2 nozzle": {
"models": "[Bambu Lab X1 Carbon++0.2]",
"name": "Bambu PLA Basic @BBL X1C 0.2 nozzle",
"selected": 1,
"sub_path": "filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu PLA Basic @BBL X1C 0.8 nozzle": {
"models": "[Bambu Lab X1 Carbon++0.8]",
"name": "Bambu PLA Basic @BBL X1C 0.8 nozzle",
"selected": 1,
"sub_path": "filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu PLA Matte @BBL X1": {
"models": "[Bambu Lab X1++0.4]",
"name": "Bambu PLA Matte @BBL X1",
"selected": 1,
"sub_path": "filament/Bambu PLA Matte @BBL X1.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu PLA Matte @BBL X1C": {
"models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1 Carbon++0.6]",
"name": "Bambu PLA Matte @BBL X1C",
"selected": 1,
"sub_path": "filament/Bambu PLA Matte @BBL X1C.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu PLA Matte @BBL X1C 0.2 nozzle": {
"models": "[Bambu Lab X1 Carbon++0.2]",
"name": "Bambu PLA Matte @BBL X1C 0.2 nozzle",
"selected": 1,
"sub_path": "filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu PLA Matte @BBL X1C 0.8 nozzle": {
"models": "[Bambu Lab X1 Carbon++0.8]",
"name": "Bambu PLA Matte @BBL X1C 0.8 nozzle",
"selected": 1,
"sub_path": "filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu Support G @BBL X1C": {
"models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Bambu Support G @BBL X1C",
"selected": 0,
"sub_path": "filament/Bambu Support G @BBL X1C.json",
"type": "PA",
"vendor": "Bambu Lab"
},
"Bambu Support W @BBL X1": {
"models": "[Bambu Lab X1++0.4]",
"name": "Bambu Support W @BBL X1",
"selected": 1,
"sub_path": "filament/Bambu Support W @BBL X1.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu Support W @BBL X1C": {
"models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Bambu Support W @BBL X1C",
"selected": 1,
"sub_path": "filament/Bambu Support W @BBL X1C.json",
"type": "PLA",
"vendor": "Bambu Lab"
},
"Bambu TPU 95A @BBL X1": {
"models": "[Bambu Lab X1++0.4]",
"name": "Bambu TPU 95A @BBL X1",
"selected": 1,
"sub_path": "filament/Bambu TPU 95A @BBL X1.json",
"type": "TPU",
"vendor": "Bambu Lab"
},
"Bambu TPU 95A @BBL X1C": {
"models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1 Carbon++0.6][Bambu Lab X1 Carbon++0.8]",
"name": "Bambu TPU 95A @BBL X1C",
"selected": 1,
"sub_path": "filament/Bambu TPU 95A @BBL X1C.json",
"type": "TPU",
"vendor": "Bambu Lab"
}, },
"Generic ABS": { "Generic ABS": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4]",
"name": "Generic ABS", "name": "Generic ABS",
"selected": 1, "selected": 0,
"sub_path": "filament/Generic ABS.json", "sub_path": "filament/Generic ABS.json",
"type": "ABS", "type": "ABS",
"vendor": "Unknow" "vendor": "Generic"
},
"Generic ASA": {
"models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4]",
"name": "Generic ASA",
"selected": 0,
"sub_path": "filament/Generic ASA.json",
"type": "ASA",
"vendor": "Generic"
},
"Generic PA": {
"models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Generic PA",
"selected": 0,
"sub_path": "filament/Generic PA.json",
"type": "PA",
"vendor": "Generic"
},
"Generic PA-CF": {
"models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Generic PA-CF",
"selected": 0,
"sub_path": "filament/Generic PA-CF.json",
"type": "PA-CF",
"vendor": "Generic"
},
"Generic PC": {
"models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Generic PC",
"selected": 0,
"sub_path": "filament/Generic PC.json",
"type": "PC",
"vendor": "Generic"
}, },
"Generic PETG": { "Generic PETG": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4]",
"name": "Generic PETG", "name": "Generic PETG",
"selected": 1, "selected": 0,
"sub_path": "filament/Generic PETG.json", "sub_path": "filament/Generic PETG.json",
"type": "PET", "type": "PETG",
"vendor": "Unknow" "vendor": "Generic"
}, },
"Generic PLA": { "Generic PLA": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4]",
"name": "Generic PLA", "name": "Generic PLA",
"selected": 1, "selected": 1,
"sub_path": "filament/Generic PLA.json", "sub_path": "filament/Generic PLA.json",
"type": "PLA", "type": "PLA",
"vendor": "Unknow" "vendor": "Generic"
},
"Generic PLA-CF": {
"models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Generic PLA-CF",
"selected": 0,
"sub_path": "filament/Generic PLA-CF.json",
"type": "PLA-CF",
"vendor": "Generic"
},
"Generic PVA": {
"models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4]",
"name": "Generic PVA",
"selected": 0,
"sub_path": "filament/Generic PVA.json",
"type": "PVA",
"vendor": "Generic"
}, },
"Generic TPU": { "Generic TPU": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1 Carbon++0.4][Bambu Lab X1++0.4]",
"name": "Generic TPU", "name": "Generic TPU",
"selected": 0, "selected": 0,
"sub_path": "filament/Generic TPU.json", "sub_path": "filament/Generic TPU.json",
"type": "TPU", "type": "TPU",
"vendor": "Unknow" "vendor": "Generic"
}, },
"Generic TPU83": { "PolyLite PLA @BBL X1": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1++0.4]",
"name": "Generic TPU83", "name": "PolyLite PLA @BBL X1",
"selected": 1, "selected": 1,
"sub_path": "filament/Generic TPU83.json", "sub_path": "filament/PolyLite PLA @BBL X1.json",
"type": "TPU", "type": "PLA",
"vendor": "Unknow" "vendor": "Polymaker"
}, },
"Generic TPU87": { "PolyLite PLA @BBL X1C": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1 Carbon++0.4]",
"name": "Generic TPU87", "name": "PolyLite PLA @BBL X1C",
"selected": 1, "selected": 1,
"sub_path": "filament/Generic TPU87.json", "sub_path": "filament/PolyLite PLA @BBL X1C.json",
"type": "TPU", "type": "PLA",
"vendor": "Unknow" "vendor": "Polymaker"
}, },
"Generic TPU90": { "PolyTerra PLA @BBL X1": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1++0.4]",
"name": "Generic TPU90", "name": "PolyTerra PLA @BBL X1",
"selected": 0,
"sub_path": "filament/Generic TPU90.json",
"type": "TPU",
"vendor": "Unknow"
},
"Generic TPU95": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "Generic TPU95",
"selected": 1, "selected": 1,
"sub_path": "filament/Generic TPU95.json", "sub_path": "filament/PolyTerra PLA @BBL X1.json",
"type": "TPU",
"vendor": "Unknow"
},
"K5 ABS @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5 ABS @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 ABS @Kexcelled.json",
"type": "ABS",
"vendor": "Kexcelled"
},
"K5 ASA @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5 ASA @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 ASA @Kexcelled.json",
"type": "ABS",
"vendor": "Kexcelled"
},
"K5 PETG @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5 PETG @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 PETG @Kexcelled.json",
"type": "PET",
"vendor": "Kexcelled"
},
"K5 PLA Magic @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5 PLA Magic @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 PLA Magic @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K5 PLA Wood @Kexcelled": {
"models": "",
"name": "K5 PLA Wood @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 PLA Wood @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K5 PLA~ @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5 PLA~ @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 PLA~ @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K5 Silk PLA~ @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5 Silk PLA~ @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 Silk PLA~ @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K5 Sparkle PLA @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5 Sparkle PLA @Kexcelled",
"selected": 0,
"sub_path": "filament/K5 Sparkle PLA @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K5M PLA~ @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5M PLA~ @Kexcelled",
"selected": 0,
"sub_path": "filament/K5M PLA~ @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K5P PLA~ @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5P PLA~ @Kexcelled",
"selected": 0,
"sub_path": "filament/K5P PLA~ @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K5T ABS @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K5T ABS @Kexcelled",
"selected": 0,
"sub_path": "filament/K5T ABS @Kexcelled.json",
"type": "ABS",
"vendor": "Kexcelled"
},
"K6 PETG @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K6 PETG @Kexcelled",
"selected": 0,
"sub_path": "filament/K6 PETG @Kexcelled.json",
"type": "PET",
"vendor": "Kexcelled"
},
"K6 PLA~ @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K6 PLA~ @Kexcelled",
"selected": 0,
"sub_path": "filament/K6 PLA~ @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K6CF PLA~ @Kexcelled ": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K6CF PLA~ @Kexcelled ",
"selected": 0,
"sub_path": "filament/K6CF PLA~ @Kexcelled.json",
"type": "PLA",
"vendor": "Kexcelled"
},
"K7 PC @Kexcelled ": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K7 PC @Kexcelled ",
"selected": 0,
"sub_path": "filament/K7 PC @Kexcelled.json",
"type": "PC",
"vendor": "Kexcelled"
},
"K7CF PAHT @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K7CF PAHT @Kexcelled",
"selected": 0,
"sub_path": "filament/K7CF PAHT @Kexcelled.json",
"type": "PA6+CF",
"vendor": "Kexcelled"
},
"K7CF PET @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K7CF PET @Kexcelled",
"selected": 0,
"sub_path": "filament/K7CF PET @Kexcelled.json",
"type": "PET",
"vendor": "Kexcelled"
},
"K7CFLM PAHT @Kexcelled": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "K7CFLM PAHT @Kexcelled",
"selected": 0,
"sub_path": "filament/K7CFLM PAHT @Kexcelled.json",
"type": "PA6+CF",
"vendor": "Kexcelled"
},
"PLA Silk with Glue @ALL": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PLA Silk with Glue @ALL",
"selected": 0,
"sub_path": "filament/PLA Silk with Glue @ALL.json",
"type": "PLA",
"vendor": "ALL"
},
"PLA with Glue except Silk @ALL": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PLA with Glue except Silk @ALL",
"selected": 0,
"sub_path": "filament/PLA with Glue except Silk @ALL.json",
"type": "PLA",
"vendor": "ALL"
},
"PolyDissolve @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyDissolve @Polymaker",
"selected": 0,
"sub_path": "filament/PolyDissolve @Polymaker.json",
"type": "PLA", "type": "PLA",
"vendor": "Polymaker" "vendor": "Polymaker"
}, },
"PolyFlex TPU95HF @Polymaker": { "PolyTerra PLA @BBL X1C": {
"models": "[BBL-3DP-V5NORMAL]", "models": "[Bambu Lab X1 Carbon++0.4]",
"name": "PolyFlex TPU95HF @Polymaker", "name": "PolyTerra PLA @BBL X1C",
"selected": 0, "selected": 1,
"sub_path": "filament/PolyFlex TPU95HF @Polymaker.json", "sub_path": "filament/PolyTerra PLA @BBL X1C.json",
"type": "TPU",
"vendor": "Polymaker"
},
"PolyLite ABS @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyLite ABS @Polymaker",
"selected": 0,
"sub_path": "filament/PolyLite ABS @Polymaker.json",
"type": "ABS",
"vendor": "Polymaker"
},
"PolyLite ASA @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyLite ASA @Polymaker",
"selected": 0,
"sub_path": "filament/PolyLite ASA @Polymaker.json",
"type": "ABS",
"vendor": "Polymaker"
},
"PolyLite PC @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyLite PC @Polymaker",
"selected": 0,
"sub_path": "filament/PolyLite PC @Polymaker.json",
"type": "PC",
"vendor": "Polymaker"
},
"PolyLite PETG @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyLite PETG @Polymaker",
"selected": 0,
"sub_path": "filament/PolyLite PETG @Polymaker.json",
"type": "PET",
"vendor": "Polymaker"
},
"PolyLite PLA Pro~ @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyLite PLA Pro~ @Polymaker",
"selected": 0,
"sub_path": "filament/PolyLite PLA Pro~ @Polymaker.json",
"type": "PLA", "type": "PLA",
"vendor": "Polymaker" "vendor": "Polymaker"
},
"PolyLite PLA Silk~ @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyLite PLA Silk~ @Polymaker",
"selected": 0,
"sub_path": "filament/PolyLite PLA Silk~ @Polymaker.json",
"type": "PLA",
"vendor": "Polymaker"
},
"PolyLite PLA~ @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyLite PLA~ @Polymaker",
"selected": 0,
"sub_path": "filament/PolyLite PLA~ @Polymaker.json",
"type": "PLA",
"vendor": "Polymaker"
},
"PolyMax PC @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyMax PC @Polymaker",
"selected": 0,
"sub_path": "filament/PolyMax PC @Polymaker.json",
"type": "PC",
"vendor": "Polymaker"
},
"PolyMax PETG @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyMax PETG @Polymaker",
"selected": 0,
"sub_path": "filament/PolyMax PETG @Polymaker.json",
"type": "PET",
"vendor": "Polymaker"
},
"PolyMax PLA~ @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyMax PLA~ @Polymaker",
"selected": 0,
"sub_path": "filament/PolyMax PLA~ @Polymaker.json",
"type": "PLA",
"vendor": "Polymaker"
},
"PolyMide CoPA @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyMide CoPA @Polymaker",
"selected": 0,
"sub_path": "filament/PolyMide CoPA @Polymaker.json",
"type": "PA6+CF",
"vendor": "Polymaker"
},
"PolyMide PA12-CF @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyMide PA12-CF @Polymaker",
"selected": 0,
"sub_path": "filament/PolyMide PA12-CF @Polymaker.json",
"type": "PA6+CF",
"vendor": "Polymaker"
},
"PolyMide PA6-CF @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyMide PA6-CF @Polymaker",
"selected": 0,
"sub_path": "filament/PolyMide PA6-CF @Polymaker.json",
"type": "PA6+CF",
"vendor": "Polymaker"
},
"PolyMide PA6-GF @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyMide PA6-GF @Polymaker",
"selected": 0,
"sub_path": "filament/PolyMide PA6-GF @Polymaker.json",
"type": "PA6+CF",
"vendor": "Polymaker"
},
"PolySupport @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolySupport @Polymaker",
"selected": 0,
"sub_path": "filament/PolySupport @Polymaker.json",
"type": "PLA",
"vendor": "Polymaker"
},
"PolyTerra PLA~ @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyTerra PLA~ @Polymaker",
"selected": 0,
"sub_path": "filament/PolyTerra PLA~ @Polymaker.json",
"type": "PLA",
"vendor": "Polymaker"
},
"PolyWood PLA~ @Polymaker": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "PolyWood PLA~ @Polymaker",
"selected": 0,
"sub_path": "filament/PolyWood PLA~ @Polymaker.json",
"type": "PLA",
"vendor": "Polymaker"
},
"eSUN ABS @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN ABS @eSUN",
"selected": 0,
"sub_path": "filament/eSUN ABS @eSUN.json",
"type": "ABS",
"vendor": "eSUN"
},
"eSUN ABS+ @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN ABS+ @eSUN",
"selected": 0,
"sub_path": "filament/eSUN ABS+ @eSUN.json",
"type": "ABS",
"vendor": "eSUN"
},
"eSUN PETG @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN PETG @eSUN",
"selected": 0,
"sub_path": "filament/eSUN PETG @eSUN.json",
"type": "PET",
"vendor": "eSUN"
},
"eSUN PLA @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN PLA @eSUN",
"selected": 0,
"sub_path": "filament/eSUN PLA @eSUN.json",
"type": "PLA",
"vendor": "eSUN"
},
"eSUN PLA Matte~ @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN PLA Matte~ @eSUN",
"selected": 0,
"sub_path": "filament/eSUN PLA Matte~ @eSUN.json",
"type": "PLA",
"vendor": "eSUN"
},
"eSUN PLA ST @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN PLA ST @eSUN",
"selected": 0,
"sub_path": "filament/eSUN PLA ST @eSUN.json",
"type": "PLA",
"vendor": "eSUN"
},
"eSUN PLA Silk~ @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN PLA Silk~ @eSUN",
"selected": 0,
"sub_path": "filament/eSUN PLA Silk~ @eSUN.json",
"type": "PLA",
"vendor": "eSUN"
},
"eSUN PLA+~ @eSUN": {
"models": "[BBL-3DP-V5NORMAL]",
"name": "eSUN PLA+~ @eSUN",
"selected": 0,
"sub_path": "filament/eSUN PLA+~ @eSUN.json",
"type": "PLA",
"vendor": "eSUN"
} }
}, },
"machine": [ "machine": {
{ "Bambu Lab X1 0.4 nozzle": {
"model": "BBL-3DP-V5NORMAL", "model": "Bambu Lab X1",
"name": "Bambulab BBL-3DP-001-V5-normal", "name": "Bambu Lab X1 0.4 nozzle",
"sub_path": "machine/Bambulab BBL-3DP-001-V5-normal.json" "nozzle": "0.4",
"sub_path": "machine/Bambu Lab X1 0.4 nozzle.json"
},
"Bambu Lab X1 Carbon 0.2 nozzle": {
"model": "Bambu Lab X1 Carbon",
"name": "Bambu Lab X1 Carbon 0.2 nozzle",
"nozzle": "0.2",
"sub_path": "machine/Bambu Lab X1 Carbon 0.2 nozzle.json"
},
"Bambu Lab X1 Carbon 0.4 nozzle": {
"model": "Bambu Lab X1 Carbon",
"name": "Bambu Lab X1 Carbon 0.4 nozzle",
"nozzle": "0.4",
"sub_path": "machine/Bambu Lab X1 Carbon 0.4 nozzle.json"
},
"Bambu Lab X1 Carbon 0.6 nozzle": {
"model": "Bambu Lab X1 Carbon",
"name": "Bambu Lab X1 Carbon 0.6 nozzle",
"nozzle": "0.6",
"sub_path": "machine/Bambu Lab X1 Carbon 0.6 nozzle.json"
},
"Bambu Lab X1 Carbon 0.8 nozzle": {
"model": "Bambu Lab X1 Carbon",
"name": "Bambu Lab X1 Carbon 0.8 nozzle",
"nozzle": "0.8",
"sub_path": "machine/Bambu Lab X1 Carbon 0.8 nozzle.json"
} }
], },
"model": [ "model": [
{ {
"cover": "E:\\Document\\DevCode\\Slicer2\\bamboo_slicer\\build\\src\\Debug\\resources\\profiles\\BBL\\BBL-3DP-V5NORMAL_cover.png", "cover": "C:\\Users\\zorro\\AppData\\Roaming\\BambuStudio\\system\\BBL\\Bambu Lab X1 Carbon_cover.png",
"materials": "Generic PLA;PolyDissolve @Polymaker;PolyFlex TPU95HF @Polymaker;K5 Sparkle PLA @Kexcelled;Rock PLA @Polymaker;Generic TPU95;Generic TPU90;Generic TPU87;Generic TPU83;PolyMide CoPA @Polymaker;PolyMide PA6-GF @Polymaker;PolyMide PA12-CF @Polymaker;PolyMide PA6-CF @Polymaker;PolyLite ASA @Polymaker;K5 ASA @Kexcelled;K5T ABS @Kexcelled;PLA with Glue except Silk @ALL;PLA Silk with Glue @ALL;PolyTerra PLA~ @Polymaker; PolyLite PLA~ @Polymaker; PolyLite PLA Pro~ @Polymaker; PolyLite PLA Silk~ @Polymaker; PolyMax PLA~ @Polymaker; PolyWood PLA~ @Polymaker;K5 Silk PLA~ @Kexcelled;K5 PLA~ @Kexcelled;K6 PLA~ @Kexcelled;K6CF PLA~ @Kexcelled;K5M PLA~ @Kexcelled;K5P PLA~ @Kexcelled;eSUN PLA @eSUN; eSUN PLA+~ @eSUN; eSUN PLA Matte~ @eSUN; eSUN PLA Silk~ @eSUN; eSUN PLA ST @eSUN; PolyLite ABS @Polymaker; K5 ABS @Kexcelled; eSUN ABS @eSUN; eSUN ABS+ @eSUN; K5 PETG @Kexcelled; K6 PETG @Kexcelled; PolyMax PETG @Polymaker; PolyLite PETG @Polymaker; eSUN PETG @eSUN; PolySupport @Polymaker;K7CF PET @Kexcelled;K7CFLM PAHT @Kexcelled;K7CF PAHT @Kexcelled; K7LM PAHT @Kexcelled; BBL PA-CF @BBL;K7 PC @Kexcelled; PolyLite PC @Polymaker; PolyMax PC @Polymaker;K5 PLA Magic @Kexcelled;", "materials": "Generic PLA;Bambu PLA Matte @BBL X1C;Bambu PLA Basic @BBL X1C;Bambu ABS @BBL X1C;Bambu PC @BBL X1C;Bambu Support W @BBL X1C;Bambu TPU 95A @BBL X1C;PolyTerra PLA @BBL X1C;PolyLite PLA @BBL X1C;",
"model": "BBL-3DP-V5NORMAL", "model": "Bambu Lab X1 Carbon",
"nozzle_diameter": "0.4;0.2", "nozzle_diameter": "0.4;0.2;0.6;0.8",
"nozzle_selected": "0.2;0.6",
"sub_path": "machine/Bambu Lab X1 Carbon.json",
"vendor": "BBL"
},
{
"cover": "C:\\Users\\zorro\\AppData\\Roaming\\BambuStudio\\system\\BBL\\Bambu Lab X1_cover.png",
"materials": "Generic PLA;Bambu PLA Matte @BBL X1;Bambu PLA Basic @BBL X1;Bambu ABS @BBL X1C;Bambu PC @BBL X1C;Bambu Support W @BBL X1;Bambu TPU 95A @BBL X1;PolyTerra PLA @BBL X1;PolyLite PLA @BBL X1;",
"model": "Bambu Lab X1",
"nozzle_diameter": "0.4",
"nozzle_selected": "0.4", "nozzle_selected": "0.4",
"sub_path": "machine/BBL-3DP-V5NORMAL.json", "sub_path": "machine/Bambu Lab X1.json",
"vendor": "BBL" "vendor": "BBL"
} }
], ],
"network_plugin_compability": "0",
"network_plugin_install": "1",
"process": [ "process": [
{ {
"name": "0.08mm SUPERDETAIL @BBL-3DP", "name": "0.08mm Extra Fine @BBL X1C",
"sub_path": "process/0.08mm SUPERDETAIL @BBL-3DP.json" "sub_path": "process/0.08mm Extra Fine @BBL X1C.json"
}, },
{ {
"name": "0.10mm HIGHDETAIL @BBL-3DP", "name": "0.12mm Fine @BBL X1C",
"sub_path": "process/0.10mm HIGHDETAIL @BBL-3DP.json" "sub_path": "process/0.12mm Fine @BBL X1C.json"
}, },
{ {
"name": "0.12mm DETAIL @BBL-3DP", "name": "0.16mm Optimal @BBL X1C",
"sub_path": "process/0.12mm DETAIL @BBL-3DP.json" "sub_path": "process/0.16mm Optimal @BBL X1C.json"
}, },
{ {
"name": "0.16mm OPTIMAL @BBL-3DP", "name": "0.20mm Standard @BBL X1C",
"sub_path": "process/0.16mm OPTIMAL @BBL-3DP.json" "sub_path": "process/0.20mm Standard @BBL X1C.json"
}, },
{ {
"name": "0.20mm NORMAL @BBL-3DP", "name": "0.24mm Draft @BBL X1C",
"sub_path": "process/0.20mm NORMAL @BBL-3DP.json" "sub_path": "process/0.24mm Draft @BBL X1C.json"
}, },
{ {
"name": "0.24mm DRAFT @BBL-3DP", "name": "0.28mm Extra Draft @BBL X1C",
"sub_path": "process/0.24mm DRAFT @BBL-3DP.json" "sub_path": "process/0.28mm Extra Draft @BBL X1C.json"
}, },
{ {
"name": "0.28mm SUPERDRAFT @BBL-3DP", "name": "0.10mm Standard @BBL X1C 0.2 nozzle",
"sub_path": "process/0.28mm SUPERDRAFT @BBL-3DP.json" "sub_path": "process/0.10mm Standard @BBL X1C 0.2 nozzle.json"
}, },
{ {
"name": "0.20mm TreeSupport @BBL-3DP", "name": "0.30mm Standard @BBL X1C 0.6 nozzle",
"sub_path": "process/0.20mm TreeSupport @BBL-3DP.json" "sub_path": "process/0.30mm Standard @BBL X1C 0.6 nozzle.json"
}, },
{ {
"name": "0.20mm PolySupport @BBL-3DP", "name": "0.40mm Standard @BBL X1C 0.8 nozzle",
"sub_path": "process/0.20mm PolySupport @BBL-3DP.json" "sub_path": "process/0.40mm Standard @BBL X1C 0.8 nozzle.json"
} }
] ],
}; "region": "North America"
};
var mData={ var mData={

View file

@ -59,7 +59,7 @@ function SortUI()
let OneMode=m_ProfileItem["model"][n]; let OneMode=m_ProfileItem["model"][n];
if( OneMode["nozzle_selected"]!="" ) if( OneMode["nozzle_selected"]!="" )
ModelList.push(OneMode["model"]); ModelList.push(OneMode);
} }
//machine //machine
@ -86,14 +86,14 @@ function SortUI()
// $('#MachineList').hide(); // $('#MachineList').hide();
// } // }
//machine //model
let HtmlMode=''; let HtmlMode='';
nMode=ModelList.length; nMode=ModelList.length;
for(let n=0;n<nMode;n++) for(let n=0;n<nMode;n++)
{ {
let sModel=ModelList[n]; let sModel=ModelList[n];
HtmlMode+='<div><input type="checkbox" mode="'+sModel+'" onChange="MachineClick()" />'+sModel+'</div>'; HtmlMode+='<div><input type="checkbox" mode="'+sModel['model']+'" nozzle="'+sModel['nozzle_selected']+'" onChange="MachineClick()" />'+sModel['model']+'</div>';
} }
$('#MachineList .CValues').append(HtmlMode); $('#MachineList .CValues').append(HtmlMode);
@ -119,14 +119,16 @@ function SortUI()
let fSelect=OneFila['selected']; let fSelect=OneFila['selected'];
let fModel=OneFila['models'] let fModel=OneFila['models']
// if(OneFila['name'].indexOf("K5 PLA Wood")>0) // if(OneFila['name'].indexOf("Bambu PA-CF")>=0)
// { // {
// alert( fShortName+' - '+fVendor+' - '+fType+' - '+fSelect+' - '+fModel )
//
// let b=1+2; // let b=1+2;
// } // }
let bFind=false; let bFind=false;
let bCheck=$("#MachineList input:first").prop("checked"); //let bCheck=$("#MachineList input:first").prop("checked");
if(bCheck) if( fModel=='')
{ {
bFind=true; bFind=true;
} }
@ -138,13 +140,22 @@ function SortUI()
{ {
let sOne=ModelList[m]; let sOne=ModelList[m];
if(fModel.indexOf(sOne)>=0) let OneName=sOne['model'];
let NozzleArray=sOne["nozzle_selected"].split(';');
let nNozzle=NozzleArray.length;
for( let b=0;b<nNozzle;b++ )
{
let nowModel= OneName+"++"+NozzleArray[b];
if(fModel.indexOf(nowModel)>=0)
{ {
bFind=true; bFind=true;
break; break;
} }
} }
} }
}
if(bFind) if(bFind)
{ {
@ -325,7 +336,24 @@ function SortFilament()
for(let n=0;n<nModel;n++) for(let n=0;n<nModel;n++)
{ {
let OneModel=pModel[n]; let OneModel=pModel[n];
ModelList.push( OneModel.getAttribute("mode") );
let mName=OneModel.getAttribute("mode");
if( mName=='all' )
{
continue;
}
else
{
let mNozzle=OneModel.getAttribute("nozzle");
let NozzleArray=mNozzle.split(';');
for( let bb=0;bb<NozzleArray.length;bb++ )
{
let NewModel='['+mName+'++'+NozzleArray[bb]+']';
ModelList.push( NewModel );
}
}
} }
//TypeList //TypeList
@ -363,11 +391,11 @@ function SortFilament()
if(TypeList.in_array(fType) && VendorList.in_array(fVendor)) if(TypeList.in_array(fType) && VendorList.in_array(fVendor))
{ {
let HasModel=false; let HasModel=false;
for(let m=0;m<nModel;m++) for(let m=0;m<ModelList.length;m++)
{ {
let ModelSrc=ModelList[m]; let ModelSrc=ModelList[m];
if( ModelSrc=="all" || fModel.indexOf(ModelSrc)>=0) if( fModel.indexOf(ModelSrc)>=0)
{ {
HasModel=true; HasModel=true;
break; break;

View file

@ -854,7 +854,7 @@ int GuideFrame::LoadProfile()
//BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", will load config from %1%.") % bbl_bundle_path; //BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", will load config from %1%.") % bbl_bundle_path;
m_ProfileJson = json::parse("{}"); m_ProfileJson = json::parse("{}");
m_ProfileJson["model"] = json::array(); m_ProfileJson["model"] = json::array();
m_ProfileJson["machine"] = json::array(); m_ProfileJson["machine"] = json::object();
m_ProfileJson["filament"] = json::object(); m_ProfileJson["filament"] = json::object();
m_ProfileJson["process"] = json::array(); m_ProfileJson["process"] = json::array();
@ -999,27 +999,205 @@ void StringReplace(string &strBase, string strSrc, string strDes)
} }
//int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath)
//{
// //wxString strFolder = strFilePath.BeforeLast(boost::filesystem::path::preferred_separator);
// boost::filesystem::path file_path(strFilePath);
// boost::filesystem::path vendor_dir = boost::filesystem::absolute(file_path.parent_path()/ strVendor).make_preferred();
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", vendor path %1%.")% vendor_dir.string();
// try {
//
// //wxLogMessage("GUIDE: json_path1 %s", w2s(strFilePath));
//
// std::string contents;
// LoadFile(strFilePath, contents);
// //wxLogMessage("GUIDE: json_path1 content: %s", contents);
// json jLocal=json::parse(contents);
// //wxLogMessage("GUIDE: json_path1 Loaded");
//
// // BBS:models
// json pmodels = jLocal["machine_model_list"];
// int nsize = pmodels.size();
//
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machine models")%nsize;
//
// for (int n = 0; n < nsize; n++) {
// json OneModel = pmodels.at(n);
//
// OneModel["model"] = OneModel["name"];
// OneModel.erase("name");
//
// std::string s1 = OneModel["model"];
// std::string s2 = OneModel["sub_path"];
//
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
// std::string sub_file = sub_path.string();
//
// //wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath));
// LoadFile(sub_file, contents);
// //wxLogMessage("GUIDE: json_path2 content: %s", contents);
// json pm=json::parse(contents);
// //wxLogMessage("GUIDE: json_path2 loaded");
//
// OneModel["vendor"] = strVendor;
// std::string NozzleOpt = pm["nozzle_diameter"];
// StringReplace(NozzleOpt, " ", "");
// OneModel["nozzle_diameter"] = NozzleOpt;
// OneModel["materials"] = pm["default_materials"];
//
// //wxString strCoverPath = wxString::Format("%s\\%s\\%s_cover.png", strFolder, strVendor, std::string(s1.mb_str()));
// std::string cover_file = s1+"_cover.png";
// boost::filesystem::path cover_path = boost::filesystem::absolute(vendor_dir / cover_file).make_preferred();
// OneModel["cover"] = cover_path.string();
//
// OneModel["nozzle_selected"] = "";
//
// m_ProfileJson["model"].push_back(OneModel);
// }
//
// // BBS:Machine
// json pmachine = jLocal["machine_list"];
// nsize = pmachine.size();
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machines")%nsize;
// for (int n = 0; n < nsize; n++) {
// json OneMachine = pmachine.at(n);
//
// std::string s1 = OneMachine["name"];
// std::string s2 = OneMachine["sub_path"];
//
// //wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
// std::string sub_file = sub_path.string();
// LoadFile(sub_file, contents);
// json pm = json::parse(contents);
//
// std::string strInstant = pm["instantiation"];
// if (strInstant.compare("true") == 0) {
// OneMachine["model"] = pm["printer_model"];
//
// m_ProfileJson["machine"].push_back(OneMachine);
// }
// }
//
// // BBS:Filament
// json pFilament = jLocal["filament_list"];
// nsize = pFilament.size();
//
// int nFalse = 0;
// int nModel = 0;
// int nFinish = 0;
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% filaments")%nsize;
// for (int n = 0; n < nsize; n++) {
// json OneFF = pFilament.at(n);
//
// std::string s1 = OneFF["name"];
// std::string s2 = OneFF["sub_path"];
//
// if (!m_ProfileJson["filament"].contains(s1))
// {
// //wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
// std::string sub_file = sub_path.string();
// LoadFile(sub_file, contents);
// json pm = json::parse(contents);
//
// std::string strInstant = pm["instantiation"];
// if (strInstant == "true") {
// std::string sV;
// std::string sT;
//
// int nRet = GetFilamentInfo(sub_file, sV, sT);
// if (nRet != 0) continue;
//
// OneFF["vendor"] = sV;
// OneFF["type"] = sT;
//
// OneFF["models"] = "";
// OneFF["selected"] = 0;
// }
// else
// continue;
//
// } else {
// OneFF = m_ProfileJson["filament"][s1];
// }
//
// std::string vModel = "";
// int nm = m_ProfileJson["model"].size();
// int bFind = 0;
// for (int m = 0; m < nm; m++) {
// std::string strFF = m_ProfileJson["model"][m]["materials"];
// strFF = (boost::format(";%1%;")%strFF).str();
// std::string strTT = (boost::format(";%1%;")%s1).str();
// if (strFF.find(strTT) != std::string::npos) {
// std::string sModel = m_ProfileJson["model"][m]["model"];
//
// vModel = (boost::format("%1%[%2%]")%vModel %sModel).str();
// bFind = 1;
// }
// }
//
// OneFF["models"] = vModel;
//
// m_ProfileJson["filament"][s1] = OneFF;
// }
//
// //process
// json pProcess = jLocal["process_list"];
// nsize = pProcess.size();
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% processes")%nsize;
// for (int n = 0; n < nsize; n++) {
// json OneProcess = pProcess.at(n);
//
// std::string s2 = OneProcess["sub_path"];
// //wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
// boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
// std::string sub_file = sub_path.string();
// LoadFile(sub_file, contents);
// json pm = json::parse(contents);
//
// std::string bInstall = pm["instantiation"];
// if (bInstall == "true")
// {
// m_ProfileJson["process"].push_back(OneProcess);
// }
// }
//
// }
// catch(nlohmann::detail::parse_error &err) {
// BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<strFilePath <<" got a nlohmann::detail::parse_error, reason = " << err.what();
// return -1;
// }
// catch (std::exception &e) {
// // wxMessageBox(e.what(), "", MB_OK);
// //wxLogMessage("GUIDE: LoadFamily Error: %s", e.what());
// BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << strFilePath << " got exception: " << e.what();
// return -1;
// }
//
// return 0;
//}
int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath) int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath)
{ {
//wxString strFolder = strFilePath.BeforeLast(boost::filesystem::path::preferred_separator); // wxString strFolder = strFilePath.BeforeLast(boost::filesystem::path::preferred_separator);
boost::filesystem::path file_path(strFilePath); boost::filesystem::path file_path(strFilePath);
boost::filesystem::path vendor_dir = boost::filesystem::absolute(file_path.parent_path()/ strVendor).make_preferred(); boost::filesystem::path vendor_dir = boost::filesystem::absolute(file_path.parent_path() / strVendor).make_preferred();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", vendor path %1%.")% vendor_dir.string(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", vendor path %1%.") % vendor_dir.string();
try { try {
// wxLogMessage("GUIDE: json_path1 %s", w2s(strFilePath));
//wxLogMessage("GUIDE: json_path1 %s", w2s(strFilePath));
std::string contents; std::string contents;
LoadFile(strFilePath, contents); LoadFile(strFilePath, contents);
//wxLogMessage("GUIDE: json_path1 content: %s", contents); // wxLogMessage("GUIDE: json_path1 content: %s", contents);
json jLocal=json::parse(contents); json jLocal = json::parse(contents);
//wxLogMessage("GUIDE: json_path1 Loaded"); // wxLogMessage("GUIDE: json_path1 Loaded");
// BBS:models // BBS:models
json pmodels = jLocal["machine_model_list"]; json pmodels = jLocal["machine_model_list"];
int nsize = pmodels.size(); int nsize = pmodels.size();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machine models")%nsize; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machine models") % nsize;
for (int n = 0; n < nsize; n++) { for (int n = 0; n < nsize; n++) {
json OneModel = pmodels.at(n); json OneModel = pmodels.at(n);
@ -1033,11 +1211,11 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
std::string sub_file = sub_path.string(); std::string sub_file = sub_path.string();
//wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath)); // wxLogMessage("GUIDE: json_path2 %s", w2s(ModelFilePath));
LoadFile(sub_file, contents); LoadFile(sub_file, contents);
//wxLogMessage("GUIDE: json_path2 content: %s", contents); // wxLogMessage("GUIDE: json_path2 content: %s", contents);
json pm=json::parse(contents); json pm = json::parse(contents);
//wxLogMessage("GUIDE: json_path2 loaded"); // wxLogMessage("GUIDE: json_path2 loaded");
OneModel["vendor"] = strVendor; OneModel["vendor"] = strVendor;
std::string NozzleOpt = pm["nozzle_diameter"]; std::string NozzleOpt = pm["nozzle_diameter"];
@ -1045,8 +1223,8 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
OneModel["nozzle_diameter"] = NozzleOpt; OneModel["nozzle_diameter"] = NozzleOpt;
OneModel["materials"] = pm["default_materials"]; OneModel["materials"] = pm["default_materials"];
//wxString strCoverPath = wxString::Format("%s\\%s\\%s_cover.png", strFolder, strVendor, std::string(s1.mb_str())); // wxString strCoverPath = wxString::Format("%s\\%s\\%s_cover.png", strFolder, strVendor, std::string(s1.mb_str()));
std::string cover_file = s1+"_cover.png"; std::string cover_file = s1 + "_cover.png";
boost::filesystem::path cover_path = boost::filesystem::absolute(vendor_dir / cover_file).make_preferred(); boost::filesystem::path cover_path = boost::filesystem::absolute(vendor_dir / cover_file).make_preferred();
OneModel["cover"] = cover_path.string(); OneModel["cover"] = cover_path.string();
@ -1058,14 +1236,14 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
// BBS:Machine // BBS:Machine
json pmachine = jLocal["machine_list"]; json pmachine = jLocal["machine_list"];
nsize = pmachine.size(); nsize = pmachine.size();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machines")%nsize; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% machines") % nsize;
for (int n = 0; n < nsize; n++) { for (int n = 0; n < nsize; n++) {
json OneMachine = pmachine.at(n); json OneMachine = pmachine.at(n);
std::string s1 = OneMachine["name"]; std::string s1 = OneMachine["name"];
std::string s2 = OneMachine["sub_path"]; std::string s2 = OneMachine["sub_path"];
//wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2); // wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
std::string sub_file = sub_path.string(); std::string sub_file = sub_path.string();
LoadFile(sub_file, contents); LoadFile(sub_file, contents);
@ -1074,8 +1252,9 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
std::string strInstant = pm["instantiation"]; std::string strInstant = pm["instantiation"];
if (strInstant.compare("true") == 0) { if (strInstant.compare("true") == 0) {
OneMachine["model"] = pm["printer_model"]; OneMachine["model"] = pm["printer_model"];
OneMachine["nozzle"] = pm["nozzle_diameter"][0];
m_ProfileJson["machine"].push_back(OneMachine); m_ProfileJson["machine"][s1]=OneMachine;
} }
} }
@ -1086,16 +1265,15 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
int nFalse = 0; int nFalse = 0;
int nModel = 0; int nModel = 0;
int nFinish = 0; int nFinish = 0;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% filaments")%nsize; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% filaments") % nsize;
for (int n = 0; n < nsize; n++) { for (int n = 0; n < nsize; n++) {
json OneFF = pFilament.at(n); json OneFF = pFilament.at(n);
std::string s1 = OneFF["name"]; std::string s1 = OneFF["name"];
std::string s2 = OneFF["sub_path"]; std::string s2 = OneFF["sub_path"];
if (!m_ProfileJson["filament"].contains(s1)) if (!m_ProfileJson["filament"].contains(s1)) {
{ // wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
//wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
std::string sub_file = sub_path.string(); std::string sub_file = sub_path.string();
LoadFile(sub_file, contents); LoadFile(sub_file, contents);
@ -1113,64 +1291,57 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
OneFF["type"] = sT; OneFF["type"] = sT;
OneFF["models"] = ""; OneFF["models"] = "";
json pPrinters = pm["compatible_printers"];
int nPrinter = pPrinters.size();
std::string ModelList = "";
for (int i = 0; i < nPrinter; i++)
{
std::string sP = pPrinters.at(i);
if (m_ProfileJson["machine"].contains(sP))
{
std::string mModel = m_ProfileJson["machine"][sP]["model"];
std::string mNozzle = m_ProfileJson["machine"][sP]["nozzle"];
std::string NewModel = mModel + "++" + mNozzle;
ModelList = (boost::format("%1%[%2%]") % ModelList % NewModel).str();
}
}
OneFF["models"] = ModelList;
OneFF["selected"] = 0; OneFF["selected"] = 0;
}
else
continue;
} else {
OneFF = m_ProfileJson["filament"][s1];
}
std::string vModel = "";
int nm = m_ProfileJson["model"].size();
int bFind = 0;
for (int m = 0; m < nm; m++) {
std::string strFF = m_ProfileJson["model"][m]["materials"];
strFF = (boost::format(";%1%;")%strFF).str();
std::string strTT = (boost::format(";%1%;")%s1).str();
if (strFF.find(strTT) != std::string::npos) {
std::string sModel = m_ProfileJson["model"][m]["model"];
vModel = (boost::format("%1%[%2%]")%vModel %sModel).str();
bFind = 1;
}
}
OneFF["models"] = vModel;
m_ProfileJson["filament"][s1] = OneFF; m_ProfileJson["filament"][s1] = OneFF;
} else
continue;
}
} }
//process // process
json pProcess = jLocal["process_list"]; json pProcess = jLocal["process_list"];
nsize = pProcess.size(); nsize = pProcess.size();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% processes")%nsize; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% processes") % nsize;
for (int n = 0; n < nsize; n++) { for (int n = 0; n < nsize; n++) {
json OneProcess = pProcess.at(n); json OneProcess = pProcess.at(n);
std::string s2 = OneProcess["sub_path"]; std::string s2 = OneProcess["sub_path"];
//wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2); // wxString ModelFilePath = wxString::Format("%s\\%s\\%s", strFolder, strVendor, s2);
boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred(); boost::filesystem::path sub_path = boost::filesystem::absolute(vendor_dir / s2).make_preferred();
std::string sub_file = sub_path.string(); std::string sub_file = sub_path.string();
LoadFile(sub_file, contents); LoadFile(sub_file, contents);
json pm = json::parse(contents); json pm = json::parse(contents);
std::string bInstall = pm["instantiation"]; std::string bInstall = pm["instantiation"];
if (bInstall == "true") if (bInstall == "true") { m_ProfileJson["process"].push_back(OneProcess); }
{
m_ProfileJson["process"].push_back(OneProcess);
}
} }
} } catch (nlohmann::detail::parse_error &err) {
catch(nlohmann::detail::parse_error &err) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << strFilePath << " got a nlohmann::detail::parse_error, reason = " << err.what();
BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<strFilePath <<" got a nlohmann::detail::parse_error, reason = " << err.what();
return -1; return -1;
} } catch (std::exception &e) {
catch (std::exception &e) {
// wxMessageBox(e.what(), "", MB_OK); // wxMessageBox(e.what(), "", MB_OK);
//wxLogMessage("GUIDE: LoadFamily Error: %s", e.what()); // wxLogMessage("GUIDE: LoadFamily Error: %s", e.what());
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << strFilePath << " got exception: " << e.what(); BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << strFilePath << " got exception: " << e.what();
return -1; return -1;
} }
@ -1178,6 +1349,7 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
return 0; return 0;
} }
void GuideFrame::StrReplace(std::string &strBase, std::string strSrc, std::string strDes) void GuideFrame::StrReplace(std::string &strBase, std::string strSrc, std::string strDes)
{ {
int pos = 0; int pos = 0;