* claim: #3708 * Export Current View as DXF includes shown sketches (#3708) The view export refused a design with only a sketch and left shown sketches out when bodies were present. It now draws the sketches the viewport shows (profile curves only: no construction geometry, points, dimensions or constraints) on a SKETCH layer, one entity per curve. Finished sketches are hidden behind bodies through the body-edge occlusion; the active sketch is drawn on top, as in the viewport. Sketch points use the same projection, budgets and cancellation. The export is refused only when there is neither a visible body nor a shown sketch curve; the dialog and the command share that check (cmd::view_dxf_exportable). --------- Co-authored-by: bherbruck <brennen.herbruck@gmail.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
34 files changed
+313
-62
No files matched your search
+1
-1
@@ -70,7 +70,7 @@ pointer movement orbits without a mouse button, and vertical scrolling zooms. Ot
|
||||
retain their saved two-finger scroll preference; camera motion is available through
|
||||
`view.navigate` and modifier-aware `ui.move` automation.
|
||||
|
||||
M11 precursor: File → Export Current View as DXF exports shown placed bodies from the current
|
||||
M11 precursor: File → Export Current View as DXF exports shown placed bodies and sketches from the current
|
||||
camera as a 2D millimetre drawing, with hidden edges omitted or dashed. Vector occlusion splits
|
||||
partly hidden edges and includes curved silhouettes. Repeated part meshes and triangle
|
||||
hierarchies are shared; bounded desktop preparation and occlusion use up to eight workers.
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Žádná hlášení o pádech.",
|
||||
"No matching appearance presets.": "Žádné odpovídající předvolby vzhledu.",
|
||||
"No matching appearances": "Žádné odpovídající vzhledy",
|
||||
"No visible bodies to export.": "Žádná viditelná tělesa k exportu.",
|
||||
"No visible bodies or sketches to export.": "Žádná viditelná tělesa ani náčrty k exportu.",
|
||||
"None": "Žádné",
|
||||
"Not available yet": "Zatím není k dispozici",
|
||||
"Notch": "Zářez",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Promítání geometrie (3/5)",
|
||||
"dxf.progress.write": "Zápis DXF (5/5)",
|
||||
"dxf.tolerance": "Tolerance křivek",
|
||||
"dxf.tolerance_help": "Pouze viditelná tělesa. Křivky jsou nahrazeny úsečkami. Menší tolerance dává jemnější křivky, ale zabere více času a paměti.",
|
||||
"dxf.tolerance_help": "Pouze viditelná tělesa a zobrazené náčrty. Křivky jsou nahrazeny úsečkami. Menší tolerance dává jemnější křivky, ale zabere více času a paměti.",
|
||||
"file_load.built": "Dosud sestaveno: {built} z {total} prvků.",
|
||||
"file_load.converting": "Převod tělesa {done} z {total}",
|
||||
"file_load.inserting": "Vkládání geometrie",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Ingen nedbrudsrapporter.",
|
||||
"No matching appearance presets.": "Ingen matchende udseendeforudindstillinger.",
|
||||
"No matching appearances": "Ingen matchende udseender",
|
||||
"No visible bodies to export.": "Der er ingen synlige emner at eksportere.",
|
||||
"No visible bodies or sketches to export.": "Der er ingen synlige emner eller skitser at eksportere.",
|
||||
"None": "Ingen",
|
||||
"Not available yet": "Endnu ikke tilgængelig",
|
||||
"Notch": "Udskæring",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Projicerer geometri (3/5)",
|
||||
"dxf.progress.write": "Skriver DXF (5/5)",
|
||||
"dxf.tolerance": "Kurvetolerance",
|
||||
"dxf.tolerance_help": "Kun synlige emner. Kurver består af rette linjestykker. En mindre tolerance giver finere kurver og kræver mere tid og hukommelse.",
|
||||
"dxf.tolerance_help": "Kun synlige emner og viste skitser. Kurver består af rette linjestykker. En mindre tolerance giver finere kurver og kræver mere tid og hukommelse.",
|
||||
"file_load.built": "Bygget indtil videre: {built} af {total} features.",
|
||||
"file_load.converting": "Konverterer solid {done} af {total}",
|
||||
"file_load.inserting": "Indsætter geometri",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Keine Absturzberichte.",
|
||||
"No matching appearance presets.": "Keine passenden Erscheinungsbildvorlagen.",
|
||||
"No matching appearances": "Keine passenden Erscheinungsbilder",
|
||||
"No visible bodies to export.": "Keine sichtbaren Körper zum Exportieren.",
|
||||
"No visible bodies or sketches to export.": "Keine sichtbaren Körper oder Skizzen zum Exportieren.",
|
||||
"None": "Keine",
|
||||
"Not available yet": "Noch nicht verfügbar",
|
||||
"Notch": "Ausklinkung",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Geometrie projizieren (3/5)",
|
||||
"dxf.progress.write": "DXF schreiben (5/5)",
|
||||
"dxf.tolerance": "Kurventoleranz",
|
||||
"dxf.tolerance_help": "Nur sichtbare Körper. Kurven werden durch gerade Segmente angenähert. Eine kleinere Toleranz liefert feinere Kurven und benötigt mehr Zeit und Speicher.",
|
||||
"dxf.tolerance_help": "Nur sichtbare Körper und angezeigte Skizzen. Kurven werden durch gerade Segmente angenähert. Eine kleinere Toleranz liefert feinere Kurven und benötigt mehr Zeit und Speicher.",
|
||||
"file_load.built": "Bisher erstellt: {built} von {total} Merkmalen.",
|
||||
"file_load.converting": "Volumenkörper {done} von {total} wird konvertiert",
|
||||
"file_load.inserting": "Geometrie wird eingefügt",
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
"No crash reports.": "No crash reports.",
|
||||
"No matching appearance presets.": "No matching appearance presets.",
|
||||
"No matching appearances": "No matching appearances",
|
||||
"No visible bodies to export.": "No visible bodies to export.",
|
||||
"No visible bodies or sketches to export.": "No visible bodies or sketches to export.",
|
||||
"Nominal diameter": "Nominal diameter",
|
||||
"None": "None",
|
||||
"Not available yet": "Not available yet",
|
||||
@@ -856,7 +856,7 @@
|
||||
"dxf.progress.projection": "Projecting geometry (3/5)",
|
||||
"dxf.progress.write": "Writing DXF (5/5)",
|
||||
"dxf.tolerance": "Curve tolerance",
|
||||
"dxf.tolerance_help": "Visible bodies only. Curves use straight segments. Smaller tolerance gives finer curves and uses more time and memory.",
|
||||
"dxf.tolerance_help": "Visible bodies and shown sketches only. Curves use straight segments. Smaller tolerance gives finer curves and uses more time and memory.",
|
||||
"file_load.built": "Built so far: {built} of {total} features.",
|
||||
"file_load.converting": "Converting solid {done} of {total}",
|
||||
"file_load.inserting": "Inserting geometry",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "No hay informes de fallos.",
|
||||
"No matching appearance presets.": "No hay preajustes de apariencia coincidentes.",
|
||||
"No matching appearances": "No hay apariencias coincidentes",
|
||||
"No visible bodies to export.": "No hay cuerpos visibles para exportar.",
|
||||
"No visible bodies or sketches to export.": "No hay cuerpos ni bocetos visibles para exportar.",
|
||||
"None": "Ninguno",
|
||||
"Not available yet": "Todavía no disponible",
|
||||
"Notch": "Muesca",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Proyectando geometría (3/5)",
|
||||
"dxf.progress.write": "Escribiendo DXF (5/5)",
|
||||
"dxf.tolerance": "Tolerancia de curva",
|
||||
"dxf.tolerance_help": "Solo cuerpos visibles. Las curvas usan segmentos rectos. Una tolerancia menor da curvas más finas y consume más tiempo y memoria.",
|
||||
"dxf.tolerance_help": "Solo cuerpos visibles y bocetos mostrados. Las curvas usan segmentos rectos. Una tolerancia menor da curvas más finas y consume más tiempo y memoria.",
|
||||
"file_load.built": "Construido hasta ahora: {built} de {total} operaciones.",
|
||||
"file_load.converting": "Convirtiendo sólido {done} de {total}",
|
||||
"file_load.inserting": "Insertando geometría",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Aucun rapport de plantage.",
|
||||
"No matching appearance presets.": "Aucun préréglage d’apparence correspondant.",
|
||||
"No matching appearances": "Aucune apparence correspondante",
|
||||
"No visible bodies to export.": "Aucun corps visible à exporter.",
|
||||
"No visible bodies or sketches to export.": "Aucun corps ni esquisse visible à exporter.",
|
||||
"None": "Aucun",
|
||||
"Not available yet": "Pas encore disponible",
|
||||
"Notch": "Encoche",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Projection de la géométrie (3/5)",
|
||||
"dxf.progress.write": "Écriture du DXF (5/5)",
|
||||
"dxf.tolerance": "Tolérance des courbes",
|
||||
"dxf.tolerance_help": "Corps visibles uniquement. Les courbes sont approchées par des segments de droite. Une tolérance plus faible donne des courbes plus fines, au prix de plus de temps et de mémoire.",
|
||||
"dxf.tolerance_help": "Corps visibles et esquisses affichées uniquement. Les courbes sont approchées par des segments de droite. Une tolérance plus faible donne des courbes plus fines, au prix de plus de temps et de mémoire.",
|
||||
"file_load.built": "Construit jusqu’ici : {built} entités sur {total}.",
|
||||
"file_load.converting": "Conversion du solide {done} sur {total}",
|
||||
"file_load.inserting": "Insertion de la géométrie",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Non hai informes de fallos.",
|
||||
"No matching appearance presets.": "Non hai preaxustes de aparencia coincidentes.",
|
||||
"No matching appearances": "Non hai aparencias coincidentes",
|
||||
"No visible bodies to export.": "Non hai corpos visibles para exportar.",
|
||||
"No visible bodies or sketches to export.": "Non hai corpos nin bosquexos visibles para exportar.",
|
||||
"None": "Ningún",
|
||||
"Not available yet": "Aínda non dispoñible",
|
||||
"Notch": "Entalle",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Proxectando a xeometría (3/5)",
|
||||
"dxf.progress.write": "Escribindo o DXF (5/5)",
|
||||
"dxf.tolerance": "Tolerancia da curva",
|
||||
"dxf.tolerance_help": "Só os corpos visibles. As curvas usan segmentos rectos. Unha tolerancia menor dá curvas máis finas e usa máis tempo e memoria.",
|
||||
"dxf.tolerance_help": "Só os corpos visibles e os bosquexos amosados. As curvas usan segmentos rectos. Unha tolerancia menor dá curvas máis finas e usa máis tempo e memoria.",
|
||||
"file_load.built": "Construído ata agora: {built} de {total} operacións.",
|
||||
"file_load.converting": "Convertendo o sólido {done} de {total}",
|
||||
"file_load.inserting": "Inserindo a xeometría",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "Nincsenek összeomlási jelentések.",
|
||||
"No matching appearance presets.": "Nincs egyező megjelenés-előbeállítás.",
|
||||
"No matching appearances": "Nincs egyező megjelenés",
|
||||
"No visible bodies to export.": "Nincs exportálható látható test.",
|
||||
"None": "Nincs",
|
||||
"Not available yet": "Még nem érhető el",
|
||||
"Notch": "Bevágás",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "Tidak ada laporan crash.",
|
||||
"No matching appearance presets.": "Tidak ada preset tampilan yang cocok.",
|
||||
"No matching appearances": "Tidak ada tampilan yang cocok",
|
||||
"No visible bodies to export.": "Tidak ada bodi terlihat untuk diekspor.",
|
||||
"None": "Tidak ada",
|
||||
"Not available yet": "Belum tersedia",
|
||||
"Notch": "Takik",
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
"No crash reports.": "Nessun rapporto di arresto anomalo.",
|
||||
"No matching appearance presets.": "Nessun predefinito di aspetto corrispondente.",
|
||||
"No matching appearances": "Nessun aspetto corrispondente",
|
||||
"No visible bodies to export.": "Nessun corpo visibile da esportare.",
|
||||
"No visible bodies or sketches to export.": "Nessun corpo o schizzo visibile da esportare.",
|
||||
"Nominal diameter": "Diametro nominale",
|
||||
"None": "Nessuno",
|
||||
"Not available yet": "Non ancora disponibile",
|
||||
@@ -835,7 +835,7 @@
|
||||
"dxf.progress.projection": "Proiezione della geometria (3/5)",
|
||||
"dxf.progress.write": "Scrittura DXF (5/5)",
|
||||
"dxf.tolerance": "Tolleranza delle curve",
|
||||
"dxf.tolerance_help": "Solo corpi visibili. Le curve usano segmenti rettilinei. Una tolleranza minore produce curve più precise e richiede più tempo e memoria.",
|
||||
"dxf.tolerance_help": "Solo corpi visibili e schizzi mostrati. Le curve usano segmenti rettilinei. Una tolleranza minore produce curve più precise e richiede più tempo e memoria.",
|
||||
"file_load.built": "Costruite finora: {built} di {total} feature.",
|
||||
"file_load.converting": "Conversione del solido {done} di {total}",
|
||||
"file_load.inserting": "Inserimento della geometria",
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
"No crash reports.": "クラッシュレポートはありません。",
|
||||
"No matching appearance presets.": "一致する外観プリセットはありません。",
|
||||
"No matching appearances": "一致する外観がありません",
|
||||
"No visible bodies to export.": "出力する表示中のボディがありません。",
|
||||
"No visible bodies or sketches to export.": "出力する表示中のボディまたはスケッチがありません。",
|
||||
"Nominal diameter": "呼び径",
|
||||
"None": "なし",
|
||||
"Not available yet": "まだ利用できません",
|
||||
@@ -856,7 +856,7 @@
|
||||
"dxf.progress.projection": "形状を投影中 (3/5)",
|
||||
"dxf.progress.write": "DXFを書き込み中 (5/5)",
|
||||
"dxf.tolerance": "曲線の許容誤差",
|
||||
"dxf.tolerance_help": "表示中のボディを出力し、曲線は線分で近似します。許容誤差を小さくすると曲線が滑らかになりますが、処理時間とメモリ使用量が増えます。",
|
||||
"dxf.tolerance_help": "表示中のボディとスケッチを出力し、曲線は線分で近似します。許容誤差を小さくすると曲線が滑らかになりますが、処理時間とメモリ使用量が増えます。",
|
||||
"file_load.built": "構築済み: 全{total}フィーチャー中{built}件。",
|
||||
"file_load.converting": "ソリッドを変換中: {done}/{total}",
|
||||
"file_load.inserting": "ジオメトリを挿入中",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "충돌 보고서가 없습니다.",
|
||||
"No matching appearance presets.": "일치하는 외관 프리셋이 없습니다.",
|
||||
"No matching appearances": "일치하는 외관 없음",
|
||||
"No visible bodies to export.": "표시된 바디가 없어 내보낼 수 없습니다.",
|
||||
"No visible bodies or sketches to export.": "표시된 바디나 스케치가 없어 내보낼 수 없습니다.",
|
||||
"None": "없음",
|
||||
"Not available yet": "아직 사용할 수 없음",
|
||||
"Notch": "노치",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "형상 투영 중 (3/5)",
|
||||
"dxf.progress.write": "DXF 쓰는 중 (5/5)",
|
||||
"dxf.tolerance": "곡선 허용 오차",
|
||||
"dxf.tolerance_help": "표시된 바디만 내보내며 곡선은 직선 구간으로 근사합니다. 허용 오차가 작을수록 곡선이 매끄러워지지만 처리 시간과 메모리 사용량이 늘어납니다.",
|
||||
"dxf.tolerance_help": "표시된 바디와 스케치만 내보내며 곡선은 직선 구간으로 근사합니다. 허용 오차가 작을수록 곡선이 매끄러워지지만 처리 시간과 메모리 사용량이 늘어납니다.",
|
||||
"file_load.built": "지금까지 빌드됨: 피처 {total}개 중 {built}개.",
|
||||
"file_load.converting": "솔리드 변환 중 {done}/{total}",
|
||||
"file_load.inserting": "기하 삽입 중",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Tiada laporan ranap.",
|
||||
"No matching appearance presets.": "Tiada pratetap penampilan yang sepadan.",
|
||||
"No matching appearances": "Tiada penampilan yang sepadan",
|
||||
"No visible bodies to export.": "Tiada jasad kelihatan untuk dieksport.",
|
||||
"No visible bodies or sketches to export.": "Tiada jasad atau lakaran kelihatan untuk dieksport.",
|
||||
"None": "Tiada",
|
||||
"Not available yet": "Belum tersedia",
|
||||
"Notch": "Takuk",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Mengunjurkan geometri (3/5)",
|
||||
"dxf.progress.write": "Menulis DXF (5/5)",
|
||||
"dxf.tolerance": "Toleransi lengkung",
|
||||
"dxf.tolerance_help": "Jasad kelihatan sahaja. Lengkung guna segmen lurus. Toleransi kecil lebih halus tetapi guna lebih masa dan memori.",
|
||||
"dxf.tolerance_help": "Jasad kelihatan dan lakaran yang ditunjukkan sahaja. Lengkung guna segmen lurus. Toleransi kecil lebih halus tetapi guna lebih masa dan memori.",
|
||||
"file_load.built": "Dibina setakat ini: {built} daripada {total} ciri.",
|
||||
"file_load.converting": "Menukar pepejal {done} daripada {total}",
|
||||
"file_load.inserting": "Menyisip geometri",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "Geen crashrapporten.",
|
||||
"No matching appearance presets.": "Geen overeenkomende uiterlijkvoorinstellingen.",
|
||||
"No matching appearances": "Geen overeenkomende uiterlijken",
|
||||
"No visible bodies to export.": "Geen zichtbare lichamen om te exporteren.",
|
||||
"None": "Geen",
|
||||
"Not available yet": "Nog niet beschikbaar",
|
||||
"Notch": "Inkeping",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Brak raportów o awariach.",
|
||||
"No matching appearance presets.": "Brak pasujących ustawień wyglądu.",
|
||||
"No matching appearances": "Brak pasujących wyglądów",
|
||||
"No visible bodies to export.": "Brak widocznych brył do wyeksportowania.",
|
||||
"No visible bodies or sketches to export.": "Brak widocznych brył lub szkiców do wyeksportowania.",
|
||||
"None": "Brak",
|
||||
"Not available yet": "Jeszcze niedostępne",
|
||||
"Notch": "Wycięcie",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Rzutowanie geometrii (3/5)",
|
||||
"dxf.progress.write": "Zapisywanie DXF (5/5)",
|
||||
"dxf.tolerance": "Tolerancja krzywych",
|
||||
"dxf.tolerance_help": "Tylko widoczne bryły. Krzywe są przybliżane odcinkami. Mniejsza tolerancja daje dokładniejsze krzywe, ale zajmuje więcej czasu i pamięci.",
|
||||
"dxf.tolerance_help": "Tylko widoczne bryły i pokazane szkice. Krzywe są przybliżane odcinkami. Mniejsza tolerancja daje dokładniejsze krzywe, ale zajmuje więcej czasu i pamięci.",
|
||||
"file_load.built": "Dotąd zbudowano: {built} z {total} elementów.",
|
||||
"file_load.converting": "Konwertowanie bryły {done} z {total}",
|
||||
"file_load.inserting": "Wstawianie geometrii",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Nenhum relatório de falha.",
|
||||
"No matching appearance presets.": "Nenhuma predefinição de aparência correspondente.",
|
||||
"No matching appearances": "Nenhuma aparência correspondente",
|
||||
"No visible bodies to export.": "Nenhum corpo visível para exportar.",
|
||||
"No visible bodies or sketches to export.": "Nenhum corpo ou esboço visível para exportar.",
|
||||
"None": "Nenhum",
|
||||
"Not available yet": "Ainda não disponível",
|
||||
"Notch": "Entalhe",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "Niciun raport de blocare.",
|
||||
"No matching appearance presets.": "Niciun preset de aspect corespunzător.",
|
||||
"No matching appearances": "Niciun aspect corespunzător",
|
||||
"No visible bodies to export.": "Niciun corp vizibil de exportat.",
|
||||
"None": "Niciunul",
|
||||
"Not available yet": "Indisponibil deocamdată",
|
||||
"Notch": "Crestătură",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "Нет отчётов о сбоях.",
|
||||
"No matching appearance presets.": "Нет подходящих наборов внешнего вида.",
|
||||
"No matching appearances": "Нет подходящих внешних видов",
|
||||
"No visible bodies to export.": "Нет видимых тел для экспорта.",
|
||||
"None": "Нет",
|
||||
"Not available yet": "Пока недоступно",
|
||||
"Notch": "Вырез",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "Inga kraschrapporter.",
|
||||
"No matching appearance presets.": "Inga matchande utseendeförinställningar.",
|
||||
"No matching appearances": "Inga matchande utseenden",
|
||||
"No visible bodies to export.": "Inga synliga kroppar att exportera.",
|
||||
"None": "Ingen",
|
||||
"Not available yet": "Inte tillgänglig ännu",
|
||||
"Notch": "Urtag",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "Çökme raporu yok.",
|
||||
"No matching appearance presets.": "Eşleşen görünüm ön ayarı yok.",
|
||||
"No matching appearances": "Eşleşen görünüm yok",
|
||||
"No visible bodies to export.": "Dışa aktarılacak görünür gövde yok.",
|
||||
"None": "Hiçbiri",
|
||||
"Not available yet": "Henüz kullanılamıyor",
|
||||
"Notch": "Çentik",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Немає звітів про збої.",
|
||||
"No matching appearance presets.": "Немає відповідних наборів вигляду.",
|
||||
"No matching appearances": "Немає відповідних виглядів",
|
||||
"No visible bodies to export.": "Немає видимих тіл для експорту.",
|
||||
"No visible bodies or sketches to export.": "Немає видимих тіл або ескізів для експорту.",
|
||||
"None": "Немає",
|
||||
"Not available yet": "Ще недоступно",
|
||||
"Notch": "Виріз",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Проєктування геометрії (3/5)",
|
||||
"dxf.progress.write": "Запис DXF (5/5)",
|
||||
"dxf.tolerance": "Допуск кривої",
|
||||
"dxf.tolerance_help": "Лише видимі тіла. Криві подаються відрізками. Менший допуск дає точніші криві, але потребує більше часу й пам'яті.",
|
||||
"dxf.tolerance_help": "Лише видимі тіла та показані ескізи. Криві подаються відрізками. Менший допуск дає точніші криві, але потребує більше часу й пам'яті.",
|
||||
"file_load.built": "Побудовано: {built} із {total} елементів.",
|
||||
"file_load.converting": "Перетворення тіла {done} із {total}",
|
||||
"file_load.inserting": "Вставлення геометрії",
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
"No crash reports.": "Không có báo cáo sự cố.",
|
||||
"No matching appearance presets.": "Không có cài đặt sẵn vật liệu bề mặt phù hợp.",
|
||||
"No matching appearances": "Không có màu sắc/vật liệu phù hợp",
|
||||
"No visible bodies to export.": "Không có thân khối hiển thị nào để xuất.",
|
||||
"No visible bodies or sketches to export.": "Không có thân khối hoặc phác thảo hiển thị nào để xuất.",
|
||||
"None": "Không có",
|
||||
"Not available yet": "Chưa khả dụng",
|
||||
"Notch": "Rãnh khía chữ V",
|
||||
@@ -832,7 +832,7 @@
|
||||
"dxf.progress.projection": "Đang chiếu hình học (3/5)",
|
||||
"dxf.progress.write": "Đang ghi tệp DXF (5/5)",
|
||||
"dxf.tolerance": "Dung sai đường cong",
|
||||
"dxf.tolerance_help": "Chỉ áp dụng cho các thân khối hiển thị. Đường cong sử dụng các đoạn thẳng. Dung sai nhỏ hơn cho đường cong mịn hơn nhưng tốn nhiều thời gian và bộ nhớ hơn.",
|
||||
"dxf.tolerance_help": "Chỉ áp dụng cho các thân khối và phác thảo hiển thị. Đường cong sử dụng các đoạn thẳng. Dung sai nhỏ hơn cho đường cong mịn hơn nhưng tốn nhiều thời gian và bộ nhớ hơn.",
|
||||
"file_load.built": "Đã dựng được: {built} trên {total} tính năng.",
|
||||
"file_load.converting": "Đang chuyển đổi khối đặc {done} trên {total}",
|
||||
"file_load.inserting": "Đang chèn hình học",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"No crash reports.": "沒有當機報告。",
|
||||
"No matching appearance presets.": "沒有符合的外觀預設。",
|
||||
"No matching appearances": "沒有符合的外觀",
|
||||
"No visible bodies to export.": "沒有可匯出的可見實體。",
|
||||
"None": "無",
|
||||
"Not available yet": "暫不可用",
|
||||
"Notch": "缺口",
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
"No crash reports.": "没有崩溃报告。",
|
||||
"No matching appearance presets.": "没有匹配的外观预设。",
|
||||
"No matching appearances": "没有匹配的外观",
|
||||
"No visible bodies to export.": "没有可导出的可见实体。",
|
||||
"No visible bodies or sketches to export.": "没有可导出的可见实体或草图。",
|
||||
"Nominal diameter": "公称直径",
|
||||
"None": "无",
|
||||
"Not available yet": "暂不可用",
|
||||
@@ -856,7 +856,7 @@
|
||||
"dxf.progress.projection": "正在投影几何体 (3/5)",
|
||||
"dxf.progress.write": "正在写入 DXF (5/5)",
|
||||
"dxf.tolerance": "曲线公差",
|
||||
"dxf.tolerance_help": "仅导出可见实体。曲线使用直线段近似。公差越小,曲线越精细,但需要更多时间和内存。",
|
||||
"dxf.tolerance_help": "仅导出可见实体和显示的草图。曲线使用直线段近似。公差越小,曲线越精细,但需要更多时间和内存。",
|
||||
"file_load.built": "已构建:{built}/{total} 个特征。",
|
||||
"file_load.converting": "正在转换实体 {done}/{total}",
|
||||
"file_load.inserting": "正在插入几何体",
|
||||
|
||||
@@ -40,6 +40,7 @@ pub(crate) use features::profiles as feature_profiles;
|
||||
pub(crate) use features::{EdgeRefForm, edge_ref_form, sketch_key};
|
||||
pub use features::{auto_operation, extrude_reach};
|
||||
pub use sketch_modify::trim_piece;
|
||||
pub use view_dxf::sketch::exportable as view_dxf_exportable;
|
||||
mod component_link;
|
||||
mod config;
|
||||
mod file;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! A drawing of the visible bodies from a supplied viewport camera. No screen pixels, grid,
|
||||
//! selection highlights or tessellation diagonals are exported.
|
||||
//! A drawing of the visible bodies and shown sketches from a supplied viewport camera. No
|
||||
//! screen pixels, grid, selection highlights or tessellation diagonals are exported.
|
||||
|
||||
#[path = "view_dxf_meshes.rs"]
|
||||
mod meshes;
|
||||
@@ -7,8 +7,11 @@ mod meshes;
|
||||
mod progress;
|
||||
#[path = "view_dxf_projection.rs"]
|
||||
mod projection;
|
||||
#[path = "view_dxf_sketch.rs"]
|
||||
pub(super) mod sketch;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use solidcraft_geom::Vec2;
|
||||
use solidcraft_io::{DxfEntity, DxfLayer, DxfLinetype, DxfShape};
|
||||
use solidcraft_render::Camera;
|
||||
|
||||
@@ -20,7 +23,7 @@ const CMD: &str = "file.export_view_dxf";
|
||||
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new(CMD, "Export Current View as DXF", export)
|
||||
.icon("export")
|
||||
.noundo()
|
||||
.params("camera: Camera (current view); hidden?: omit|dashed (default omit); tolerance?: 0.0001..1 mm (curve chord tolerance, default 0.01); path?: .dxf file (else returns dxf text). Visible placed bodies only; 2D LINE/LWPOLYLINE entities on VISIBLE/HIDDEN layers, mm; perspective projected onto the camera target plane; no viewport crop or overlays.")];
|
||||
.params("camera: Camera (current view); hidden?: omit|dashed (default omit); tolerance?: 0.0001..1 mm (curve chord tolerance, default 0.01); path?: .dxf file (else returns dxf text). Visible placed bodies and shown sketches' profile curves (no construction geometry, points, dimensions or constraints); 2D LINE/LWPOLYLINE entities on VISIBLE/HIDDEN layers (sketch curves on SKETCH), mm; finished sketches are hidden behind bodies, the active sketch is drawn on top; perspective projected onto the camera target plane; no viewport crop or overlays.")];
|
||||
|
||||
fn export(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cam: Camera =
|
||||
@@ -39,6 +42,9 @@ fn export(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Some(Value::String(v)) if v == "dashed" => true,
|
||||
_ => return Err(bad(CMD, "hidden must be omit or dashed")),
|
||||
};
|
||||
if !sketch::exportable(s) {
|
||||
return Err(bad(CMD, "no visible bodies or sketches to export"));
|
||||
}
|
||||
let tolerance = match p.get("tolerance") {
|
||||
None => 0.01,
|
||||
Some(v) => v.as_f64().filter(|t| (0.0001..=1.0).contains(t)).ok_or_else(|| bad(CMD, "tolerance must be 0.0001..1 mm"))?,
|
||||
@@ -54,7 +60,7 @@ fn export(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
progress::Stage::new("dxf_meshes", 1).check().map_err(|e| bad(CMD, e))?;
|
||||
let meshes = meshes::prepare(s, tolerance)?;
|
||||
let prepare_ms = started.elapsed().as_secs_f64() * 1000.;
|
||||
let drawing = projection::drawing(&meshes, &cam).map_err(|e| bad(CMD, e))?;
|
||||
let drawing = projection::drawing(&meshes, &sketch::parts(s, tolerance).map_err(|e| bad(CMD, e))?, &cam).map_err(|e| bad(CMD, e))?;
|
||||
let writing = progress::Stage::new("dxf_write", 1);
|
||||
writing.check().map_err(|e| bad(CMD, e))?;
|
||||
let mut visible = 0;
|
||||
@@ -73,14 +79,18 @@ fn export(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
};
|
||||
entities.push(DxfEntity { layer: layer.into(), shape: DxfShape::Line(line.a, line.b) });
|
||||
}
|
||||
let entities = projection::connect(entities);
|
||||
let mut entities = projection::connect(entities);
|
||||
let sketch = sketch_entities(drawing.sketch, dashed, &mut entities);
|
||||
let mut layers = vec![DxfLayer::new("VISIBLE", 7)];
|
||||
if dashed {
|
||||
layers.push(DxfLayer { linetype: DxfLinetype::Hidden, ..DxfLayer::new("HIDDEN", 8) });
|
||||
}
|
||||
if sketch > 0 {
|
||||
layers.push(DxfLayer::new("SKETCH", 5));
|
||||
}
|
||||
let text = solidcraft_io::write_dxf_drawing(&layers, &entities);
|
||||
writing.check().map_err(|e| bad(CMD, e))?;
|
||||
let mut result = json!({"visible":visible,"hidden":hidden,"units":"mm","tolerance":tolerance,"projection":if cam.fov > 0.0 {"perspective"} else {"orthographic"}});
|
||||
let mut result = json!({"visible":visible,"hidden":hidden,"sketch":sketch,"units":"mm","tolerance":tolerance,"projection":if cam.fov > 0.0 {"perspective"} else {"orthographic"}});
|
||||
result["stats"] = json!({"bodies":meshes.placements.len(),"shared_meshes":meshes.meshes.len(),"triangles":meshes.triangles,
|
||||
"mesh_bytes":meshes.bytes,"worker_limit":meshes::WORKERS,"segments":drawing.segments,"occlusion_work":drawing.work,
|
||||
"prepare_ms":prepare_ms,"projection_ms":drawing.projection_ms,"occlusion_ms":drawing.occlusion_ms});
|
||||
@@ -94,6 +104,22 @@ fn export(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Sketch runs as entities: visible ones on SKETCH, hidden ones dashed on HIDDEN or omitted.
|
||||
/// Returns the number of SKETCH entities.
|
||||
fn sketch_entities(paths: Vec<projection::Path>, dashed: bool, entities: &mut Vec<DxfEntity>) -> usize {
|
||||
let mut count = 0;
|
||||
for path in paths.into_iter().filter(|p| dashed || !p.hidden) {
|
||||
let layer = if path.hidden { "HIDDEN" } else { "SKETCH" };
|
||||
count += usize::from(!path.hidden);
|
||||
let shape = match <[Vec2; 2]>::try_from(path.points) {
|
||||
Ok([a, b]) => DxfShape::Line(a, b),
|
||||
Err(points) => DxfShape::Polyline { points },
|
||||
};
|
||||
entities.push(DxfEntity { layer: layer.into(), shape });
|
||||
}
|
||||
count
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "view_dxf_tests.rs"]
|
||||
mod tests;
|
||||
@@ -123,9 +123,6 @@ pub(super) fn prepare(s: &Session, tolerance: f64) -> Result<Scene> {
|
||||
let keep = groups.get(group).is_some_and(|g| g.first == index);
|
||||
items.push(Item { body, group, keep, transform });
|
||||
}
|
||||
if items.is_empty() {
|
||||
return Err(bad(CMD, "no visible bodies to export"));
|
||||
}
|
||||
let progress = Stage::new("dxf_meshes", items.len());
|
||||
let bytes = AtomicUsize::new(0);
|
||||
let results = map_with_local_pools(&items, WORKERS, |item| {
|
||||
|
||||
@@ -16,10 +16,19 @@ pub(super) struct Drawing {
|
||||
pub segments: usize,
|
||||
pub projection_ms: f64,
|
||||
pub occlusion_ms: f64,
|
||||
/// Shown sketch curves: one path per visible or hidden run of each curve.
|
||||
pub sketch: Vec<Path>,
|
||||
}
|
||||
|
||||
pub(super) fn drawing(meshes: &super::meshes::Scene, cam: &Camera) -> Result<Drawing, &'static str> {
|
||||
scene::drawing(meshes, cam)
|
||||
/// A connected run of a projected sketch curve.
|
||||
#[derive(Clone, Debug)]
|
||||
pub(super) struct Path {
|
||||
pub points: Vec<Vec2>,
|
||||
pub hidden: bool,
|
||||
}
|
||||
|
||||
pub(super) fn drawing(meshes: &super::meshes::Scene, sketch: &[super::sketch::Part], cam: &Camera) -> Result<Drawing, &'static str> {
|
||||
scene::drawing(meshes, sketch, cam)
|
||||
}
|
||||
|
||||
/// Keep the hidden curves connected: restarting a dash on every short chord would make a
|
||||
|
||||
@@ -12,7 +12,8 @@ use solidcraft_render::Camera;
|
||||
|
||||
use super::super::meshes::{Placement, Scene, WORKERS, claim, transformed_bounds};
|
||||
use super::super::progress::Stage;
|
||||
use super::{Drawing, Line, bounds, clip, key, merge_lines, occluded, overlap, xy};
|
||||
use super::super::sketch::Part;
|
||||
use super::{Drawing, Line, Path, bounds, clip, key, merge_lines, occluded, overlap, xy};
|
||||
|
||||
const TOO_COMPLEX: &str = "view exceeds export work budget; hide bodies or increase tolerance";
|
||||
const MAX_LINES: usize = 1_000_000;
|
||||
@@ -405,12 +406,13 @@ impl Query<'_, '_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn drawing(scene: &Scene, cam: &Camera) -> Result<Drawing, &'static str> {
|
||||
pub(super) fn drawing(scene: &Scene, sketch: &[Part], cam: &Camera) -> Result<Drawing, &'static str> {
|
||||
let start = Instant::now();
|
||||
let scale = scene
|
||||
.placements
|
||||
.iter()
|
||||
.filter_map(|p| scene.meshes.get(p.mesh).map(|m| transformed_bounds(m, &p.transform)))
|
||||
.chain(sketch.iter().map(|p| bounds(p.points.iter().copied())))
|
||||
.fold(Aabb3::EMPTY, |b, p| b.union(&p))
|
||||
.diagonal()
|
||||
.max(1.);
|
||||
@@ -510,7 +512,72 @@ pub(super) fn drawing(scene: &Scene, cam: &Camera) -> Result<Drawing, &'static s
|
||||
let work = results.iter().map(|(_, n)| *n).sum();
|
||||
let lines = merge_lines(results.into_iter().flat_map(|(lines, _)| lines).collect(), eps);
|
||||
progress.check()?;
|
||||
Ok(Drawing { lines, work, segments: segment_count, projection_ms, occlusion_ms: start.elapsed().as_secs_f64() * 1000. })
|
||||
// Shown sketch curves: finished sketches are split where bodies cover them, like body
|
||||
// edges; the active sketch is drawn on top, as in the viewport. Each curve run stays one
|
||||
// path per visible or hidden stretch, so a circle remains one polyline.
|
||||
let progress = Stage::new("dxf_occlusion", sketch.len());
|
||||
let results = parallel(sketch, |part| {
|
||||
progress.check()?;
|
||||
let mut budget = Budget::new(&global, &progress);
|
||||
let mut paths: Vec<Path> = Vec::new();
|
||||
let mut previous: Option<Vec3> = None;
|
||||
for p in &part.points {
|
||||
let b = view.project(*p)?;
|
||||
let Some(a) = previous.replace(b) else { continue };
|
||||
if xy(a).dist(xy(b)) <= eps {
|
||||
continue;
|
||||
}
|
||||
if !claim(&count, 1, MAX_SEGMENTS) {
|
||||
return Err(TOO_COMPLEX);
|
||||
}
|
||||
let mut covered = Coverage::default();
|
||||
if !part.on_top && !instances.nodes.is_empty() {
|
||||
let mut query = Query {
|
||||
shared: &shared,
|
||||
scene,
|
||||
projected: &projected,
|
||||
instances: &instances,
|
||||
view: &view,
|
||||
depth_eps,
|
||||
a,
|
||||
b,
|
||||
bounds: bounds([a, b]),
|
||||
covered,
|
||||
budget: &mut budget,
|
||||
};
|
||||
query.instance_node(0)?;
|
||||
covered = query.covered;
|
||||
}
|
||||
let mut cursor = 0.;
|
||||
let mut emit = |lo: f64, hi: f64, hidden: bool| -> Result<(), &'static str> {
|
||||
let (p, q) = (xy(a + (b - a) * lo), xy(a + (b - a) * hi));
|
||||
if p.dist(q) <= eps {
|
||||
return Ok(());
|
||||
}
|
||||
if let Some(path) = paths.last_mut().filter(|path| path.hidden == hidden && path.points.last().is_some_and(|e| e.dist(p) <= eps)) {
|
||||
path.points.push(q);
|
||||
} else {
|
||||
if !claim(&output, 1, MAX_LINES) {
|
||||
return Err(TOO_COMPLEX);
|
||||
}
|
||||
paths.push(Path { points: vec![p, q], hidden });
|
||||
}
|
||||
Ok(())
|
||||
};
|
||||
for (lo, hi) in covered.spans {
|
||||
emit(cursor, lo, false)?;
|
||||
emit(lo, hi, true)?;
|
||||
cursor = hi;
|
||||
}
|
||||
emit(cursor, 1., false)?;
|
||||
}
|
||||
progress.advance(1)?;
|
||||
Ok((paths, budget.spent))
|
||||
})?;
|
||||
let work = results.iter().fold(work, |n: usize, (_, spent)| n.saturating_add(*spent));
|
||||
let sketch = results.into_iter().flat_map(|(paths, _)| paths).collect();
|
||||
progress.check()?;
|
||||
Ok(Drawing { lines, work, segments: count.load(Ordering::Relaxed), projection_ms, occlusion_ms: start.elapsed().as_secs_f64() * 1000., sketch })
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -581,7 +648,7 @@ mod tests {
|
||||
for fov in [0., 0.6] {
|
||||
let cam = Camera { target: Vec3::new(4., 3., 1.), yaw, pitch, roll, fov, distance: 100., ..Default::default() };
|
||||
let expected = super::super::reference_drawing(&flat, &cam).unwrap();
|
||||
let actual = drawing(&scene, &cam).unwrap();
|
||||
let actual = drawing(&scene, &[], &cam).unwrap();
|
||||
assert_eq!(canonical(actual.lines), canonical(expected), "yaw={yaw}, pitch={pitch}, fov={fov}");
|
||||
}
|
||||
}
|
||||
@@ -619,7 +686,7 @@ mod tests {
|
||||
let scene = Scene { meshes: vec![Arc::new(mesh)], placements, triangles: 1_200_000, bytes: 0 };
|
||||
let mut cam = Camera { target: Vec3::new(95., 55., 0.), fov: 0., distance: 300., ..Default::default() };
|
||||
cam.set_view(StandardView::Top);
|
||||
let result = drawing(&scene, &cam).unwrap();
|
||||
let result = drawing(&scene, &[], &cam).unwrap();
|
||||
assert_eq!(scene.meshes.len(), 1);
|
||||
assert_eq!(result.lines.len(), 240);
|
||||
assert!(result.lines.iter().all(|l| !l.hidden));
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//! Shown sketches in the view drawing: the curves the viewport draws for each sketch it shows
|
||||
//! (`view::sketch_shown`), as world polylines. Only profile curves are exported: drawn 2D
|
||||
//! curves, text outlines and drawn 3D-sketch curves. Construction geometry, centerlines,
|
||||
//! projected references, points, dimensions and constraints are viewport overlays and are left
|
||||
//! out. The active sketch is drawn on top, as the viewport draws it.
|
||||
use solidcraft_geom::{Plane, Vec3};
|
||||
use solidcraft_sketch::Sketch;
|
||||
|
||||
use super::progress::Stage;
|
||||
use crate::Session;
|
||||
use crate::view::{sketch_curve_visible, sketch_shown};
|
||||
|
||||
/// Sampled sketch points kept for one export, at most.
|
||||
const MAX_POINTS: usize = 4_000_000;
|
||||
|
||||
/// One connected run of a sketch curve in world coordinates.
|
||||
pub(super) struct Part {
|
||||
pub points: Vec<Vec3>,
|
||||
/// Drawn over the bodies (the sketch being edited) rather than hidden behind them.
|
||||
pub on_top: bool,
|
||||
}
|
||||
|
||||
fn profile_curve(sk: &Sketch, i: usize) -> bool {
|
||||
sketch_curve_visible(sk, i) && sk.curves.get(i).is_some_and(|c| !c.construction && !c.centerline && (c.link.is_none() || sk.is_text_curve(i)))
|
||||
}
|
||||
|
||||
fn has_profile(sk: &Sketch) -> bool {
|
||||
(0..sk.curves.len()).any(|i| profile_curve(sk, i)) || sk.wires.iter().any(|w| w.fit.len() > 1 && w.pts.len() > 1)
|
||||
}
|
||||
|
||||
/// Does the current view have anything `file.export_view_dxf` draws: a visible body or a shown
|
||||
/// sketch with a profile curve? The export dialog asks this before choosing a file.
|
||||
pub fn exportable(s: &Session) -> bool {
|
||||
let world = s.world_state();
|
||||
world.bodies.iter().any(|b| s.body_visible(&b.name)) || world.sketches.iter().any(|ss| sketch_shown(s, ss.feature) && has_profile(&ss.sketch))
|
||||
}
|
||||
|
||||
/// A curve's boundary segments joined end to end, so a circle (two half arcs) is one run.
|
||||
fn curve_parts(sk: &Sketch, i: usize, plane: &Plane, tolerance: f64) -> Vec<Vec<Vec3>> {
|
||||
let mut parts: Vec<Vec<Vec3>> = Vec::new();
|
||||
for seg in sk.segs(i) {
|
||||
let points: Vec<Vec3> = seg.polyline(tolerance).iter().map(|p| plane.to_world(*p)).collect();
|
||||
let Some(first) = points.first().copied() else { continue };
|
||||
match parts.last_mut() {
|
||||
Some(run) if run.last().is_some_and(|end| end.dist(first) <= tolerance * 1e-3) => run.extend(points.into_iter().skip(1)),
|
||||
_ => parts.push(points),
|
||||
}
|
||||
}
|
||||
parts
|
||||
}
|
||||
|
||||
/// The shown sketches' profile curves, sampled at the export's chord `tolerance`.
|
||||
pub(super) fn parts(s: &Session, tolerance: f64) -> Result<Vec<Part>, &'static str> {
|
||||
let world = s.world_state();
|
||||
let shown: Vec<_> = world.sketches.iter().filter(|ss| sketch_shown(s, ss.feature)).collect();
|
||||
let progress = Stage::new("dxf_projection", shown.len());
|
||||
let mut result = Vec::new();
|
||||
let mut total = 0usize;
|
||||
let mut add = |points: Vec<Vec3>, on_top: bool, result: &mut Vec<Part>| -> Result<(), &'static str> {
|
||||
if points.len() < 2 {
|
||||
return Ok(());
|
||||
}
|
||||
if points.iter().any(|p| !p.is_finite()) {
|
||||
return Err("sketch contains invalid coordinates");
|
||||
}
|
||||
total = total.saturating_add(points.len());
|
||||
if total > MAX_POINTS {
|
||||
return Err("view exceeds export memory budget; hide sketches or increase tolerance");
|
||||
}
|
||||
result.push(Part { points, on_top });
|
||||
Ok(())
|
||||
};
|
||||
for ss in shown {
|
||||
progress.check()?;
|
||||
let on_top = s.active_sketch == Some(ss.feature);
|
||||
let sk = &ss.sketch;
|
||||
for i in (0..sk.curves.len()).filter(|i| profile_curve(sk, *i)) {
|
||||
for points in curve_parts(sk, i, &ss.plane, tolerance) {
|
||||
add(points, on_top, &mut result)?;
|
||||
}
|
||||
}
|
||||
// 3D-sketch curves are in world coordinates already; included references are not drawn.
|
||||
for w in sk.wires.iter().filter(|w| w.fit.len() > 1) {
|
||||
add(w.pts.clone(), on_top, &mut result)?;
|
||||
}
|
||||
progress.advance(1)?;
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
@@ -172,3 +172,64 @@ fn view_dxf_keeps_every_occurrence_while_sharing_geometry() {
|
||||
assert!(centers.len() >= 3, "{centers:?}");
|
||||
assert!(std::sync::Arc::ptr_eq(&doc, &s.doc));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn view_dxf_exports_a_sketch_only_design_on_the_sketch_layer() {
|
||||
let mut s = Session::default();
|
||||
assert!(s.execute(CMD, &json!({"camera":camera(StandardView::Top)})).is_err());
|
||||
run(&mut s, "sketch.create", json!({"plane":"XY"}));
|
||||
run(&mut s, "sketch.rectangle.two_point", json!({"p0":[0,0],"p1":[60,40]}));
|
||||
run(&mut s, "sketch.circle.center", json!({"center":[30,20],"radius":8}));
|
||||
for finish in [false, true] {
|
||||
if finish {
|
||||
run(&mut s, "sketch.finish", json!({}));
|
||||
}
|
||||
let v = export(&mut s, camera(StandardView::Top), "omit");
|
||||
// Four rectangle sides and one circle, each its own entity.
|
||||
assert_eq!(v["sketch"], 5, "{v}");
|
||||
let geometry = solidcraft_io::read_dxf(v["dxf"].as_str().unwrap()).unwrap();
|
||||
let (mut sides, mut circle) = (Vec::new(), 0);
|
||||
for g in geometry {
|
||||
let solidcraft_io::Geom2::Line(a, b) = g else { panic!("{g:?}") };
|
||||
// The drawing is centred on the camera target (20, 15).
|
||||
let on_circle = |p: Vec2| ((p - Vec2::new(10., 5.)).len() - 8.).abs() < 0.02;
|
||||
if on_circle(a) && on_circle(b) {
|
||||
circle += 1;
|
||||
} else {
|
||||
sides.push((a.dist(b) * 1000.).round() as i64);
|
||||
}
|
||||
}
|
||||
sides.sort_unstable();
|
||||
assert_eq!(sides, [40_000, 40_000, 60_000, 60_000], "finish={finish}");
|
||||
assert!(circle > 16, "{circle}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn view_dxf_hides_finished_sketches_behind_bodies_but_draws_the_active_sketch_on_top() {
|
||||
let mut s = Session::default();
|
||||
run(&mut s, "solid.box", json!({"length":40,"width":30,"height":10}));
|
||||
run(&mut s, "sketch.create", json!({"plane":{"origin":[0,0,-5],"x_dir":[1,0,0],"y_dir":[0,1,0]}}));
|
||||
run(&mut s, "sketch.line", json!({"points":[[-20,15],[60,15]]}));
|
||||
// The box's edges run along y = 0 and y = 30; only the sketch line lies on y = 15 (0 in the
|
||||
// drawing, which is centred on the camera target; the top view is tilted a hair).
|
||||
let length = |v: &Value| {
|
||||
let lines = solidcraft_io::read_dxf(v["dxf"].as_str().unwrap()).unwrap();
|
||||
lines
|
||||
.iter()
|
||||
.filter_map(|g| if let solidcraft_io::Geom2::Line(a, b) = g { Some((*a, *b)) } else { None })
|
||||
.filter(|(a, b)| a.y.abs() < 1e-3 && b.y.abs() < 1e-3)
|
||||
.map(|(a, b)| a.dist(b))
|
||||
.sum::<f64>()
|
||||
};
|
||||
let active = export(&mut s, camera(StandardView::Top), "omit");
|
||||
assert_eq!(active["sketch"], 1, "{active}");
|
||||
assert!((length(&active) - 80.).abs() < 1e-3 && active["dxf"].as_str().unwrap().contains("SKETCH"));
|
||||
run(&mut s, "sketch.finish", json!({}));
|
||||
let finished = export(&mut s, camera(StandardView::Top), "omit");
|
||||
assert_eq!(finished["sketch"], 2, "{finished}");
|
||||
assert!((length(&finished) - 40.).abs() < 1e-3, "{}", length(&finished));
|
||||
let dashed = export(&mut s, camera(StandardView::Top), "dashed");
|
||||
assert_eq!(dashed["sketch"], 2);
|
||||
assert!((length(&dashed) - 80.).abs() < 1e-3, "{}", length(&dashed));
|
||||
}
|
||||
@@ -36,8 +36,8 @@ pub fn run(app: &mut SolveApp, dashed: bool, tolerance: f64) -> Result<(), Strin
|
||||
if crate::viewport::section_plane(app).is_some() {
|
||||
return Err(app.tr_label("Turn off section analysis before exporting the view.").into());
|
||||
}
|
||||
if app.session.model.state().bodies.is_empty() {
|
||||
return Err(app.tr_label("No visible bodies to export.").into());
|
||||
if !solidcraft_engine::cmd::view_dxf_exportable(&app.session) {
|
||||
return Err(app.tr_label("No visible bodies or sketches to export.").into());
|
||||
}
|
||||
if !tolerance.is_finite() || !(0.0001..=1.0).contains(&tolerance) {
|
||||
return Err(app.tr_label("dxf.invalid_tolerance").into());
|
||||
|
||||
+13
-4
@@ -21,10 +21,19 @@ that atomic write starts, it finishes; a late Cancel reports the completed save.
|
||||
The drawing uses the camera when Export is pressed, including roll, the world's up axis
|
||||
and perspective. Only shown bodies are exported, at their current component/occurrence
|
||||
placements. Hidden bodies neither draw nor hide other bodies. The complete projected
|
||||
geometry is exported, including geometry beyond the viewport's edges. Grid, sketches,
|
||||
dimensions, selection highlights and other overlays are excluded. Turn off section analysis
|
||||
geometry is exported, including geometry beyond the viewport's edges. Grid, dimensions,
|
||||
constraints, selection highlights and other overlays are excluded. Turn off section analysis
|
||||
before exporting.
|
||||
|
||||
Sketches the viewport shows are exported too, so a design with only a sketch can be
|
||||
exported. Only profile curves are included: drawn curves, text outlines and drawn 3D-sketch
|
||||
curves; construction geometry, centerlines, projected references and points are not. Sketch
|
||||
curves go on their own `SKETCH` layer, each curve as one `LINE` or `LWPOLYLINE` (arcs,
|
||||
circles and splines as straight segments at the curve tolerance). Finished sketches are
|
||||
hidden behind bodies like body edges (dashed on `HIDDEN` when hidden edges are exported); the
|
||||
sketch being edited is drawn on top, as in the viewport. The export is refused only when
|
||||
there is neither a shown body nor a shown sketch curve.
|
||||
|
||||
Coordinates are 2D, Z=0, in millimetres. Orthographic views retain 1:1 dimensions in the
|
||||
view plane. Perspective views retain foreshortening, projected onto the plane through the
|
||||
camera target; they are intended for illustrations rather than dimensioned fabrication.
|
||||
@@ -33,8 +42,8 @@ model-space chord tolerance of 0.01 mm. The setting accepts 0.0001–1 mm; small
|
||||
produce finer curves and generally need more time and memory. This is not an exact analytic
|
||||
curve export or a tolerance guarantee for the original imported surfaces.
|
||||
|
||||
The AutoCAD 2000 ASCII DXF contains `VISIBLE` (continuous) and, when requested, `HIDDEN`
|
||||
(2 mm dashes / 1 mm gaps) layers. Hidden curves use connected `LWPOLYLINE` entities with
|
||||
The AutoCAD 2000 ASCII DXF contains `VISIBLE` (continuous), `SKETCH` (when a sketch is
|
||||
shown) and, when requested, `HIDDEN` (2 mm dashes / 1 mm gaps) layers. Hidden curves use connected `LWPOLYLINE` entities with
|
||||
continuous linetype generation so the pattern does not restart on each chord. The pattern
|
||||
is embedded in the file. The polyline flags follow the
|
||||
[Autodesk DXF reference](https://help.autodesk.com/cloudhelp/2017/ENU/AutoCAD-DXF/files/GUID-748FC305-F3F2-4F74-825A-61F04D757A50.htm).
|
||||
|
||||
Reference in new issue
Block a user