Merge [C2] DXF/DWG-Export fuer Fachplaner: echte DIMENSION mit DIMSTYLE, Tueren/Fenster/Symbole als BLOCK+INSERT mit ATTRIB, Textstile, LTYPE aus Linienstilen, Raumstempel, Papierbereich-Layout
Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
17 files changed
+2107
-60
No files matched your search
@@ -10,6 +10,7 @@ import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { Dropdown } from "./Dropdown";
|
||||
import type { CadExportFormat } from "../export/exportDxf";
|
||||
import { SCALE_PRESETS } from "./TopBar";
|
||||
|
||||
/** Entscheidung, die der Dialog beim Bestätigen liefert. */
|
||||
export interface ExportDxfDecision {
|
||||
@@ -18,6 +19,12 @@ export interface ExportDxfDecision {
|
||||
includeHatches: boolean;
|
||||
/** „nur Auswahl" statt des ganzen Plans (nur relevant, wenn `selectionCount > 0`). */
|
||||
selectionOnly: boolean;
|
||||
/** Massstabsnenner für Bemassungsstil, Strichmuster, Raumstempel und Ansichtsfenster. */
|
||||
scaleDenominator: number;
|
||||
/** Einheit der Masszahlen. */
|
||||
dimUnit: "m" | "cm";
|
||||
/** Zusätzlich ein Layout (Papierbereich) mit Ansichtsfenster anlegen. */
|
||||
paperLayout: boolean;
|
||||
}
|
||||
|
||||
export interface ExportDxfDialogProps {
|
||||
@@ -25,6 +32,8 @@ export interface ExportDxfDialogProps {
|
||||
planTitle: string;
|
||||
/** s. `ExportPdfDialogProps.selectionCount`. */
|
||||
selectionCount?: number;
|
||||
/** Massstab der aktiven Ansicht (Vorgabe, Default 1:100). */
|
||||
initialScale?: number;
|
||||
onExport: (decision: ExportDxfDecision) => void;
|
||||
onClose: () => void;
|
||||
}
|
||||
@@ -32,6 +41,7 @@ export interface ExportDxfDialogProps {
|
||||
export function ExportDxfDialog({
|
||||
planTitle,
|
||||
selectionCount = 0,
|
||||
initialScale = 100,
|
||||
onExport,
|
||||
onClose,
|
||||
}: ExportDxfDialogProps) {
|
||||
@@ -46,9 +56,24 @@ export function ExportDxfDialog({
|
||||
const [format, setFormat] = useState<CadExportFormat>("dxf");
|
||||
const [includeHatches, setIncludeHatches] = useState(true);
|
||||
const [selectionOnly, setSelectionOnly] = useState(false);
|
||||
const [scale, setScale] = useState<number>(initialScale);
|
||||
const [dimUnit, setDimUnit] = useState<"m" | "cm">("m");
|
||||
const [paperLayout, setPaperLayout] = useState(false);
|
||||
|
||||
const scaleOptions = [
|
||||
...(SCALE_PRESETS.includes(scale) ? [] : [{ value: String(scale), label: `1:${scale}` }]),
|
||||
...SCALE_PRESETS.filter((n) => n > 1).map((n) => ({ value: String(n), label: `1:${n}` })),
|
||||
];
|
||||
|
||||
const onConfirm = () =>
|
||||
onExport({ format, includeHatches, selectionOnly: selectionCount > 0 && selectionOnly });
|
||||
onExport({
|
||||
format,
|
||||
includeHatches,
|
||||
selectionOnly: selectionCount > 0 && selectionOnly,
|
||||
scaleDenominator: scale,
|
||||
dimUnit,
|
||||
paperLayout,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
@@ -101,7 +126,39 @@ export function ExportDxfDialog({
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title">{t("exportDxf.scale")}</div>
|
||||
<Dropdown value={String(scale)} onChange={(v) => setScale(Number(v))} title={t("exportDxf.scale")} options={scaleOptions} />
|
||||
</section>
|
||||
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title">{t("exportDxf.dimUnit")}</div>
|
||||
<Dropdown
|
||||
value={dimUnit}
|
||||
onChange={(v) => setDimUnit(v === "cm" ? "cm" : "m")}
|
||||
title={t("exportDxf.dimUnit")}
|
||||
options={[
|
||||
{ value: "m", label: t("exportDxf.dimUnit.m") },
|
||||
{ value: "cm", label: t("exportDxf.dimUnit.cm") },
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title">{t("exportDxf.layout")}</div>
|
||||
<Dropdown
|
||||
value={paperLayout ? "yes" : "no"}
|
||||
onChange={(v) => setPaperLayout(v === "yes")}
|
||||
title={t("exportDxf.layout")}
|
||||
options={[
|
||||
{ value: "no", label: t("exportDxf.layout.no") },
|
||||
{ value: "yes", label: t("exportDxf.layout.yes") },
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<div className="imp-note">{t("exportDxf.unitsNote")}</div>
|
||||
<div className="imp-note">{t("exportDxf.objectsNote")}</div>
|
||||
|
||||
{selectionCount > 0 && (
|
||||
<section className="imp-section">
|
||||
|
||||
Reference in new issue
Block a user