feat(orca): added orcaslicer preset
This commit is contained in:
@@ -15,9 +15,18 @@ export class PrintService {
|
||||
|
||||
// Append extra params if meant for backend
|
||||
if (params) {
|
||||
// for key in params...
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key] !== null && params[key] !== undefined) {
|
||||
formData.append(key, params[key]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return this.http.post(`${this.apiUrl}/calculate/stl`, formData);
|
||||
return this.http.post(`${this.apiUrl}/api/quote`, formData);
|
||||
}
|
||||
|
||||
getProfiles(): Observable<any> {
|
||||
return this.http.get(`${this.apiUrl}/api/profiles/available`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,44 +48,33 @@
|
||||
<h3>Print Settings</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Layer Height (mm)</label>
|
||||
<select [(ngModel)]="params.layerHeight">
|
||||
<option value="0.12">0.12 (High Quality)</option>
|
||||
<option value="0.16">0.16 (Quality)</option>
|
||||
<option value="0.20">0.20 (Standard)</option>
|
||||
<option value="0.24">0.24 (Draft)</option>
|
||||
<option value="0.28">0.28 (Extra Draft)</option>
|
||||
<label>Machine</label>
|
||||
<select [(ngModel)]="params.machine">
|
||||
<option *ngFor="let m of machines" [value]="m">{{ m }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Material</label>
|
||||
<select [(ngModel)]="params.filament">
|
||||
<option *ngFor="let f of filaments" [value]="f">{{ f }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Quality / Process</label>
|
||||
<select [(ngModel)]="params.quality">
|
||||
<option *ngFor="let q of qualities" [value]="q">{{ q }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Infill Density (%)</label>
|
||||
<div class="range-wrapper">
|
||||
<input type="range" [(ngModel)]="params.infill" min="0" max="100" step="5">
|
||||
<span>{{ params.infill }}%</span>
|
||||
<input type="range" [(ngModel)]="params.infill_density" min="0" max="100" step="5">
|
||||
<span>{{ params.infill_density }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label>Wall Loops</label>
|
||||
<input type="number" [(ngModel)]="params.walls" min="1" max="10">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Top/Bottom Shells</label>
|
||||
<input type="number" [(ngModel)]="params.topBottom" min="1" max="10">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Material</label>
|
||||
<select [(ngModel)]="params.material">
|
||||
<option value="PLA">PLA</option>
|
||||
<option value="PETG">PETG</option>
|
||||
<option value="ABS">ABS</option>
|
||||
<option value="TPU">TPU</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
@@ -103,21 +92,21 @@
|
||||
<div class="card result-card">
|
||||
<h2>Estimated Cost</h2>
|
||||
<div class="price-big">
|
||||
{{ quoteResult.cost.total | currency:'EUR' }}
|
||||
{{ quoteResult?.cost?.total | currency:'EUR' }}
|
||||
</div>
|
||||
|
||||
<div class="specs-list">
|
||||
<div class="spec-item">
|
||||
<span>Print Time</span>
|
||||
<strong>{{ quoteResult.print_time_formatted }}</strong>
|
||||
<strong>{{ quoteResult?.print_time_formatted }}</strong>
|
||||
</div>
|
||||
<div class="spec-item">
|
||||
<span>Material Weight</span>
|
||||
<strong>{{ quoteResult.material_grams | number:'1.0-0' }}g</strong>
|
||||
<strong>{{ quoteResult?.material_grams | number:'1.0-0' }}g</strong>
|
||||
</div>
|
||||
<div class="spec-item">
|
||||
<span>Printer</span>
|
||||
<strong>{{ quoteResult.printer }}</strong>
|
||||
<strong>{{ quoteResult?.printer }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -126,11 +115,11 @@
|
||||
<div class="spec-header">Request Specs</div>
|
||||
<div class="spec-item compact">
|
||||
<span>Infill</span>
|
||||
<span>{{ params.infill }}%</span>
|
||||
<span>{{ params.infill_density }}%</span>
|
||||
</div>
|
||||
<div class="spec-item compact">
|
||||
<span>Layer Height</span>
|
||||
<span>{{ params.layerHeight }}mm</span>
|
||||
<span>{{ params.layer_height || 'Standard' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
@@ -12,7 +12,7 @@ import { StlViewerComponent } from '../../common/stl-viewer/stl-viewer.component
|
||||
templateUrl: './advanced-quote.component.html',
|
||||
styleUrls: ['./advanced-quote.component.scss']
|
||||
})
|
||||
export class AdvancedQuoteComponent {
|
||||
export class AdvancedQuoteComponent implements OnInit {
|
||||
printService = inject(PrintService);
|
||||
|
||||
selectedFile: File | null = null;
|
||||
@@ -20,15 +20,29 @@ export class AdvancedQuoteComponent {
|
||||
isCalculating = false;
|
||||
quoteResult: any = null;
|
||||
|
||||
// Available Profiles
|
||||
machines: string[] = [];
|
||||
filaments: string[] = [];
|
||||
qualities: string[] = [];
|
||||
|
||||
// Parameters
|
||||
params = {
|
||||
layerHeight: '0.20',
|
||||
infill: 15,
|
||||
walls: 2,
|
||||
topBottom: 3,
|
||||
material: 'PLA'
|
||||
machine: 'bambu_a1',
|
||||
filament: 'pla_basic',
|
||||
quality: 'standard',
|
||||
layer_height: null,
|
||||
infill_density: 15,
|
||||
support_enabled: false
|
||||
};
|
||||
|
||||
ngOnInit() {
|
||||
this.printService.getProfiles().subscribe(data => {
|
||||
this.machines = data.machines;
|
||||
this.filaments = data.filaments;
|
||||
this.qualities = data.processes;
|
||||
});
|
||||
}
|
||||
|
||||
onDragOver(event: DragEvent) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -77,10 +91,25 @@ export class AdvancedQuoteComponent {
|
||||
this.isCalculating = true;
|
||||
|
||||
// Use PrintService
|
||||
this.printService.calculateQuote(this.selectedFile, this.params)
|
||||
this.printService.calculateQuote(this.selectedFile, {
|
||||
machine: this.params.machine,
|
||||
filament: this.params.filament,
|
||||
quality: this.params.quality,
|
||||
infill_density: this.params.infill_density,
|
||||
// Optional mappings if user selected overrides
|
||||
// layer_height: this.params.layer_height,
|
||||
// support_enabled: this.params.support_enabled
|
||||
})
|
||||
.subscribe({
|
||||
next: (res) => {
|
||||
this.quoteResult = res;
|
||||
console.log('API Response:', res);
|
||||
if (res.success) {
|
||||
this.quoteResult = res.data;
|
||||
console.log('Quote Result set to:', this.quoteResult);
|
||||
} else {
|
||||
console.error('API succeeded but returned error flag:', res.error);
|
||||
alert('Error: ' + res.error);
|
||||
}
|
||||
this.isCalculating = false;
|
||||
},
|
||||
error: (err) => {
|
||||
|
||||
Reference in New Issue
Block a user