; -----------------------------------------------------
; Die Layergruppe R- muá vorhanden sein   14.6.92 AW
; W„nde zeichnen - LAYER R-6
; Tr   zeichnen - LAYER R-3
; -----------------------------------------------------
(Defun C:Wand ()
	(Setvar "Cmdecho" 0)
	(Initget "2 A M K")
	(Setq B (Getkword "\nWand ausrichten - 2 Abst„nde/Mittellinie/<Kante>: "))
	(If
		(= nil B)
		(Setq B "K")
	)
	(If
		(Or (= B "K") (= B "M"))
		(Progn
		(Prompt "\nSt„rke der Wand <")
		(Princ (Rtos (Getvar "Userr1") 2 3))
		(Initget 6)
		(Setq A (Getdist ">: "))
		(If
			(= nil A)
			(Setq A (Getvar "Userr1"))
		)
		(Setvar "Userr1" A)
		)
      (Progn
        (Initget 7)
        (Setq A1 (Getdist "\nErster Abstand: "))
        (Initget 7)
        (Setq A2 (Getdist "\nZweiter Abstand: "))
      )
	)
  (Initget 1)
  (Setq P1 (Getpoint "\nVon Punkt: "))
  (Initget 1)
  (Setq P2 (Getpoint P1 "\nNach Punkt: "))
  (Command "Plinie" P1 P2)
  (Setq P4 t)
  (While
    (Boundp 'P4)
      (Initget "Z S")
      (Setq P4 
        (Getpoint (Getvar "Lastpoint") "\nZurck/Schliessen/<Nach Punkt>: "))
      (Cond
        ((= nil P4)
          (Command "")
        )
        ((= "S" P4)
          (Command "Schliessen")
          (Setq P4 nil)
        )
        ((= "Z" P4)
          (Command "Zurck")
        )
        ((= 'LIST (Type P4))
          (Command P4)
        )
      )
  )
  (Cond
    ((= B "K")
      (Setq E2 (Entlast))
      (Setq P2 (Getpoint "\nAuf welcher Seite liegt die Wand?"))
      (Command "VERSETZ" A P1 P2 "")
      (Setq E3 (Entlast))
    )
    ((= B "M")
      (Setq E1 (Entlast))
      (Command "W hl" "L" "")
      (Command "Versetz" (/ A 2)
        (Polar P1 (Angle P1 P2) (/ (Distance P1 P2) 2))
        (Polar (Getvar "Lastpoint") (+ (/ Pi 2) (Angle P1 P2)) (/ A 2)) "")
      (Setq E2 (Entlast))
      (Command "Versetz" A (Getvar "Lastpoint")
        (Polar (Getvar "Lastpoint") (+ (/ Pi 2) (Angle P2 P1)) A) "")
      (Setq E3 (Entlast))
    )
    ((or (= B "A") (= B "2"))
      (Setq E1 (Entlast))
      (Command "Wahl" "L" "")
      (Prompt "\nAuf welcher Seite soll ")
      (Princ (Rtos A1 2 4))
      (Setq P2 (Getpoint " abgetragen werden: "))
      (Command "Versetz" A1 P1 P2 "")
      (Setq E2 (Entlast))
      (Prompt "\nAuf welcher Seite soll ")
      (Princ (Rtos A2 2 4))
      (Setq P2 (Getpoint " abgetragen werden: "))
      (Command "Versetz" A2 P1 P2 "")
      (Setq E3 (Entlast))
    )
  )
  (If
    (Or (= B "2") (= B "A") (= B "M"))
      (Progn
        (Prompt "\nWas soll mit der Mittellinie geschehen?")
        (Initget "E L A M")
        (Setq A (Getkword "\nL”schen/Erhalten/<Auf R-6>: "))
        (Cond
          ((= A "L")
            (Command "L”schen" "V" "")
          )
          ((Or (= A "A") (= A "M") (= A nil))
            (Command "ŽNDERN" "V" "" "EI" "LA" "R-6" "")
          )
        )
      )
  )
  (Initget "J N")
  (Setq A (Getkword
    "\nW„nde sind Polylinien, in Linien aufbrechen? <J>: "))
  (If
    (Or (= A "J") (= A nil))
      (Command "Ursprung" E2 "Ursprung" E3 "Ursprung" E1 ^C)
  )
  (Princ)
)
; ----------------ENDE WAND --------------------------

; ---------------------------------
; Durchbrche zeichnen - LAYER R-6
; ---------------------------------
(Defun C:DURCHBRUCH ()
	(Setvar "Cmdecho" 0)
	(Initget 7)
	(Setq A (Getdist "\nBreite des Durchbruchs: "))
	(Initget 1)
	(setvar "osmode" 512)
	(Setq P1 (Getpoint "\nAnfangspunkt: "))
	(Setvar "Lastpoint" P1)
	(Initget 1)
	(setvar "osmode" 128)
	(Setq P2 (Getpoint "\nGegenberliegende Seite der Wand: "))
	(Initget 1)
	(setvar "osmode" 512)
	(Setq P3 (Getpoint "\nAuf welcher Seite ist der Durchbruch:"))
	(setvar "osmode" 0)
	(Setq A1 (Angle P1 P3))
	(Setq P3 (Polar P1 A1 A))
	(Setq A2 (Angle P1 P2))
	(Setq P4 (Polar P3 A2 (Distance P1 P2)))
	(Command "Bruch" P1 "E" P1 P3 "Bruch" P2 "E" P2 P4)
	(Command "Linie" P1 P2 "" "Linie" P3 P4 "")
	(Princ)
)
; ------------------- ENDE Durchbruch ---------------------------

; --------------------------
; Tr zeichnen - LAYER R-3
; --------------------------
(Defun C:TUER ()
	(Setvar "Cmdecho" 0)
	(Initget 7)
	(Setq A (Getdist "\nTrbreite: "))
	(Initget 1)
	(Setq P1 (Osnap (getpoint "\Angelpunkt: ") "N„c"))
	(Setvar "Lastpoint" P1)
	(Initget 1)
	(Setq P2 (Osnap (Getpoint "\nGegenberliegende Seite der Wand: ") "Lot"))
	(Initget 1)
	(setvar "osmode" 512)
	(Setq P3 (Getpoint "\nAuf welcher Seite ist die Tr: "))
	(setvar "osmode" 0)
	(Setq A1 (Angle P1 P3))
	(Setq P3 (Polar P1 A1 A))
	(Setq A2 (Angle P1 P2))
	(Setq P4 (Polar P3 A2 (Distance P1 P2)))
	(Setq P5 (Polar P1 (+ Pi A2) A))
	(Command "Bruch" P1 "E" P1 P3 "Bruch" P2 "E" P2 P4)
	(Command "Linie" P1 P2 "" "Linie" P3 P4 "" "Linie" P1 P5 "")
	(Command "Bogen" P3 "E" P5 "W" 90)
	(Princ)
)

; ---------------------------------
; Doppel-Tr zeichnen - LAYER R-3
; ---------------------------------
(Defun C:DTUER ()
	(Setvar "Cmdecho" 0)
	(Initget 7)
	(Setq A (/ (Getdist "\nDoppeltrbreite: ") 2)) ; eingegeb. Abstand
                                             ; halbieren
	(Initget 1)
	(setvar "osmode" 512)
	(Setq P1 (getpoint "\nAngelpunkt: "))
	(Setvar "Lastpoint" P1)
	(Initget 1)
	(setvar "osmode" 128)
	(Setq P2 (Getpoint "\nGegenberliegende Seite der Wand: "))
	(Initget 1)
	(setvar "osmode" 512)
	(Setq P3 (Getpoint "\nAuf welcher Seite ist die Doppeltr: "))
	(setvar "osmode" 0)
	(Setq A1 (Angle P1 P3))
	(Setq P3 (Polar P1 A1 A))
	(Setq A2 (Angle P1 P2))
	(Setq P4 (Polar P3 A2 (Distance P1 P2)))
	(Setq P5 (Polar P1 (+ Pi A2) A))
	(Setq P6 (Polar P3 A1 A))
	(Setq P7 (Polar P4 A1 A))
	(Setq P8 (Polar P6 (+ Pi A2) A))
	(Command "Bruch" P1 "E" P1 P6 "Bruch" P2 "E" P2 P7)
	(Command "Linie" P1 P2 "" "Linie" P6 P7 "" "Linie" P1 P5 "" "Linie" P6 P8 "")
	(Command "Bogen" P3 "E" P5 "W" 90)
	(Command "Bogen" P8 "E" P3 "W" 90)
	(Princ)
)

; ---------------------------------------------------
; Fenster - LAYER R-3
; Tor     - LAYER R-7
; die Layer werden ausserhalb des Makros eingestellt
; ----------------------------------------------------
(Defun C:fenstor ()
	(Setvar "Cmdecho" 0)
	(Initget 7)
	(Setq A (Getdist "\nBreite des Fensters/Tors: "))
	(Initget 1)
	(setvar "osmode" 512)
	(Setq P1 (getpoint "\nAnfangspunkt: "))
	(Setvar "Lastpoint" P1)
	(Initget 1)
	(setvar "osmode" 128)
	(Setq P2 (Getpoint "\nGegenberliegende Seite der Wand: "))
	(Initget 1)
	(setvar "osmode" 512)
	(Setq P3 (Getpoint "\nAuf welcher Seite ist das Fenster/Tor:"))
	(setvar "osmode" 0)
	(Setq A1 (Angle P1 P3))
	(Setq P3 (Polar P1 A1 A))
	(Setq A2 (Angle P1 P2))
	(Setq P4 (Polar P3 A2 (Distance P1 P2)))
	(Command "Bruch" P1 "E" P1 P3 "Bruch" P2 "E" P2 P4)
	(Command "Linie" P1 P2 "" "Linie" P3 P4 "")
	
	(Setq dicke (Distance P1 P2))
	(Setq P1A (Polar P1 A2 (- (/ dicke 2) 40)))
	(Setq P2A (Polar P1 A2 (+ (/ dicke 2) 40)))
	(Setq P3A (Polar P3 A2 (- (/ dicke 2) 40)))
	(Setq P4A (Polar P3 A2 (+ (/ dicke 2) 40)))
	(Command "Linie" P1A P2A P4A P3A P1A "")

	(Princ)
)

