2D/3D-Umschaltung pro GF/VF-Block (Dialog-Auswahl + Auto-Erkennung via XDATA) und Batch Alle auf 2D/3D

This commit is contained in:
2026-07-23 14:01:52 +02:00
parent 6d81b30628
commit 39a4656f38
11 changed files with 370 additions and 79 deletions
+61 -20
View File
@@ -115,22 +115,12 @@
;; --- Block als einzelne DWG-Datei aus block-pfad laden ---
(if (null (car (atoms-family 1 '("ENSURE-BLOCK-LOADED"))))
(defun ensure-block-loaded (blockname / block-datei temp-obj)
(if (not (tblsearch "BLOCK" blockname))
(defun ensure-block-loaded (blockname / )
;; Zentraler Loader (aktuelle Dimension + 3D-Fallback, Neudefinition bei
;; Dimensionswechsel). Meldung nur bei Fehlschlag.
(if (not (ssg-ils-block-laden blockname))
(progn
(setq block-datei (strcat block-pfad blockname ".dwg"))
(if (findfile block-datei)
(progn
(princ (ssg-textf "gf-lade-block" (list blockname)))
(setq temp-obj
(vla-InsertBlock modelspace
(vlax-3D-point '(0 0 0))
block-datei 1.0 1.0 1.0 0))
(vla-Delete temp-obj)
(princ (ssg-text "gf-status-ok"))
)
(princ (ssg-textf "gf-fehler-blockdatei-fehlt" (list block-datei)))
)
(princ (ssg-textf "gf-fehler-blockdatei-fehlt" (list blockname)))
)
)
)
@@ -1644,6 +1634,8 @@
;; verlustfrei nachbauen kann. Nicht Teil des Sivas-Attributsatzes.
(gf-xdata-schreiben gf-insert hz winkel as-winkel es-winkel
ziel-hoehe deltaL-total)
;; Dimension (2D/3D) merken -> Doppelklick-Edit erkennt sie automatisch.
(ssg-dim-xdata-schreiben gf-insert (ssg-ils-dim-aktuell))
(princ "\n\n=========================================")
(princ (ssg-text "gf-status-erfolgreich-eingefuegt"))
@@ -1672,8 +1664,8 @@
(defun gf-dialog-eingabe ( prefill hoehe-vorbelegung / dcl-pfad dat ergebnis
dlg-deltal dlg-hoehe dlg-winkel
dlg-richtung dlg-aus dlg-ein
dlg-aus-winkel dlg-ein-winkel
hz-winkel as-seite es-seite as-winkel es-winkel)
dlg-aus-winkel dlg-ein-winkel dlg-dim
hz-winkel as-seite es-seite as-winkel es-winkel dim)
(setq dcl-pfad (strcat (getenv "DXFM_DCL") "/gefaellestrecke.dcl"))
(setq dat (load_dialog dcl-pfad))
(if (not (new_dialog "gefaellestrecke" dat))
@@ -1712,6 +1704,15 @@
(t "0"))
"0"))
;; Darstellung 2D/3D: Vorbelegung aus prefill "dim" (Edit: erkannte
;; Dimension des Blocks), sonst aktueller Modus (Neuanlage -> i.d.R. 3D).
(start_list "dimension")
(add_list "3D")
(add_list "2D")
(end_list)
(set_tile "dimension"
(if (equal (cond ((cdr (assoc "dim" prefill))) ((ssg-ils-dim-aktuell))) "2D") "1" "0"))
;; AUS-Element: Winkel (90/30) + Seite
(start_list "aus_winkel")
(add_list "90")
@@ -1751,6 +1752,7 @@
"(setq dlg-aus (get_tile \"aus_seite\"))"
"(setq dlg-ein-winkel (get_tile \"ein_winkel\"))"
"(setq dlg-ein (get_tile \"ein_seite\"))"
"(setq dlg-dim (get_tile \"dimension\"))"
"(done_dialog 1)"
)
)
@@ -1776,6 +1778,7 @@
(setq es-seite (if (= dlg-ein "1") "rechts" "links"))
(setq as-winkel (if (= dlg-aus-winkel "1") "30" "90"))
(setq es-winkel (if (= dlg-ein-winkel "1") "30" "90"))
(setq dim (if (= dlg-dim "1") "2D" "3D"))
(list
(atof dlg-deltal)
(atof dlg-winkel)
@@ -1784,7 +1787,8 @@
es-seite
(atof dlg-hoehe)
as-winkel
es-winkel)
es-winkel
dim)
)
(t nil)
)
@@ -2118,6 +2122,37 @@
)
)
;; Nicht-interaktive Umwandlung EINES bestehenden GF-Blocks in die Zieldimension
;; (fuer die Batch-Umschaltung "Alle auf 2D/3D"). Liest die Parameter aus
;; XDATA/Attributen, erzwingt die Zieldimension per Override und baut am selben
;; Startpunkt neu auf. Rueckgabe: T bei Erfolg, nil wenn nicht nachbaubar.
(defun gf-konvertiere-ent (ent ziel-dim / ed bname attribs xd hz winkel
as-winkel es-winkel z-start deltaL startpunkt
as-seite es-seite)
(setq ed (entget ent) bname (cdr (assoc 2 ed)))
(setq attribs (ssg-attrib-read ent))
(setq xd (gf-xdata-lesen ent))
(if (and (wcmatch bname "GF_*")
(= (cond ((cdr (assoc "TYP" attribs))) ("")) "Gefaellestrecke")
xd)
(progn
(setq startpunkt (cdr (assoc 10 ed)))
(setq hz (atof (nth 0 xd))
winkel (atof (nth 1 xd))
as-winkel (nth 2 xd)
es-winkel (nth 3 xd)
z-start (atof (nth 4 xd))
deltaL (atof (nth 5 xd)))
(setq as-seite (cond ((cdr (assoc "SEITE_AS" attribs))) ("links")))
(setq es-seite (cond ((cdr (assoc "SEITE_ES" attribs))) ("links")))
(setq *ssg-ils-dim* ziel-dim)
(entdel ent)
(gf-rebuild deltaL winkel hz as-seite es-seite
(list (car startpunkt) (cadr startpunkt) z-start) as-winkel es-winkel)
(setq *ssg-ils-dim* nil)
T)
nil))
(defun c:GEFAELLESTRECKE_EDIT ( / ss ent ed bname startpunkt attribs xd
hz winkel as-winkel es-winkel z-start deltaL
as-seite hoehe-bis prefill dlg-werte)
@@ -2187,7 +2222,9 @@
(cons "es-seite" (cond ((cdr (assoc "SEITE_ES" attribs))) ("links")))
(cons "einfuegehoehe" z-start)
(cons "as-winkel" as-winkel)
(cons "es-winkel" es-winkel)))
(cons "es-winkel" es-winkel)
;; Dimension aus XDATA erkennen (Default 3D, falls Alt-Block ohne Eintrag)
(cons "dim" (cond ((ssg-dim-xdata-lesen ent)) ("3D")))))
;; AS-Seite + untere Hoehe fuer den optionalen parallelen VF-Bau
(setq as-seite (cond ((cdr (assoc "SEITE_AS" attribs))) ("links")))
@@ -2207,13 +2244,17 @@
hz deltaL as-seite hoehe-bis))
(t
;; Alten GF-Verbund loeschen und am selben Startpunkt (X/Y) mit der
;; im Dialog gewaehlten Einfuegehoehe (Z) neu aufbauen.
;; im Dialog gewaehlten Einfuegehoehe (Z) neu aufbauen. Die im Dialog
;; gewaehlte Dimension (2D/3D) wird ueber den Override *ssg-ils-dim*
;; erzwungen; gf-block-erstellen schreibt sie zugleich neu ins XDATA.
(setq *ssg-ils-dim* (nth 8 dlg-werte))
(entdel ent)
(gf-rebuild
(nth 0 dlg-werte) (nth 1 dlg-werte) (nth 2 dlg-werte)
(nth 3 dlg-werte) (nth 4 dlg-werte)
(list (car startpunkt) (cadr startpunkt) (nth 5 dlg-werte))
(nth 6 dlg-werte) (nth 7 dlg-werte))
(setq *ssg-ils-dim* nil)
(princ (ssg-textf "gf-edit-neu-aufgebaut" (list bname)))
)
)