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: sesli CAD asistani, bellek optimizasyonlari ve akilli cozunurluk
- SnapVoice Turkce sesli CAD ve komut konsolu (/denetle, /ram, /eko, /otomatik, /sessiz) - 3B uzamsal sesli radar ve gorme engelli gelistirici geometri denetim motoru - LibreDWG/DXF ikili sikistirma, font tembel yukleme ve RAM optimizasyonu - Monitor cozunurlugune gore otomatik uyarlamali dinamik grafik modu
This commit is contained in:
@@ -1,8 +1,41 @@
|
||||
import * as THREE from "three";
|
||||
import DxfParser from "dxf-parser";
|
||||
import { deflateSync, inflateSync, strToU8, strFromU8 } from "fflate";
|
||||
import { createLocalId } from "@/lib/localIds";
|
||||
import type { WorkplaneShape } from "@/types/sketchforge";
|
||||
|
||||
export function compressDxfText(source: string): string {
|
||||
const bytes = deflateSync(strToU8(source));
|
||||
let binary = "";
|
||||
for (let offset = 0; offset < bytes.length; offset += 0x8000) {
|
||||
binary += String.fromCharCode(...bytes.subarray(offset, Math.min(bytes.length, offset + 0x8000)));
|
||||
}
|
||||
return globalThis.btoa(binary);
|
||||
}
|
||||
|
||||
export function decompressDxfText(base64: string): string {
|
||||
const binary = globalThis.atob(base64);
|
||||
const bytes = new Uint8Array(binary.length);
|
||||
for (let index = 0; index < binary.length; index += 1) {
|
||||
bytes[index] = binary.charCodeAt(index);
|
||||
}
|
||||
return strFromU8(inflateSync(bytes));
|
||||
}
|
||||
|
||||
export function getImportedDxfText(importedMesh?: WorkplaneShape["importedMesh"]): string | undefined {
|
||||
if (!importedMesh) return undefined;
|
||||
if (importedMesh.sourceDxfText) return importedMesh.sourceDxfText;
|
||||
if (importedMesh.sourceDxfCompressed) {
|
||||
try {
|
||||
return decompressDxfText(importedMesh.sourceDxfCompressed);
|
||||
} catch (err) {
|
||||
console.warn("Could not decompress DXF source", err);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export const MAX_DXF_ENTITIES = 50_000;
|
||||
export const MAX_DXF_TRIANGLES = 200_000;
|
||||
const DEFAULT_DXF_EXTRUSION_DEPTH = 4;
|
||||
@@ -926,6 +959,11 @@ export function importedShapeFromDxf(fileName: string, source: string): Workplan
|
||||
}
|
||||
geom.dispose();
|
||||
|
||||
const isLarge = source.length > 2048;
|
||||
const dxfPayload = isLarge
|
||||
? { sourceDxfCompressed: compressDxfText(source) }
|
||||
: { sourceDxfText: source };
|
||||
|
||||
return {
|
||||
id: createLocalId("uploaded-dxf"),
|
||||
name: fileName.replace(/\.[^.]+$/, "") || "İçe Aktarılan DWG/DXF Pafta",
|
||||
@@ -948,6 +986,7 @@ export function importedShapeFromDxf(fileName: string, source: string): Workplan
|
||||
baseHeight: height,
|
||||
triangleCount: positions.length / 9,
|
||||
sourceFormat: "dxf",
|
||||
...dxfPayload,
|
||||
},
|
||||
locked: false,
|
||||
hidden: false,
|
||||
|
||||
Reference in New Issue
Block a user