Attribut-Entities-Bug bei GF-Blockerstellung und VF-Blockerstellung in TEST-Funktionen beheben.

This commit is contained in:
2026-07-02 10:12:30 +02:00
parent b915980540
commit 11555ace8e
4 changed files with 160 additions and 97 deletions
+4 -1
View File
@@ -163,7 +163,10 @@
(setq vf-nummer idx)
(setq hoehe-von 0)
(setq hoehe-bis (if (= richtung "Auf") deltaH (- deltaH)))
(setq lastEnt (entlast))
;; Wie c:VarioFoerderer: Attribut-Entities/SEQEND des vorherigen
;; VF_N-Blocks ueberspringen, sonst rutschen sie in den naechsten
;; Block hinein (Blockerstellung faengt sonst am falschen Entity an).
(setq lastEnt (vf-lastent-ohne-attribute))
(variofoerderer-einfuegen deltaL deltaH richtung best-winkel
(/ L_GF 2.0) (/ L_GF 2.0) L_VF
startpunkt "links")
+55 -40
View File
@@ -187,7 +187,7 @@
;; 7. GF-Nummer und Entity-Grenze vor erster Einfuegung
(setq gf-nummer (gf-next-number))
(setq last-ent (entlast))
(setq last-ent (vf-lastent-ohne-attribute))
;; 8. AUS-Element einfuegen
;; KS_EIN-Richtung so, dass KS_AUS in entry-hz zeigt:
@@ -291,8 +291,8 @@
(defun c:TEST_GEFAELLESTRECKE ( /
results-list tests-out-dir
test-deltaL test-winkel test-z-start test-rad sep-x test-L_stau
gf-ins attribs h-von h-bis d-h w-str
m2-start m2-deltaH
gf-ins ergebnis attribs h-von h-bis d-h w-str
m2-start m2-deltaH m2-deltaL
m3-start m3-end m3-line-vla
lbl-layer lbl-h lbl-h2)
@@ -360,7 +360,7 @@
(cons 10 (list -2000 2500.0 test-z-start))
(cons 11 (list -2000 2500.0 test-z-start))
(cons 40 lbl-h2)
'(1 . "MODUS 1 - 4 Richtungen | dL=10000mm | W=3 Grad")
(cons 1 (strcat "MODUS 1 - 4 Richtungen | " delta-sym "L=10000mm | W=3" grad-zeichen))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 0) '(73 . 2)))
;; --- M1: hz=0 Grad (Ost), Start (0, 0, 5000) ---
@@ -369,12 +369,12 @@
(cons 10 (list 0 1200.0 test-z-start))
(cons 11 (list 0 1200.0 test-z-start))
(cons 40 lbl-h)
'(1 . "M1 | hz=0 Grad (Ost) | dL=10000 | W=3 Grad")
(cons 1 (strcat "M1 | hz=0" grad-zeichen " (Ost) | " delta-sym "L=10000 | W=3" grad-zeichen))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 1) '(73 . 2)))
(setq gf-ins
(gefaellestrecke-einfuegen
(car (gefaellestrecke-einfuegen
test-L_stau test-winkel (list 0 0 test-z-start)
"links" "links" 0.0 test-deltaL))
"links" "links" 0.0 test-deltaL)))
(if gf-ins
(progn
(setq attribs (ssg-attrib-read gf-ins))
@@ -401,12 +401,12 @@
(cons 10 (list 15000 1200.0 test-z-start))
(cons 11 (list 15000 1200.0 test-z-start))
(cons 40 lbl-h)
'(1 . "M1 | hz=90 Grad (Nord) | dL=10000 | W=3 Grad")
(cons 1 (strcat "M1 | hz=90" grad-zeichen " (Nord) | " delta-sym "L=10000 | W=3" grad-zeichen))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 1) '(73 . 2)))
(setq gf-ins
(gefaellestrecke-einfuegen
(car (gefaellestrecke-einfuegen
test-L_stau test-winkel (list 15000 0 test-z-start)
"links" "links" 90.0 test-deltaL))
"links" "links" 90.0 test-deltaL)))
(if gf-ins
(progn
(setq attribs (ssg-attrib-read gf-ins))
@@ -433,12 +433,12 @@
(cons 10 (list 0 -13800.0 test-z-start))
(cons 11 (list 0 -13800.0 test-z-start))
(cons 40 lbl-h)
'(1 . "M1 | hz=180 Grad (West) | dL=10000 | W=3 Grad")
(cons 1 (strcat "M1 | hz=180" grad-zeichen " (West) | " delta-sym "L=10000 | W=3" grad-zeichen))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 1) '(73 . 2)))
(setq gf-ins
(gefaellestrecke-einfuegen
(car (gefaellestrecke-einfuegen
test-L_stau test-winkel (list 0 -15000 test-z-start)
"links" "links" 180.0 test-deltaL))
"links" "links" 180.0 test-deltaL)))
(if gf-ins
(progn
(setq attribs (ssg-attrib-read gf-ins))
@@ -465,12 +465,12 @@
(cons 10 (list 15000 -13800.0 test-z-start))
(cons 11 (list 15000 -13800.0 test-z-start))
(cons 40 lbl-h)
'(1 . "M1 | hz=270 Grad (Sued) | dL=10000 | W=3 Grad")
(cons 1 (strcat "M1 | hz=270" grad-zeichen " (Sued) | " delta-sym "L=10000 | W=3" grad-zeichen))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 1) '(73 . 2)))
(setq gf-ins
(gefaellestrecke-einfuegen
(car (gefaellestrecke-einfuegen
test-L_stau test-winkel (list 15000 -15000 test-z-start)
"links" "links" 270.0 test-deltaL))
"links" "links" 270.0 test-deltaL)))
(if gf-ins
(progn
(setq attribs (ssg-attrib-read gf-ins))
@@ -505,7 +505,7 @@
(cons 10 (list -2000 -32500.0 test-z-start))
(cons 11 (list -2000 -32500.0 test-z-start))
(cons 40 lbl-h2)
'(1 . "MODUS 2 - Linie X-Achse | hz=0 | W=3 Grad")
(cons 1 (strcat "MODUS 2 - Linie X-Achse | hz=0 | W=3" grad-zeichen))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 0) '(73 . 2)))
(entmake (list '(0 . "LINE")
'(10 0 -35000 0) '(11 10000 -35000 0) (cons 8 lbl-layer)))
@@ -513,68 +513,83 @@
(cons 10 (list 5000 -33800.0 test-z-start))
(cons 11 (list 5000 -33800.0 test-z-start))
(cons 40 lbl-h)
'(1 . "M2 | hz=0 Grad | Linie X-Achse | W=3 Grad")
(cons 1 (strcat "M2 | hz=0" grad-zeichen " | Linie X-Achse | W=3" grad-zeichen))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 1) '(73 . 2)))
(setq m2-start (list 0 -35000 test-z-start))
(princ (strcat "\n\n M2_hz000: Start=(0,-35000," (rtos test-z-start 2 0) ") ..."))
(setq gf-ins
(setq ergebnis
(gefaellestrecke-einfuegen
test-L_stau test-winkel m2-start "links" "links" 0.0 test-deltaL))
(setq gf-ins (car ergebnis))
(if gf-ins
(progn
(setq attribs (ssg-attrib-read gf-ins))
(setq h-von (atoi (cdr (assoc "HOEHE_VON" attribs))))
(setq h-bis (atoi (cdr (assoc "HOEHE_BIS" attribs))))
(setq m2-deltaH (abs (- h-von h-bis)))
;; Volle Fliesskomma-Genauigkeit direkt aus der Rueckgabe verwenden
;; (nicht aus den auf ganze mm gerundeten HOEHE_VON/HOEHE_BIS-Attributen),
;; damit Modus 3 exakt mit diesen Werten weiterrechnen kann.
(setq m2-deltaH (cadr ergebnis))
(setq m2-deltaL (caddr ergebnis))
(setq w-str (cdr (assoc "WINKEL" attribs)))
(princ (strcat " von=" (itoa h-von) " bis=" (itoa h-bis)
" dH=" (itoa m2-deltaH) " mm W=" w-str " OK"))
" " delta-sym "H=" (rtos m2-deltaH 2 3)
" mm " delta-sym "L=" (rtos m2-deltaL 2 3)
" mm W=" w-str " OK"))
(setq results-list
(cons (gefaellestrecke:test-json "M2_hz000" 2 0.0 test-deltaL
(atof w-str) h-von h-bis m2-deltaH "GEBAUT")
results-list)))
(progn
;; Fallback: sin(3deg) * 10000 ≈ 523mm
(setq m2-deltaH 523)
(princ (strcat " FEHLER (Fallback dH=" (itoa m2-deltaH) ")"))
(setq m2-deltaH 523.0)
(setq m2-deltaL test-deltaL)
(princ (strcat " FEHLER (Fallback " delta-sym "H=" (rtos m2-deltaH 2 3) ")"))
(setq results-list
(cons (gefaellestrecke:test-json "M2_hz000" 2 0.0 test-deltaL
0.0 0 0 0 "FEHLER")
results-list))))
;; ============================================================
;; MODUS 3 - 3D-Linie entlang Y-Achse (Sued) mit DeltaH aus M2
;; 3D-Linie: (0,-50000,5000) -> (0,-60000, 5000-m2-deltaH)
;; Startpunkt: (0,-50000,5000) = hoehere Seite
;; MODUS 3 - 3D-Linie entlang Y-Achse (Sued) mit Delta aus M2
;; Z-Startpunkt, Z-Endpunkt und die horizontale Distanz werden 1:1 aus
;; dem M2-Ergebnis uebernommen (volle Fliesskomma-Genauigkeit, kein
;; Runden auf ganze mm) - nur die Fahrtrichtung ist bewusst anders
;; (Sued statt Ost), um die Richtungsunabhaengigkeit zu pruefen.
;; 3D-Linie: (0,-50000,Z_start) -> (0, -50000-m2-deltaL, Z_start-m2-deltaH)
;; Startpunkt: (0,-50000,Z_start) = hoehere Seite
;; ============================================================
(princ "\n\n================================================================")
(princ (strcat "\n MODUS 3 - 3D-Linie Y-Achse Sued, dH=" (itoa m2-deltaH) " mm (aus M2)"))
(princ (strcat "\n MODUS 3 - 3D-Linie Y-Achse Sued, " delta-sym "H="
(rtos m2-deltaH 2 3) " mm " delta-sym "L=" (rtos m2-deltaL 2 3)
" mm (aus M2)"))
(princ "\n================================================================")
(setq m3-start (list 0 -50000 test-z-start))
(setq m3-end (list 0 -60000 (- test-z-start (float m2-deltaH))))
(setq m3-start (list 0.0 -50000.0 test-z-start))
(setq m3-end (list 0.0 (- -50000.0 m2-deltaL) (- test-z-start m2-deltaH)))
;; Abschnitts-Ueberschrift und 3D-Linie in Zeichnung
(entmake (list '(0 . "TEXT")
(cons 10 (list -2000 -47500.0 test-z-start))
(cons 11 (list -2000 -47500.0 test-z-start))
(cons 40 lbl-h2)
(cons 1 (strcat "MODUS 3 - 3D-Linie Y-Achse Sued | dH=" (itoa m2-deltaH) "mm aus M2"))
(cons 1 (strcat "MODUS 3 - 3D-Linie Y-Achse Sued | " delta-sym "H="
(rtos m2-deltaH 2 3) "mm aus M2"))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 0) '(73 . 2)))
(entmake (list '(0 . "TEXT")
(cons 10 (list 0 -48800.0 test-z-start))
(cons 11 (list 0 -48800.0 test-z-start))
(cons 40 lbl-h)
(cons 1 (strcat "M3 | 3D-Linie Sued | dH=" (itoa m2-deltaH) "mm"))
(cons 1 (strcat "M3 | 3D-Linie Sued | " delta-sym "H=" (rtos m2-deltaH 2 3) "mm"))
'(7 . "Standard") (cons 8 lbl-layer) '(72 . 1) '(73 . 2)))
(princ (strcat "\n\n 3D-Linie: (" (rtos (car m3-start) 2 0) ","
(rtos (cadr m3-start) 2 0) ","
(rtos (caddr m3-start) 2 0) ")"
" -> (" (rtos (car m3-end) 2 0) ","
(rtos (cadr m3-end) 2 0) ","
(rtos (caddr m3-end) 2 0) ")"))
(princ (strcat "\n\n 3D-Linie: (" (rtos (car m3-start) 2 3) ","
(rtos (cadr m3-start) 2 3) ","
(rtos (caddr m3-start) 2 3) ")"
" -> (" (rtos (car m3-end) 2 3) ","
(rtos (cadr m3-end) 2 3) ","
(rtos (caddr m3-end) 2 3) ")"))
(if (entmake
(list '(0 . "LINE")
@@ -595,9 +610,9 @@
(setq d-h (abs (- h-von h-bis)))
(setq w-str (cdr (assoc "WINKEL" attribs)))
(princ (strcat "\n -> von=" (itoa h-von) " bis=" (itoa h-bis)
" dH=" (itoa d-h) " mm"
" dH-Soll=" (itoa m2-deltaH) " mm"
" Abw=" (itoa (abs (- d-h m2-deltaH))) " mm"
" " delta-sym "H=" (itoa d-h) " mm"
" " delta-sym "H-Soll=" (rtos m2-deltaH 2 3) " mm"
" Abw=" (rtos (abs (- d-h m2-deltaH)) 2 3) " mm"
" W=" w-str " OK"))
(setq results-list
(cons (gefaellestrecke:test-json "M3_hz270" 3 270.0 test-deltaL