(prompt "\nFunktionen DING laden .........")(DEFUN C:g_LA ( / p1 ss e1 e0 b2 p2 b b1 ag)(g_sv)
(setq P1 (g_in nil "\nLinie w„hlen:" '(0 0 0 512 "NAE")) )(if (= p1 nil)(progn (prompt "\nError: kein Objekt gefunden !")(quit)))
(setq ss (ssget p1) e1 (entget (ssname ss 0)) ss nil)(setq e0 (cdr (assoc 0 e1)))
(if (/= e0 "LINE")(progn (prompt "\nError: Objekt keine Linie !")(quit)))(g_se)(setq b1 (trans (cdr (assoc 10 e1)) 0 1)
 b2 (trans (cdr (assoc 11 e1)) 0 1))(if (< (distance b1 p1)(distance b2 p1))(setq b b1 b1 b2 b2 b))(setq b (osnap p1 "END")
 p2 (getpoint b "\nZielpunkt:") ag (- (angle b1 b2) (angle p2 b)))(if (< ag 0)(setq ag (+ ag pi pi)))(if (and (> ag (* 0.5 pi))(< ag (* 1.5 pi)))
 (setq b2 (polar b (angle b1 b2) (distance b p2))) (setq b2 (polar b (angle b2 b1) (distance b p2))))
(setq e1 (subst (cons 10 (trans b1 1 0))(assoc 10 e1) e1))(entmod (subst (cons 11 (trans b2 1 0))(assoc 11 e1) e1))(g_un)(princ))
(defun C:BRECH ( / le pp)(g_sv)(setq le (/ (* (getvar "aperture")(getvar "viewsize"))  (car (getvar "screensize")) ))(while (/= le 0)
(setq pp (g_in nil "\nSchnittpunkt/(return=Ende):<sch>" (list 0 0 0 32 "SCH")))(if (= pp nil)(quit))(g_se)(g-b2 pp T le nil))(g_un)(princ))
(defun C:g_qu ( / in q p1 q1 q2 h b p2)(g_sv)(setq in "B H Z")(initget 8 in)(setq q (g_in nil "\n<1.Ecke>/(B)reitenmitte/(H)”henmitte/(Z)entrum:" 
 (list 0 0 0)))(cond((= (type q) 'LIST)(setq p1 q))((= q "B")(setq p1 (g_in nil "\nMittelpunkt der Breitenseite:" (list 0 0 0))))
((= q "H")(setq p1 (g_in nil "\nMittelpunkt der H”he:" (list 0 0 0))))((= q "Z")(setq p1 (g_in nil "\nZentrum:" (list 0 0 0 32 "SCH")))))
(cond((= p1 nil)(quit)))(setvar "orthomode" 0)(setq in "G H")(initget 8 in)(setq q1 (getcorner p1 "\n<2.Ecke>/(G)anze breite/(H)albe breite:")
 h nil b nil)(cond((= (TYPE q1) 'LIST)(setq p2 q1  b (- (nth 0 p2)(nth 0 p1)) h (- (nth 1 p2)(nth 1 p1)) ))
((= q1 "G")(setq b (getdist p1 "\nGanze Breite:")))((= q1 "H")(setq b (* 2.0 (getdist p1 "\nHalbe Breite:"))))((= b nil)(quit)))
(if (and (= (type q1) 'LIST)(= q "B"))(setq b (* 2.0 b)))(if (= h nil)(progn(setq q2 (strcase
 (g_in q2 "\n(G)anze h”he/(H)albe h”he/(B)reite gleich h”he:" "G")))(cond ((= q2 "G")(setq h (getdist p1 "\nGanze H”he:")))
((= q2 "H")(setq h (* 2.0 (getdist p1 "\nHalbe H”he"))))((= q2 "B")(setq h (* b 1.0))))))(cond((= h nil)(quit)))(cond
((= q "B")(setq p1 (polar p1 pi (* b 0.5))))((= q "H")(setq p1 (polar p1 (* 1.5 pi) (* h 0.5))))
((= q "Z")(setq p1 (polar (polar p1 pi (* b 0.5)) (* 1.5 pi) (* h 0.5)))))(g_se)(command "PLINIE" p1 (polar p1 0 b)
 (polar (getvar "lastpoint") (* 0.5 pi) h) (polar (getvar "lastpoint") pi b) "S")(g_un)(princ))(DEFUN C:g_ly ( / q1 q2 q3 q4 q5 )(g_sv)
(SETQ q1 (ssget) q2 nil)(WHILE (= q2 nil) (PROMPT "\nNeuer Layer: Objekt antippen/Layerfelder antippen/Tastatureingabe: ")(SETQ q3 (GRREAD))
(if (= (CAR q3) 12)(SETQ q3 (GRREAD)))(cond((= (CAR q3) 3)(progn (SETQ q4 (ssget (nth 1 q3))) (if (/= q4 nil)(PROGN (SETQ q5 (ENTGET (SSNAME q4 0))
 q2 (CDR (ASSOC 8 q5)) ) ))))((= (CAR q3) 2)(progn (SETQ q4 (nth 1 q3) q5 (GETSTRING (CHR q4)) q2 (STRCAT (CHR q4) q5) )))((= (CAR q3) 8)(cond
 ((OR (= (NTH 1 q3) 180)(= (NTH 1 q3) 195))(SETQ q2 (nth 0 v-lay))) ((OR (= (NTH 1 q3) 181)(= (NTH 1 q3) 196))(SETQ q2 (nth 1 v-lay)))
 ((= (NTH 1 q3) 182)(SETQ q2 (nth 11 v-lay))) ((= (NTH 1 q3) 197)(SETQ q2 (nth 2 v-lay))) ((= (NTH 1 q3) 183)(SETQ q2 (nth 9 v-lay)))
 ((= (NTH 1 q3) 198)(SETQ q2 (nth 3 v-lay))) ((OR (= (NTH 1 q3) 184)(= (NTH 1 q3) 199))(SETQ q2 (nth 4 v-lay)))
 ((OR (= (NTH 1 q3) 185)(= (NTH 1 q3) 200))(SETQ q2 (nth 5 v-lay))) ((OR (= (NTH 1 q3) 186)(= (NTH 1 q3) 201))(SETQ q2 (nth 6 v-lay)))
 ((= (NTH 1 q3) 187)(SETQ q2 (nth 10 v-lay))) ((= (NTH 1 q3) 202)(SETQ q2 (nth 7 v-lay)))
 ((OR (= (NTH 1 q3) 188)(= (NTH 1 q3) 203))(SETQ q2 (nth 8 v-lay)))))(prompt "\nError falsche Eingabe !" ))(prompt (strcat "\nNeues Layer:" q2))
(COMMAND "ŽNDERN" q1 "" "LA" q2))(g_un)(princ))(defun c:g-zoo ( / p1 p2 p3 p4 px py pm m2 fk fs z1 zt ps es el e0 ss ct s0 la e5)(g_sv)
(command "LIMITEN" "AUS")(setq p1 (getpoint "\n1.Ecke:") p2 (getcorner p1 "\n2.Ecke:") p3 (list (car p1) (nth 1 p2)) p4 (list (car p2) (nth 1 p1))
 px (- (car p2)(car p1)) py (- (nth 1 p2)(nth 1 p1)) pm (list (+ (/ px 2.0) (car p1)) (+ (/ py 2.0) (nth 1 p1))) fs (g_in fs "\nVergr”sserung:" "2")
 fk (atof fs) m2 (getpoint "\nNeuer Mittelpunkt:"))(g_se)(command "ZURšCK" "G" "ZURšCK" "A" "AUS")(setq z1 T)(while (/= z1 nil)
(setq ss nil ss (ssget "K" p1 p2))(setq ct 0 z1 nil)(while (/= nil (ssname ss ct))
(if (= (cdr (assoc 0 (setq es (entget (ssname ss ct))))) "INSERT")(progn (setq e0 (entlast) la (cdr (assoc 8 es))) (setq e5 (entget (ssname ss ct)))
 (if (= T (equal (cdr (assoc 41 e5))(cdr (assoc 42 e5)) 0.00001) (equal (cdr (assoc 43 e5))(cdr (assoc 42 e5)) 0.00001)) (progn
 (command "URSPRUNG" (ssname ss ct)) (setq s0 (ssadd))  (while (setq e0 (entnext e0))  (if (= (cdr (assoc 8 (entget e0))) "0") (ssadd e0 s0)))
 (command "EIGŽNDR" s0 "" "LA" la "LT" "VONLAYER" "FA" "VONLAYER" "") (setq z1 T) ) (prompt "\nBlock brechbar (x,y,z ungleich)"))))(setq ct (+ ct 1))
))(if (/= (findfile "temp.dwg") nil) (command "WBLOCK" "temp" "J" "" pm ss "" ) (command "WBLOCK" "temp" "" pm ss "" ))
(command "ZURšCK" "E" "ZURšCK" "1" "ZURšCK" "A" "EIN" "KREIS" (polar p1 (angle p1 p2) (* (distance p1 p2) 0.5))  (* (distance p1 p2) 0.5)
 "EIGŽNDR" "L" "" "LA" (nth 4 v-lay) "" "EINFšGE" "*temp" m2 fk "0")(setq p1 (list (- (car m2) (* fk px 0.5)) (- (nth 1 m2) (* fk py 0.5)))
 p2 (list (+ (car m2) (* fk px 0.5)) (+ (nth 1 m2) (* fk py 0.5))) p3 (list (car p1) (nth 1 p2)) p4 (list (car p2) (nth 1 p1)))
(command "PLINIE" p1 p3 p2 p4 "S")(setq ps (entlast))(gc)(g-zo1 p1 p3 p4 ps m2)(gc)(g-zo1 p3 p2 p1 ps m2)(gc)(g-zo1 p2 p4 p3 ps m2)
(gc)(g-zo1 p4 p1 p2 ps m2)(command "L™SCHEN" ps "")(setq p (g_in nil "\nEinfgepunkt fr Text:" '(0 0)))
(setq zt (g_in zt "\nText:" (strcat "Einzelheit " fs ":1")))(command "TEXT" p (* g_f 5.0) 0 zt)(setq ss nil s0 nil )(g_un)(princ))
(defun g-zo1 (pu po pl ps m2 / du el b sx p1 ag di s1 s2 ct)(setq ag (angle pl pu) di (distance pu po)
 s1 (polar (polar pu (+ ag (* pi 0.5)) (* di 0.2)) ag 2) s2 (polar (polar po (+ ag (* pi 1.5)) (* di 0.2)) ag 0.1) sx (ssget "K" s1 s2)
 p1 (polar m2 (angle pl pu) (* 15.0 (distance pl pu))) ct 0) (if (/= nil sx)(progn(if (/= nil (setq du (ssdel ps sx)))(setq sx du))
(command "STUTZEN" ps "")(while (< ct (sslength sx))(setq el (ssname sx ct) b (list el p1) ct (+ 1 ct))(command b))(command "")))(princ))
(defun g-rund (com / r a pp le du s s1 s2 e1 e2 z1)(g_sv)(if (= com "ABRUNDEN")(progn(command "ABRUNDEN")(setvar "cmdecho" 1)(command "R")
(setvar "cmdecho" 0)(setq r (getdist))(if (= r nil)(setq r ""))(command r ))(progn(terpri)(command "ABRUNDEN")(setvar "cmdecho" 1)(command "A")
(setvar "cmdecho" 0)(terpri)(setq a (getdist))(if (= a nil)(setq a "")(setq a (rtos a 2 (+ (getvar "luprec") 2))))(setvar "cmdecho" 1)(command a )
(setvar "cmdecho" 0)(setq a (getdist))(if (= a nil)(setq a ""))(command a )))(setq pp (g_in nil "\nW„hle Schnittpunkt/Objekt:" '(0 0 0 32 "sch")))
(setq le (/ (* (getvar "aperture")(getvar "viewsize")) (car (getvar "screensize")) )
 du nil s (ssget "K" (polar pp (* pi 0.5) le)(polar pp (* pi 1.5) le)))(cond( (= s nil)(progn (prompt "\nError: kein Objekt gefunden")(quit)))
( (= (sslength s) 2) (setq s1 (list (ssname s 0) pp) s2 (list (ssname s 1) pp)))( (= (sslength s) 1) (setq s1 (list (ssname s 0) pp)
 s2 (entsel "\nW„hle zweites Objekt:")))( (> (sslength s) 2) (prompt "\nError: mehr als 2 Objekte gew„hlt" ) 
 (setq s1 (entsel "\nW„hle erstes Objekt:") s2 (entsel "\nW„hle zweites Objekt:"))))(setq e1 (entget (car s1)) e2 (entget (car s2)))
(command com s1 s2)(setq z1 (entsel "\nW„hle Objekt zurck zu„ndern (Return=Ende):"))(cond( (= z1 nil)(quit))( (equal (car z1)(car s1))(entmod e1))
( (equal (car z1)(car s2))(entmod e2)))(setq z1 (entsel "\nW„hle Objekt zurck zu„ndern (Return=Ende):"))(cond( (= z1 nil)(quit))
( (equal (car z1)(car s1))(entmod e1))( (equal (car z1)(car s2))(entmod e2)))(princ)) (princ)
