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:
+143
-91
@@ -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
|
||||||
(setq p2 (getpoint pt (ssg-textf "kreisel-prompt-abstand"
|
;; Mindestabstand = Kreisel-Durchmesser (sonst beruehren/ueberschneiden
|
||||||
(list (rtos *kreisel-default-laenge* 2 0)))))
|
;; sich die Endkreise) - bei Unterschreitung erneut abfragen.
|
||||||
(setq erg (kreisel-insert-richtung pt p2 *kreisel-default-laenge*)
|
(setq abstand nil)
|
||||||
abstand (car erg)
|
(while (null abstand)
|
||||||
rotation (cadr erg))
|
(setq p2 (getpoint pt (ssg-textf "kreisel-prompt-abstand"
|
||||||
|
(list (rtos *kreisel-default-laenge* 2 0)))))
|
||||||
|
(setq erg (kreisel-insert-richtung pt p2 *kreisel-default-laenge*)
|
||||||
|
abstand (car 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,24 +771,29 @@
|
|||||||
(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
|
||||||
(setq ptEnd (getpoint ptStart (ssg-text "kreisel-prompt-endpunkt")))
|
;; (Kreismitten-Tangentenlaenge = dist - Durchmesser) muss mindestens dem
|
||||||
(if (null ptEnd)
|
;; Durchmesser entsprechen, sonst beruehren/ueberschneiden sich die
|
||||||
(progn (ssg-end) (princ (ssg-text "kreisel-abgebrochen")) (princ) (exit))
|
;; Endkreise; bei Unterschreitung erneut abfragen statt abzubrechen.
|
||||||
)
|
(setq abstand nil)
|
||||||
|
(while (null abstand)
|
||||||
|
(setq ptEnd (getpoint ptStart (ssg-text "kreisel-prompt-endpunkt")))
|
||||||
|
(if (null ptEnd)
|
||||||
|
(progn (ssg-end) (princ (ssg-text "kreisel-abgebrochen")) (princ) (exit))
|
||||||
|
)
|
||||||
|
|
||||||
;; 3. Geometrie berechnen
|
;; 3. Geometrie berechnen
|
||||||
(setq dx (- (car ptEnd) (car ptStart))
|
(setq dx (- (car ptEnd) (car ptStart))
|
||||||
dy (- (cadr ptEnd) (cadr ptStart)))
|
dy (- (cadr ptEnd) (cadr ptStart)))
|
||||||
(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,11 +939,20 @@
|
|||||||
(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 =
|
||||||
(initget 6)
|
;; Kreisel-Durchmesser, sonst beruehren/ueberschneiden sich die Endkreise.
|
||||||
(setq newAbstand (getdist (ssg-textf "kreisel-prompt-neuer-abstand" (list (cdr (assoc "ABSTAND" attribs))))))
|
(setq newAbstand nil gueltig nil)
|
||||||
(if (null newAbstand)
|
(while (not gueltig)
|
||||||
(setq newAbstand (atof (cdr (assoc "ABSTAND" attribs))))
|
(initget 6)
|
||||||
|
(setq newAbstand (getdist (ssg-textf "kreisel-prompt-neuer-abstand" (list (cdr (assoc "ABSTAND" attribs))))))
|
||||||
|
(if (null newAbstand)
|
||||||
|
(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))))))
|
||||||
@@ -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,73 +1087,87 @@
|
|||||||
(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,
|
||||||
(setq dcl-pfad (strcat (getenv "DXFM_DCL") "/kreisel_edit.dcl"))
|
;; sonst beruehren/ueberschneiden sich die Endkreise) erneut anzeigen,
|
||||||
(setq dat (load_dialog dcl-pfad))
|
;; statt den fehlerhaften Wert zu uebernehmen (Projektmuster wie GERUEST).
|
||||||
(if (not (new_dialog "kreisel_edit" dat))
|
(setq dlg-abstand (cdr (assoc "ABSTAND" attribs)))
|
||||||
(progn (alert (ssg-textf "kreisel-edit-dialog-fehlt" (list dcl-pfad))) (ssg-end) (exit))
|
(setq fertig nil)
|
||||||
)
|
(while (not fertig)
|
||||||
|
(setq dcl-pfad (strcat (getenv "DXFM_DCL") "/kreisel_edit.dcl"))
|
||||||
|
(setq dat (load_dialog dcl-pfad))
|
||||||
|
(if (not (new_dialog "kreisel_edit" dat))
|
||||||
|
(progn (alert (ssg-textf "kreisel-edit-dialog-fehlt" (list dcl-pfad))) (ssg-end) (exit))
|
||||||
|
)
|
||||||
|
|
||||||
;; Ausrichtungs-Labels fuer popup_list aufbauen
|
;; Ausrichtungs-Labels fuer popup_list aufbauen
|
||||||
(setq ausrichtLabels "")
|
(setq ausrichtLabels "")
|
||||||
(foreach entry *kreisel-ausrichtungen*
|
(foreach entry *kreisel-ausrichtungen*
|
||||||
(if (= ausrichtLabels "")
|
(if (= ausrichtLabels "")
|
||||||
(setq ausrichtLabels (car entry))
|
(setq ausrichtLabels (car entry))
|
||||||
(setq ausrichtLabels (strcat ausrichtLabels "\n" (car entry)))
|
(setq ausrichtLabels (strcat ausrichtLabels "\n" (car entry)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Tiles initialisieren (Abstand aus vorherigem Versuch uebernehmen)
|
||||||
|
(set_tile "name" (cdr (assoc "Bezeichnung" attribs)))
|
||||||
|
(set_tile "abstand" dlg-abstand)
|
||||||
|
(set_tile "hoehe" (cdr (assoc "HOEHE" attribs)))
|
||||||
|
|
||||||
|
(start_list "ausrichtung")
|
||||||
|
(foreach entry *kreisel-ausrichtungen*
|
||||||
|
(add_list (car entry))
|
||||||
|
)
|
||||||
|
(end_list)
|
||||||
|
(set_tile "ausrichtung" (itoa (kreisel-rotation-to-idx rotation)))
|
||||||
|
|
||||||
|
(start_list "drehrichtung")
|
||||||
|
(add_list "UZS")
|
||||||
|
(add_list "GUZ")
|
||||||
|
(end_list)
|
||||||
|
(set_tile "drehrichtung" (if (equal (cdr (assoc "DREHRICHTUNG" attribs)) "GUZ") "1" "0"))
|
||||||
|
|
||||||
|
(start_list "kreiselart")
|
||||||
|
(add_list "STANDARD")
|
||||||
|
(add_list "PIN")
|
||||||
|
(end_list)
|
||||||
|
(set_tile "kreiselart" (if (equal (cdr (assoc "KREISELART" attribs)) "PIN") "1" "0"))
|
||||||
|
|
||||||
|
(set_tile "geruest_einzelmodul"
|
||||||
|
(if (equal (cdr (assoc "GERUEST_EINZELMODUL" attribs)) "1") "1" "0"))
|
||||||
|
|
||||||
|
(start_list "geruest_typ")
|
||||||
|
(foreach opt *ssg-geruest-optionen* (add_list opt))
|
||||||
|
(end_list)
|
||||||
|
(set_tile "geruest_typ" (itoa (ssg-geruest-typ-to-idx (cdr (assoc "GERUEST_TYP" attribs)))))
|
||||||
|
|
||||||
|
;; Actions
|
||||||
|
(action_tile "accept"
|
||||||
|
(strcat
|
||||||
|
"(setq dlg-name (get_tile \"name\"))"
|
||||||
|
"(setq dlg-abstand (get_tile \"abstand\"))"
|
||||||
|
"(setq dlg-hoehe (get_tile \"hoehe\"))"
|
||||||
|
"(setq dlg-ausrichtung (get_tile \"ausrichtung\"))"
|
||||||
|
"(setq dlg-drehrichtung (get_tile \"drehrichtung\"))"
|
||||||
|
"(setq dlg-kreiselart (get_tile \"kreiselart\"))"
|
||||||
|
"(setq dlg-geruest-einzelmodul (get_tile \"geruest_einzelmodul\"))"
|
||||||
|
"(setq dlg-geruest-typ (get_tile \"geruest_typ\"))"
|
||||||
|
"(done_dialog 1)"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(action_tile "cancel" "(done_dialog 0)")
|
||||||
|
|
||||||
|
(setq ergebnis (start_dialog))
|
||||||
|
(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))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; Tiles initialisieren
|
|
||||||
(set_tile "name" (cdr (assoc "Bezeichnung" attribs)))
|
|
||||||
(set_tile "abstand" (cdr (assoc "ABSTAND" attribs)))
|
|
||||||
(set_tile "hoehe" (cdr (assoc "HOEHE" attribs)))
|
|
||||||
|
|
||||||
(start_list "ausrichtung")
|
|
||||||
(foreach entry *kreisel-ausrichtungen*
|
|
||||||
(add_list (car entry))
|
|
||||||
)
|
|
||||||
(end_list)
|
|
||||||
(set_tile "ausrichtung" (itoa (kreisel-rotation-to-idx rotation)))
|
|
||||||
|
|
||||||
(start_list "drehrichtung")
|
|
||||||
(add_list "UZS")
|
|
||||||
(add_list "GUZ")
|
|
||||||
(end_list)
|
|
||||||
(set_tile "drehrichtung" (if (equal (cdr (assoc "DREHRICHTUNG" attribs)) "GUZ") "1" "0"))
|
|
||||||
|
|
||||||
(start_list "kreiselart")
|
|
||||||
(add_list "STANDARD")
|
|
||||||
(add_list "PIN")
|
|
||||||
(end_list)
|
|
||||||
(set_tile "kreiselart" (if (equal (cdr (assoc "KREISELART" attribs)) "PIN") "1" "0"))
|
|
||||||
|
|
||||||
(set_tile "geruest_einzelmodul"
|
|
||||||
(if (equal (cdr (assoc "GERUEST_EINZELMODUL" attribs)) "1") "1" "0"))
|
|
||||||
|
|
||||||
(start_list "geruest_typ")
|
|
||||||
(foreach opt *ssg-geruest-optionen* (add_list opt))
|
|
||||||
(end_list)
|
|
||||||
(set_tile "geruest_typ" (itoa (ssg-geruest-typ-to-idx (cdr (assoc "GERUEST_TYP" attribs)))))
|
|
||||||
|
|
||||||
;; Actions
|
|
||||||
(action_tile "accept"
|
|
||||||
(strcat
|
|
||||||
"(setq dlg-name (get_tile \"name\"))"
|
|
||||||
"(setq dlg-abstand (get_tile \"abstand\"))"
|
|
||||||
"(setq dlg-hoehe (get_tile \"hoehe\"))"
|
|
||||||
"(setq dlg-ausrichtung (get_tile \"ausrichtung\"))"
|
|
||||||
"(setq dlg-drehrichtung (get_tile \"drehrichtung\"))"
|
|
||||||
"(setq dlg-kreiselart (get_tile \"kreiselart\"))"
|
|
||||||
"(setq dlg-geruest-einzelmodul (get_tile \"geruest_einzelmodul\"))"
|
|
||||||
"(setq dlg-geruest-typ (get_tile \"geruest_typ\"))"
|
|
||||||
"(done_dialog 1)"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(action_tile "cancel" "(done_dialog 0)")
|
|
||||||
|
|
||||||
(setq ergebnis (start_dialog))
|
|
||||||
(unload_dialog dat)
|
|
||||||
|
|
||||||
;; 4. Bei OK: Block loeschen und neu zeichnen
|
;; 4. Bei OK: Block loeschen und neu zeichnen
|
||||||
(if (= ergebnis 1)
|
(if (= ergebnis 1)
|
||||||
(progn
|
(progn
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user