eigenes Menü zum Einfügen eines neuen Kreisels und zum Verbinden

This commit is contained in:
2026-05-15 15:33:04 +02:00
parent 86291d5479
commit 92f20e7833
2 changed files with 31 additions and 7 deletions
+29 -6
View File
@@ -71,13 +71,12 @@
(+ (cadr lstart) (* tval dy)))
)
;; Linien-Endpunkte aus LINE-Entity lesen. Rueckgabe: ((sx sy) (ex ey))
;; Linien-Endpunkte aus LINE-Entity lesen. Rueckgabe: ((sx sy sz) (ex ey ez))
(defun kreisel-get-line-pts (ent / ed p10 p11)
(setq ed (entget ent))
(setq p10 (cdr (assoc 10 ed))
p11 (cdr (assoc 11 ed)))
(list (list (car p10) (cadr p10))
(list (car p11) (cadr p11)))
(list p10 p11)
)
;; Pruefen ob zwei Richtungsvektoren parallel sind
@@ -180,10 +179,12 @@
;; --- Block erzeugen (Entities werden aus Zeichnung entfernt) ---
(setq bname (strcat "KR_" (ssg-make-blockname
(list (car basePoint) (cadr basePoint) 0.0))))
(list (car basePoint) (cadr basePoint)
(if (caddr basePoint) (caddr basePoint) 0.0)))))
(command "_.-BLOCK" bname (list 0.0 0.0 0.0) ss "")
;; --- Block am Zielpunkt einfuegen (ohne Attribut-Dialog) ---
;; basePoint kann 2D oder 3D sein; INSERT uebernimmt die Z-Koordinate
(setq oldAttreq (getvar "ATTREQ"))
(setq oldAttdia (getvar "ATTDIA"))
(setvar "ATTREQ" 0)
@@ -260,6 +261,7 @@
lpts1 lpts2 s1 e1 s2 e2
dir1 dir2 snap1 foot
dx dy dist abstand rotation typ
z1s z1e z2s z2e zCoord zTol
ok msg)
(ssg-start "Kreisel Smart Connect" '(("OSMODE") ("CECOLOR")))
@@ -314,6 +316,26 @@
(if (not (kreisel-parallel-p dir1 dir2))
(setq ok nil msg "Linien sind nicht parallel!")
)
;; Z-Koordinaten pruefen (alle 4 Endpunkte muessen gleiche Hoehe haben)
(if ok
(progn
(setq z1s (caddr s1) z1e (caddr e1)
z2s (caddr s2) z2e (caddr e2))
;; Fehlende Z-Werte als 0 behandeln
(if (null z1s) (setq z1s 0.0))
(if (null z1e) (setq z1e 0.0))
(if (null z2s) (setq z2s 0.0))
(if (null z2e) (setq z2e 0.0))
(setq zTol 0.1)
(if (or (> (abs (- z1s z1e)) zTol)
(> (abs (- z2s z2e)) zTol)
(> (abs (- z1s z2s)) zTol))
(setq ok nil msg "Start und Ziel auf ungleicher Hoehe!")
(setq zCoord z1s)
)
)
)
)
)
@@ -353,8 +375,9 @@
" Rotation: " (rtos rotation 2 1) " Grad"
" Kreiselart: " typ))
;; Modul als Compound-Block einfuegen
(draw-module snap1 abstand rotation
;; Modul als Compound-Block einfuegen (mit Z-Koordinate)
(draw-module (list (car snap1) (cadr snap1) zCoord)
abstand rotation
(list (cons "KREISELART" typ)))
(princ "\nKreisel Connect erfolgreich!")
+2 -1
View File
@@ -4,7 +4,8 @@
[SSG_LIB]
[->ILS]
[->Kreisel-Module]
[Kreisel]^C^CKreiselInsert
[Einfuegen]^C^CKreiselInsert
[Verbinden]^C^CKreiselConnect
[<-Eckrad]^C^CILS_Eckrad
[->Zusatzmodul]
[BTMT-Beladung]^C^CILS_BTMT_Beladung