fix(kreisel): Mindestabstand 800mm gegen beruehrende Endkreise

Unterhalb des Kreisel-Durchmessers (*kreisel-durchmesser*, Default 800mm)
wuerden sich AN8/SP8 beruehren bzw. ueberschneiden. draw-module prueft das
als harte Sperre fuer alle Aufrufer; KreiselInsert/-Connect/-Redraw fragen
bei Unterschreitung erneut ab statt abzubrechen, KreiselEdit zeigt den
Dialog erneut (Projektmuster wie GERUEST).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 11:02:44 +01:00
parent 9e3e8e16ae
commit c3b4bf9db3
3 changed files with 145 additions and 91 deletions
+63 -11
View File
@@ -420,6 +420,18 @@
att-entity att-data att-tag new-value att-entity att-data att-tag new-value
beforeAtt) beforeAtt)
;; Mindestabstand: unterhalb des Durchmessers wuerden sich die Endkreise
;; (AN8/SP8) beruehren bzw. ueberschneiden - harte Sperre fuer alle Aufrufer
;; (Insert/Connect/Redraw/Edit/Script), da draw-module der einzige
;; gemeinsame Zeichenpfad ist.
(if (< abstand *kreisel-durchmesser*)
(progn
(ssg-emsg (ssg-textf "kreisel-emsg-abstand-zu-klein"
(list (rtos abstand 2 0) (rtos *kreisel-durchmesser* 2 0))))
(exit)
)
)
;; Attribute vorbereiten ;; Attribute vorbereiten
(setq attribs (ssg-attrib-merge attribs *kreisel-attrib-defs*)) (setq attribs (ssg-attrib-merge attribs *kreisel-attrib-defs*))
(setq attribs (subst (cons "ABSTAND" (rtos abstand 2 0)) (setq attribs (subst (cons "ABSTAND" (rtos abstand 2 0))
@@ -695,11 +707,23 @@
) )
;; 2. Abstand (Tangentenlaenge) - Linie gibt auch den Winkel vor ;; 2. Abstand (Tangentenlaenge) - Linie gibt auch den Winkel vor
;; Mindestabstand = Kreisel-Durchmesser (sonst beruehren/ueberschneiden
;; sich die Endkreise) - bei Unterschreitung erneut abfragen.
(setq abstand nil)
(while (null abstand)
(setq p2 (getpoint pt (ssg-textf "kreisel-prompt-abstand" (setq p2 (getpoint pt (ssg-textf "kreisel-prompt-abstand"
(list (rtos *kreisel-default-laenge* 2 0))))) (list (rtos *kreisel-default-laenge* 2 0)))))
(setq erg (kreisel-insert-richtung pt p2 *kreisel-default-laenge*) (setq erg (kreisel-insert-richtung pt p2 *kreisel-default-laenge*)
abstand (car erg) abstand (car erg)
rotation (cadr erg)) rotation (cadr erg))
(if (< abstand *kreisel-durchmesser*)
(progn
(ssg-emsg (ssg-textf "kreisel-emsg-abstand-zu-klein"
(list (rtos abstand 2 0) (rtos *kreisel-durchmesser* 2 0))))
(setq abstand nil)
)
)
)
(princ (ssg-textf "kreisel-abstand-ausgabe" (list (rtos abstand 2 0)))) (princ (ssg-textf "kreisel-abstand-ausgabe" (list (rtos abstand 2 0))))
;; 3. Hoehe (Z-Koordinate) ;; 3. Hoehe (Z-Koordinate)
@@ -747,7 +771,12 @@
(progn (ssg-end) (princ (ssg-text "kreisel-abgebrochen")) (princ) (exit)) (progn (ssg-end) (princ (ssg-text "kreisel-abgebrochen")) (princ) (exit))
) )
;; 2. Endpunkt (aeusserster Punkt SP-Seite) mit Gummiband ;; 2. Endpunkt (aeusserster Punkt SP-Seite) mit Gummiband - der Abstand
;; (Kreismitten-Tangentenlaenge = dist - Durchmesser) muss mindestens dem
;; Durchmesser entsprechen, sonst beruehren/ueberschneiden sich die
;; Endkreise; bei Unterschreitung erneut abfragen statt abzubrechen.
(setq abstand nil)
(while (null abstand)
(setq ptEnd (getpoint ptStart (ssg-text "kreisel-prompt-endpunkt"))) (setq ptEnd (getpoint ptStart (ssg-text "kreisel-prompt-endpunkt")))
(if (null ptEnd) (if (null ptEnd)
(progn (ssg-end) (princ (ssg-text "kreisel-abgebrochen")) (princ) (exit)) (progn (ssg-end) (princ (ssg-text "kreisel-abgebrochen")) (princ) (exit))
@@ -759,12 +788,12 @@
(setq dist (sqrt (+ (* dx dx) (* dy dy)))) (setq dist (sqrt (+ (* dx dx) (* dy dy))))
(setq abstand (- dist *kreisel-durchmesser*)) (setq abstand (- dist *kreisel-durchmesser*))
(if (<= abstand 0.0) (if (< abstand *kreisel-durchmesser*)
(progn (progn
(ssg-emsg (ssg-textf "kreisel-emsg-distanz-klein" (ssg-emsg (ssg-textf "kreisel-emsg-distanz-klein"
(list (rtos dist 2 0) (rtos *kreisel-durchmesser* 2 0)))) (list (rtos dist 2 0) (rtos (* 2.0 *kreisel-durchmesser*) 2 0))))
(ssg-end) (setq abstand nil)
(exit) )
) )
) )
@@ -883,7 +912,7 @@
;; geaendertem) Abstand neu. Alle Attribute bleiben ;; geaendertem) Abstand neu. Alle Attribute bleiben
;; erhalten. ;; erhalten.
;; ----------------------------------------------- ;; -----------------------------------------------
(defun c:KreiselRedraw ( / sel ent ed attribs basePoint rotation newAbstand) (defun c:KreiselRedraw ( / sel ent ed attribs basePoint rotation newAbstand gueltig)
(ssg-start (ssg-text "kreisel-start-redraw") '(("CECOLOR"))) (ssg-start (ssg-text "kreisel-start-redraw") '(("CECOLOR")))
@@ -910,12 +939,21 @@
(cdr (assoc "HOEHE" attribs)) (cdr (assoc "HOEHE" attribs))
(cdr (assoc "KREISELART" attribs))))) (cdr (assoc "KREISELART" attribs)))))
;; 3. Neuen Abstand abfragen (Enter = beibehalten) ;; 3. Neuen Abstand abfragen (Enter = beibehalten); Mindestabstand =
;; Kreisel-Durchmesser, sonst beruehren/ueberschneiden sich die Endkreise.
(setq newAbstand nil gueltig nil)
(while (not gueltig)
(initget 6) (initget 6)
(setq newAbstand (getdist (ssg-textf "kreisel-prompt-neuer-abstand" (list (cdr (assoc "ABSTAND" attribs)))))) (setq newAbstand (getdist (ssg-textf "kreisel-prompt-neuer-abstand" (list (cdr (assoc "ABSTAND" attribs))))))
(if (null newAbstand) (if (null newAbstand)
(setq newAbstand (atof (cdr (assoc "ABSTAND" attribs)))) (setq newAbstand (atof (cdr (assoc "ABSTAND" attribs))))
) )
(if (< newAbstand *kreisel-durchmesser*)
(ssg-emsg (ssg-textf "kreisel-emsg-abstand-zu-klein"
(list (rtos newAbstand 2 0) (rtos *kreisel-durchmesser* 2 0))))
(setq gueltig T)
)
)
;; NEU - Neue Höhe abfragen: ;; NEU - Neue Höhe abfragen:
(setq newHoehe (getreal (ssg-textf "kreisel-prompt-neue-hoehe" (list (cdr (assoc "HOEHE" attribs)))))) (setq newHoehe (getreal (ssg-textf "kreisel-prompt-neue-hoehe" (list (cdr (assoc "HOEHE" attribs))))))
(if (null newHoehe) (if (null newHoehe)
@@ -991,7 +1029,7 @@
;; 3. Bei OK: Block loeschen und mit neuen Werten neu zeichnen ;; 3. Bei OK: Block loeschen und mit neuen Werten neu zeichnen
;; ----------------------------------------------- ;; -----------------------------------------------
(defun c:KreiselEdit ( / sel ss ent ed attribs basePoint rotation (defun c:KreiselEdit ( / sel ss ent ed attribs basePoint rotation
dcl-pfad dat ergebnis dcl-pfad dat ergebnis fertig
dlg-name dlg-abstand dlg-hoehe dlg-ausrichtung dlg-name dlg-abstand dlg-hoehe dlg-ausrichtung
dlg-drehrichtung dlg-kreiselart dlg-geruest-einzelmodul dlg-drehrichtung dlg-kreiselart dlg-geruest-einzelmodul
dlg-geruest-typ dlg-geruest-typ
@@ -1049,7 +1087,12 @@
(princ (ssg-textf "kreisel-edit-bestehend" (princ (ssg-textf "kreisel-edit-bestehend"
(list (cdr (assoc "ABSTAND" attribs)) (rtos rotation 2 1) (cdr (assoc "KREISELART" attribs))))) (list (cdr (assoc "ABSTAND" attribs)) (rtos rotation 2 1) (cdr (assoc "KREISELART" attribs)))))
;; 3. DCL-Dialog laden ;; 3. DCL-Dialog laden; bei zu kleinem Abstand (< Kreisel-Durchmesser,
;; sonst beruehren/ueberschneiden sich die Endkreise) erneut anzeigen,
;; statt den fehlerhaften Wert zu uebernehmen (Projektmuster wie GERUEST).
(setq dlg-abstand (cdr (assoc "ABSTAND" attribs)))
(setq fertig nil)
(while (not fertig)
(setq dcl-pfad (strcat (getenv "DXFM_DCL") "/kreisel_edit.dcl")) (setq dcl-pfad (strcat (getenv "DXFM_DCL") "/kreisel_edit.dcl"))
(setq dat (load_dialog dcl-pfad)) (setq dat (load_dialog dcl-pfad))
(if (not (new_dialog "kreisel_edit" dat)) (if (not (new_dialog "kreisel_edit" dat))
@@ -1065,9 +1108,9 @@
) )
) )
;; Tiles initialisieren ;; Tiles initialisieren (Abstand aus vorherigem Versuch uebernehmen)
(set_tile "name" (cdr (assoc "Bezeichnung" attribs))) (set_tile "name" (cdr (assoc "Bezeichnung" attribs)))
(set_tile "abstand" (cdr (assoc "ABSTAND" attribs))) (set_tile "abstand" dlg-abstand)
(set_tile "hoehe" (cdr (assoc "HOEHE" attribs))) (set_tile "hoehe" (cdr (assoc "HOEHE" attribs)))
(start_list "ausrichtung") (start_list "ausrichtung")
@@ -1116,6 +1159,15 @@
(setq ergebnis (start_dialog)) (setq ergebnis (start_dialog))
(unload_dialog dat) (unload_dialog dat)
(cond
((/= ergebnis 1) (setq fertig T))
((< (atof dlg-abstand) *kreisel-durchmesser*)
(ssg-emsg (ssg-textf "kreisel-emsg-abstand-zu-klein"
(list (rtos (atof dlg-abstand) 2 0) (rtos *kreisel-durchmesser* 2 0)))))
(t (setq fertig T))
)
)
;; 4. Bei OK: Block loeschen und neu zeichnen ;; 4. Bei OK: Block loeschen und neu zeichnen
(if (= ergebnis 1) (if (= ergebnis 1)
(progn (progn
+1
View File
@@ -320,6 +320,7 @@
"kreisel-edit-bestehend": "\n-> Bestehend: Abstand=%1 Drehung=%2 Art=%3", "kreisel-edit-bestehend": "\n-> Bestehend: Abstand=%1 Drehung=%2 Art=%3",
"kreisel-edit-dialog-fehlt": "Dialog nicht verfuegbar: %1", "kreisel-edit-dialog-fehlt": "Dialog nicht verfuegbar: %1",
"kreisel-eingefuegt": "\n-> Kreisel #%1 eingefügt: %2 (Höhe=%3)", "kreisel-eingefuegt": "\n-> Kreisel #%1 eingefügt: %2 (Höhe=%3)",
"kreisel-emsg-abstand-zu-klein": "Abstand zu klein! (%1 < %2) - die Endkreise wuerden sich beruehren/ueberschneiden.",
"kreisel-emsg-distanz-klein": "Distanz zu klein! (%1 < %2)", "kreisel-emsg-distanz-klein": "Distanz zu klein! (%1 < %2)",
"kreisel-hoehe-aus-3dpunkt": "\n-> Hoehe aus 3D-Punkt uebernommen: %1", "kreisel-hoehe-aus-3dpunkt": "\n-> Hoehe aus 3D-Punkt uebernommen: %1",
"kreisel-hoehe-aus-basispunkt": "\n-> Höhe aus Basispunkt übernommen: %1", "kreisel-hoehe-aus-basispunkt": "\n-> Höhe aus Basispunkt übernommen: %1",
+1
View File
@@ -320,6 +320,7 @@
"kreisel-edit-bestehend": "\n-> Existing: Distance=%1 Rotation=%2 Type=%3", "kreisel-edit-bestehend": "\n-> Existing: Distance=%1 Rotation=%2 Type=%3",
"kreisel-edit-dialog-fehlt": "Dialog not available: %1", "kreisel-edit-dialog-fehlt": "Dialog not available: %1",
"kreisel-eingefuegt": "\n-> Kreisel #%1 inserted: %2 (height=%3)", "kreisel-eingefuegt": "\n-> Kreisel #%1 inserted: %2 (height=%3)",
"kreisel-emsg-abstand-zu-klein": "Distance too small! (%1 < %2) - the end circles would touch/overlap.",
"kreisel-emsg-distanz-klein": "Distance too small! (%1 < %2)", "kreisel-emsg-distanz-klein": "Distance too small! (%1 < %2)",
"kreisel-hoehe-aus-3dpunkt": "\n-> Height taken from 3D point: %1", "kreisel-hoehe-aus-3dpunkt": "\n-> Height taken from 3D point: %1",
"kreisel-hoehe-aus-basispunkt": "\n-> Height taken from base point: %1", "kreisel-hoehe-aus-basispunkt": "\n-> Height taken from base point: %1",