Der Aufruf-Befehl in Bricscad für Varioförderer.lsp wurde von FOERDERANLAGE auf VarioFoederer geändert. Die Block-Erstellung und die Attribut-Definition wurden integriet.
This commit is contained in:
+203
-18
@@ -1,7 +1,7 @@
|
||||
;; ============================================================
|
||||
;; FÖRDERANLAGE GENERATOR für BricsCAD Pro
|
||||
;; Version: 25.0 (Komplett bibliotheksbasiert, keine Fallbacks)
|
||||
;; Befehl: FOERDERANLAGE
|
||||
;; Befehl: VarioFoerderer
|
||||
;; ============================================================
|
||||
|
||||
(vl-load-com)
|
||||
@@ -41,9 +41,27 @@
|
||||
(setq aus-dx nil aus-dy nil aus-dz nil)
|
||||
(setq ein-dx nil ein-dy nil ein-dz nil)
|
||||
(setq separator-laenge nil umlenk-laenge nil motorstation-laenge nil)
|
||||
(setq staustrecke-basis 1000) ;; Standardwert; wird in c:FOERDERANLAGE via ssg-cfg-or ueberschrieben
|
||||
(setq staustrecke-basis 1000) ;; Standardwert; wird in c:VarioFoerderer via ssg-cfg-or ueberschrieben
|
||||
(setq FESTE_HORIZONTAL 1600)
|
||||
|
||||
;; Block-Zaehler (persistiert ueber mehrere Aufrufe)
|
||||
(if (null #VF_LetzteNr) (setq #VF_LetzteNr 0))
|
||||
|
||||
;; Attribut-Definitionen fuer VF-Block (TAG Standardwert)
|
||||
(setq *vf-attrib-defs*
|
||||
'(("NUMMER" "0")
|
||||
("MONTAGEHOEHE" "0.000")
|
||||
("HOEHE_VON" "0")
|
||||
("HOEHE_BIS" "0")
|
||||
("DELTA_H" "0")
|
||||
("DELTA_L" "0")
|
||||
("L_VF_M" "0.000")
|
||||
("L_GF_M" "0.000")
|
||||
("ANTRIEBFAHRTRICHTUNG" "Auf")
|
||||
("WINKEL" "0")
|
||||
("ANZAHL_SEPARATOR" "2")
|
||||
("ANZAHL_SCANNER" "0")))
|
||||
|
||||
;; Bogen-Tabellen (werden aus Bibliothek befüllt)
|
||||
(setq bogen-auf '()) ;; Format: ((winkel dx dy dz) ...)
|
||||
(setq bogen-ab '())
|
||||
@@ -351,7 +369,37 @@
|
||||
)
|
||||
)
|
||||
;; ============================================================
|
||||
;; TEIL 6: BIBLIOTHEK LADEN & MAßE EXTRAHIEREN
|
||||
;; TEIL 6: HILFSFUNKTIONEN BLOCK-VERWALTUNG
|
||||
;; ============================================================
|
||||
|
||||
;; Naechste freie VF-Nummer ermitteln (sucht in vorhandenen VF_*-Bloecken)
|
||||
(defun vf-next-number ( / ss i nr maxnr attribs)
|
||||
(setq maxnr 0)
|
||||
(setq ss (ssget "X" '((0 . "INSERT") (2 . "VF_*"))))
|
||||
(if ss
|
||||
(progn
|
||||
(setq i 0)
|
||||
(while (< i (sslength ss))
|
||||
(setq attribs (ssg-attrib-read (ssname ss i)))
|
||||
(foreach pair attribs
|
||||
(if (= (car pair) "NUMMER")
|
||||
(progn
|
||||
(setq nr (atoi (cdr pair)))
|
||||
(if (> nr maxnr) (setq maxnr nr))
|
||||
)
|
||||
)
|
||||
)
|
||||
(setq i (1+ i))
|
||||
)
|
||||
)
|
||||
)
|
||||
(setq #VF_LetzteNr (max #VF_LetzteNr maxnr))
|
||||
(setq #VF_LetzteNr (1+ #VF_LetzteNr))
|
||||
#VF_LetzteNr
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; TEIL 7: BIBLIOTHEK LADEN & MAßE EXTRAHIEREN
|
||||
;; ============================================================
|
||||
|
||||
;; Laedt alle benoetigten Bloecke aus Einzeldateien und extrahiert KS-Masse.
|
||||
@@ -813,17 +861,77 @@
|
||||
)
|
||||
|
||||
;; ============================================================
|
||||
;; TEIL 9: MODULE EINFÜGEN (GESAMTE ANLAGE)
|
||||
;; TEIL 9: BESCHRIFTUNG & MODULE EINFÜGEN
|
||||
;; ============================================================
|
||||
(defun foerderanlage-einfuegen (deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt seite
|
||||
|
||||
;; Erzeugt die sichtbare Beschriftungszeile oberhalb der Foerderanlage.
|
||||
;; Platzierung: horizontal zentriert ueber der Anlage, Y-Offset nach oben.
|
||||
(defun vf-make-label (vf-nummer hoehe-von hoehe-bis deltaH deltaL L_VF L_GF
|
||||
richtung best-winkel n-separator n-scanner startpunkt /
|
||||
label-txt label-pt L_VF_str L_GF_str delta-sym)
|
||||
(setq delta-sym (chr 916)) ;; Delta-Zeichen (Unicode)
|
||||
(setq L_VF_str (vl-string-subst "," "." (rtos (/ L_VF 1000.0) 2 3)))
|
||||
(setq L_GF_str (vl-string-subst "," "." (rtos (/ L_GF 1000.0) 2 3)))
|
||||
(setq label-txt
|
||||
(strcat "VF" (itoa vf-nummer)
|
||||
": von " (itoa (fix hoehe-von)) "mm bis " (itoa (fix hoehe-bis)) "mm, "
|
||||
delta-sym "H=" (itoa (fix deltaH)) "mm; "
|
||||
delta-sym "L=" (itoa (fix deltaL)) "mm; "
|
||||
"VF:" L_VF_str "m; "
|
||||
"GF:" L_GF_str "m; "
|
||||
richtung ": " (itoa best-winkel) grad-zeichen "; "
|
||||
"Sep: " (itoa n-separator) "; "
|
||||
"Scan: " (itoa n-scanner)))
|
||||
;; Position: Mitte entlang X, 1500mm ueber Startpunkt in Y
|
||||
(setq label-pt (list
|
||||
(+ (car startpunkt) (/ deltaL 2.0))
|
||||
(- (cadr startpunkt) 200.0)
|
||||
(caddr startpunkt)))
|
||||
(entmake (list
|
||||
'(0 . "TEXT")
|
||||
(cons 8 "VF_Beschriftung")
|
||||
'(67 . 0) ;; Modellbereich
|
||||
(cons 10 label-pt)
|
||||
(cons 40 100.0)
|
||||
(cons 1 label-txt)
|
||||
(cons 50 0.0)
|
||||
'(72 . 1) ;; horizontal zentriert
|
||||
'(73 . 2) ;; vertikal mittig
|
||||
(cons 11 label-pt)
|
||||
))
|
||||
)
|
||||
|
||||
(defun variofoerderer-einfuegen (deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt seite vf-nummer n-scanner
|
||||
/ aktueller-punkt bogen-name endpunkt bogen-mass bogen-dx bogen-dz
|
||||
as-block es-block)
|
||||
as-block es-block
|
||||
lastEnt vf-ss vf-e vf-bname vf-insert
|
||||
hoehe-von hoehe-bis montagehoehe-m L_GF attdef-ypos)
|
||||
(setq aktueller-punkt startpunkt)
|
||||
(setq as-block (strcat "_3D_AS_90_" seite))
|
||||
(setq es-block (strcat "_3D_ES_90_" seite))
|
||||
|
||||
(if (not *lib-initialized*) (init-bibliothek))
|
||||
|
||||
;; Letzte bestehende Entity merken (fuer spaetere Block-Erstellung)
|
||||
(setq lastEnt (entlast))
|
||||
(if (and lastEnt
|
||||
(= (cdr (assoc 0 (entget lastEnt))) "INSERT")
|
||||
(= (cdr (assoc 66 (entget lastEnt))) 1))
|
||||
(progn
|
||||
(setq lastEnt (entnext lastEnt))
|
||||
(while (and lastEnt (/= (cdr (assoc 0 (entget lastEnt))) "SEQEND"))
|
||||
(setq lastEnt (entnext lastEnt))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; Hoehenangaben fuer Attribute und Beschriftung
|
||||
(setq hoehe-von (caddr startpunkt))
|
||||
(setq hoehe-bis (cond
|
||||
((= richtung "Auf") (+ hoehe-von deltaH))
|
||||
((= richtung "Ab") (- hoehe-von deltaH))
|
||||
(t hoehe-von)))
|
||||
|
||||
;; 1. AUS_Element
|
||||
(princ (strcat "\n\n1/11: " as-block " (0°)"))
|
||||
(setq aktueller-punkt (insert-block-by-ks as-block aktueller-punkt))
|
||||
@@ -932,25 +1040,91 @@
|
||||
(setq endpunkt (insert-block-by-ks es-block aktueller-punkt))
|
||||
|
||||
(princ "\n\n=========================================")
|
||||
(princ "\n>>> Förderanlage erfolgreich eingefügt! <<<")
|
||||
(princ "\n>>> VarioFoerderer erfolgreich eingefuegt!")
|
||||
|
||||
;; ====== BLOCK ERSTELLEN ======
|
||||
(setq L_GF (+ L_GF1 L_GF2))
|
||||
|
||||
;; Beschriftungstext erzeugen (wird Teil des Blocks)
|
||||
(vf-make-label vf-nummer hoehe-von hoehe-bis deltaH deltaL L_VF L_GF
|
||||
richtung best-winkel 2 n-scanner startpunkt)
|
||||
|
||||
;; Unsichtbare ATTDEFs am Startpunkt erzeugen (werden Teil des Blocks)
|
||||
(setq attdef-ypos (cadr startpunkt))
|
||||
(foreach def *vf-attrib-defs*
|
||||
(entmake (list
|
||||
'(0 . "ATTDEF")
|
||||
'(8 . "0")
|
||||
'(67 . 0) ;; Modellbereich
|
||||
(cons 10 (list (car startpunkt) attdef-ypos (caddr startpunkt)))
|
||||
'(40 . 50.0)
|
||||
(cons 1 (cadr def))
|
||||
(cons 3 (car def))
|
||||
(cons 2 (car def))
|
||||
'(70 . 1) ;; unsichtbar
|
||||
))
|
||||
(setq attdef-ypos (- attdef-ypos 100.0))
|
||||
)
|
||||
|
||||
;; Alle neuen Entities (seit lastEnt) in Selektionssatz sammeln
|
||||
(setq vf-ss (ssadd))
|
||||
(if lastEnt
|
||||
(setq vf-e (entnext lastEnt))
|
||||
(setq vf-e (entnext))
|
||||
)
|
||||
(while vf-e
|
||||
(ssadd vf-e vf-ss)
|
||||
(setq vf-e (entnext vf-e))
|
||||
)
|
||||
|
||||
(setq vf-bname (strcat "VF_" (itoa vf-nummer)))
|
||||
(if (> (sslength vf-ss) 0)
|
||||
(progn
|
||||
(setvar "ATTREQ" 0)
|
||||
(setvar "ATTDIA" 0)
|
||||
(command "_.-BLOCK" vf-bname startpunkt vf-ss "")
|
||||
(command "_.INSERT" vf-bname startpunkt 1.0 1.0 0.0)
|
||||
(setvar "ATTREQ" 1)
|
||||
;; Attributwerte auf den eingefuegten Block setzen
|
||||
(setq vf-insert (entlast))
|
||||
(setq montagehoehe-m (/ (+ hoehe-von hoehe-bis) 2000.0))
|
||||
(ssg-attrib-set-on vf-insert
|
||||
(list
|
||||
(cons "NUMMER" (itoa vf-nummer))
|
||||
(cons "MONTAGEHOEHE" (rtos montagehoehe-m 2 3))
|
||||
(cons "HOEHE_VON" (itoa (fix hoehe-von)))
|
||||
(cons "HOEHE_BIS" (itoa (fix hoehe-bis)))
|
||||
(cons "DELTA_H" (itoa (fix deltaH)))
|
||||
(cons "DELTA_L" (itoa (fix deltaL)))
|
||||
(cons "L_VF_M" (rtos (/ L_VF 1000.0) 2 3))
|
||||
(cons "L_GF_M" (rtos (/ L_GF 1000.0) 2 3))
|
||||
(cons "ANTRIEBFAHRTRICHTUNG" richtung)
|
||||
(cons "WINKEL" (itoa best-winkel))
|
||||
(cons "ANZAHL_SEPARATOR" "2")
|
||||
(cons "ANZAHL_SCANNER" (itoa n-scanner))
|
||||
)
|
||||
)
|
||||
(princ (strcat "\n>>> Block '" vf-bname "' erstellt und eingefuegt."))
|
||||
)
|
||||
(princ "\n>>> FEHLER: Keine Entities fuer Block gefunden!")
|
||||
)
|
||||
(princ "\n=========================================")
|
||||
|
||||
endpunkt
|
||||
nil
|
||||
)
|
||||
;; ============================================================
|
||||
;; TEIL 10: HAUPTFUNKTION
|
||||
;; ============================================================
|
||||
(defun c:FOERDERANLAGE ( / eingabe-modus line-points startpunkt endpunkt differenz
|
||||
(defun c:VarioFoerderer ( / eingabe-modus line-points startpunkt endpunkt differenz
|
||||
deltaL deltaH deltaX deltaY richtung ergebnis
|
||||
best-winkel L_GF L_GF1 L_GF2 L_VF ergebnis-liste
|
||||
antwort verteilung-modus
|
||||
gueltige-winkel idx eintrag wahl
|
||||
seite)
|
||||
seite vf-nummer n-scanner)
|
||||
;; (dbgf "c:FOERDERANLAGE")
|
||||
|
||||
(princ "\n=========================================")
|
||||
(princ "\n FÖRDERANLAGE GENERATOR v25.0")
|
||||
(princ "\n (Komplett bibliotheksbasiert)")
|
||||
(princ "\n VARIOFOERDERER GENERATOR v25.0")
|
||||
(princ "\n (Komplett bibliotheksbasiert)")
|
||||
(princ "\n=========================================")
|
||||
|
||||
;; Bibliothek initialisieren
|
||||
@@ -965,6 +1139,10 @@
|
||||
(setq staustrecke-basis (ssg-cfg-or "vario" "staustrecke_basis" 1000))
|
||||
(setq FESTE_HORIZONTAL (ssg-cfg-or "vario" "feste_horizontal" 1600))
|
||||
|
||||
;; VF-Nummer automatisch ermitteln
|
||||
(setq vf-nummer (vf-next-number))
|
||||
(princ (strcat "\n>>> Naechste VF-Nummer: VF" (itoa vf-nummer)))
|
||||
|
||||
(princ "\n\nEingabemodus wählen:")
|
||||
(princ "\n 1 - 3D-Linie auswählen (Start- und Endpunkt mit Höhe)")
|
||||
(princ "\n 2 - Werte manuell eingeben")
|
||||
@@ -1138,11 +1316,15 @@
|
||||
(princ (strcat "\n\n>>> L_GF1 (vorne): " (rtos L_GF1 2 2) " mm"))
|
||||
(princ (strcat "\n>>> L_GF2 (hinten): " (rtos L_GF2 2 2) " mm"))
|
||||
|
||||
(princ "\n\nMöchten Sie die Förderanlage einfügen?\n 1 - Ja, Module einfügen\n 2 - Nein, abbrechen")
|
||||
;; Anzahl Scanner abfragen
|
||||
(setq n-scanner (getint "\nAnzahl Scanner [0]: "))
|
||||
(if (null n-scanner) (setq n-scanner 0))
|
||||
|
||||
(princ "\n\nMoechten Sie die Foerderanlage einfuegen?\n 1 - Ja, Module einfuegen\n 2 - Nein, abbrechen")
|
||||
(setq antwort (getstring "\nIhre Wahl (1/2): "))
|
||||
|
||||
|
||||
(if (= antwort "1")
|
||||
(foerderanlage-einfuegen deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt-fuer-einfuegen seite)
|
||||
(variofoerderer-einfuegen deltaL deltaH richtung best-winkel L_GF1 L_GF2 L_VF startpunkt-fuer-einfuegen seite vf-nummer n-scanner)
|
||||
(princ "\nVorgang abgebrochen.")
|
||||
)
|
||||
|
||||
@@ -1151,9 +1333,12 @@
|
||||
;; ============================================================
|
||||
;; START
|
||||
;; ============================================================
|
||||
;; Rueckwaertskompatibilitaet
|
||||
(defun c:FOERDERANLAGE () (c:VarioFoerderer))
|
||||
|
||||
(princ "\n=========================================")
|
||||
(princ "\n>>> FOERDERANLAGE GENERATOR v25.0 geladen <<<")
|
||||
(princ "\n>>> Befehle: FOERDERANLAGE <<<")
|
||||
(princ "\n>>> VarioFoerderer Generator v25.0 geladen <<<")
|
||||
(princ "\n>>> Befehle: VarioFoerderer (Alias: FOERDERANLAGE) <<<")
|
||||
(princ "\n>>> 100% bibliotheksbasiert - KEINE Fallbacks <<<")
|
||||
(princ "\n=========================================")
|
||||
(princ)
|
||||
Reference in New Issue
Block a user