Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
feat: SnapCAD Studio'yu YakHub deposuna taşı
- DWG/DXF içe aktarma ve .skf yeniden açma düzeltmeleri - YakNet Bulut eşitlemede boş/eski kopya koruması ve yerel-only proje bildirimi - Panelden içe aktarma duyuruları ve erişilebilir Türkçe hata mesajları - AGPL-3.0 lisansı, README ve YakHub bağlantıları
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { strFromU8, unzipSync } from "fflate";
|
||||
import { exportMeshesTo3mf, type ThreemfExportMesh } from "@/lib/threemfExport";
|
||||
|
||||
function makePrismMesh(name: string, color?: string): ThreemfExportMesh {
|
||||
const v = [
|
||||
[0, 0, 0],
|
||||
[10, 0, 0],
|
||||
[10, 20, 0],
|
||||
[0, 20, 0],
|
||||
[0, 0, 30],
|
||||
[10, 0, 30],
|
||||
[10, 20, 30],
|
||||
[0, 20, 30],
|
||||
] as [number, number, number][];
|
||||
|
||||
const faces: [number, number, number][] = [
|
||||
[0, 2, 1],
|
||||
[0, 3, 2],
|
||||
[4, 5, 6],
|
||||
[4, 6, 7],
|
||||
[0, 1, 5],
|
||||
[0, 5, 4],
|
||||
[1, 2, 6],
|
||||
[1, 6, 5],
|
||||
[2, 3, 7],
|
||||
[2, 7, 6],
|
||||
[3, 0, 4],
|
||||
[3, 4, 7],
|
||||
];
|
||||
|
||||
return {
|
||||
name,
|
||||
vertices: v,
|
||||
faces,
|
||||
color,
|
||||
};
|
||||
}
|
||||
|
||||
describe("3MF Modern 3D Manufacturing Export", () => {
|
||||
it("creates a valid .3mf ZIP package with standard OPC structure", () => {
|
||||
const mesh = makePrismMesh("cube_test", "#38bdf8");
|
||||
const zipBytes = exportMeshesTo3mf([mesh], {
|
||||
title: "Test Cube",
|
||||
unit: "millimeter",
|
||||
});
|
||||
|
||||
expect(zipBytes.byteLength).toBeGreaterThan(100);
|
||||
|
||||
const unzipped = unzipSync(zipBytes);
|
||||
expect(unzipped["[Content_Types].xml"]).toBeDefined();
|
||||
expect(unzipped["_rels/.rels"]).toBeDefined();
|
||||
expect(unzipped["3D/3dmodel.model"]).toBeDefined();
|
||||
|
||||
const modelContent = strFromU8(unzipped["3D/3dmodel.model"]);
|
||||
expect(modelContent).toContain('unit="millimeter"');
|
||||
expect(modelContent).toContain("<model");
|
||||
expect(modelContent).toContain("SnapCAD Studio");
|
||||
expect(modelContent).toContain('name="cube_test"');
|
||||
expect(modelContent).toContain("<vertices>");
|
||||
expect(modelContent).toContain("<triangles>");
|
||||
expect(modelContent).toContain("<item objectid=");
|
||||
});
|
||||
|
||||
it("exports multi-material and colors using 3MF material extension", () => {
|
||||
const meshA = makePrismMesh("cyan_box", "#00ffff");
|
||||
const meshB = makePrismMesh("magenta_box", "#ff00ff");
|
||||
const zipBytes = exportMeshesTo3mf([meshA, meshB]);
|
||||
|
||||
const unzipped = unzipSync(zipBytes);
|
||||
const modelContent = strFromU8(unzipped["3D/3dmodel.model"]);
|
||||
|
||||
expect(modelContent).toContain("<m:colorgroup");
|
||||
expect(modelContent).toContain('color="#00FFFFFF"');
|
||||
expect(modelContent).toContain('color="#FF00FFFF"');
|
||||
expect(modelContent).toContain('pid="1"');
|
||||
});
|
||||
|
||||
it("converts SketchForge Y-up scene into standard Z-up slicer coordinates", () => {
|
||||
const mesh = makePrismMesh("z_up_test");
|
||||
const zipBytes = exportMeshesTo3mf([mesh]);
|
||||
|
||||
const unzipped = unzipSync(zipBytes);
|
||||
const modelContent = strFromU8(unzipped["3D/3dmodel.model"]);
|
||||
|
||||
// Original vertex [0, 20, 30] in Y-up should convert to [x, -z, y] = [0, -30, 20]
|
||||
expect(modelContent).toContain('<vertex x="0.00000" y="-30.00000" z="20.00000"/>');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user