Kurs:Grundlagen CAD/Wände

Aus Wikiversity

Autoren: Andreas Klipp, Sascha Künstler

Aktuelle Version: 5.6

Wände (oder Waende) ist eine LISP-Datei und eine Erweiterung von AutoCAD. Sinn ist das automatisierte zeichnen eines Gebäudegrundrisses.

Download[Bearbeiten]

Beschreibung[Bearbeiten]

In Version 5.6 werden Wände, Türen und Fenster in unterschiedlichen Layern gespeichert und verschiedene Farben verwendet.

Ab Version 5.5 beinhaltet die LISP-Datei vier ausführbare Funktionen (Anmerkung: Farben seit Version 5.6):

  • aw: Aussenwand, Farbe: Weiß
  • iw: Innenwand, Farbe: Weiß
  • tr: Tür (Beta), Farbe: Rot
  • fr: Fenster (Beta), Farbe: Blau

Achtung: Um Fehler beim zeichnen zu vermeiden, sollten die Funktionen chronologisch abgearbeitet werden: aw, iw, tr, fr!

Aussenwand[Bearbeiten]

Funktionsaufruf: aw

Ablauf:

  1. Benutze Layer "w"
  2. Benutzer klickt drei Punkte, aus denen ein Rechteck gezeichnet wird.
  3. Eingabe der Wandstärke.
  4. Punktangabe, auf welche Seite verdickt werden soll.
Achtung: Es kann zu Fehlern beim zeichnen kommen, wenn die Wandstärke nach innen eingezeichnet wird und das Ausgangsrechteck dabei zu klein ist.
  1. Einzeichnung der Wandstärke.
  2. Automatische Einzeichung einer Schraffur (Schraffur: ANSI31, Winkel: 0, Maßstab: 3).
  3. Zoom auf die Aussenwand.

Der Benutzer wird während dieser Funktion also 5mal aufgefordert, mit dem Programm zu interagieren. Um die Bedienung zu erleichtern, arbeitet die Funktion mit Objektfang. Linien werden orthogonal gezeichnet.

Innenwand[Bearbeiten]

Funktionsaufruf: iw

Ablauf:

  1. Benutze Layer "w"
  2. Benutzer klickt zwei Punkte und zeichnet eine Linie.
Achtung: Es darf immer nur die innere Begrenzung als Berührungspunkt mit der Aussenwand oder einer anderen Innenwand angeklickt werden. Befindet sich einer der Punkt auf der äußeren Begrenzung oder irgendwo anders in der Zeichenfläche, kommt es zu Fehlern beim zeichnen.
Achtung 2: Die Linie muss gerade gezeichnet werden. Ansonsten wird der Benutzer darauf hingewiesen und aufgefordert, die Punkte erneut zu setzen.
Achtung 3: Es kann zu Fehlern beim zeichnen kommen, wenn die Aussenwand vor dem Zeichnen der Innenwand vom Benutzer manuell gebrochen oder anderweitig verändert wurde.
  1. Eingabe der Wandstärke.
  2. Punktangabe, auf welche Seite verdickt werden soll.
  3. Einzeichnung der Wandstärke.
  4. Brechen der Bezugswände.
  5. Erneutes einzeichnen der Schraffur.
  6. Zoom auf die Aussenwand.

Tür (Beta)[Bearbeiten]

Funktionsaufruf: tr

Ablauf:

  1. Benutze Layer "tr"
  2. Benutzer klickt zwei Punkte und zeichnet eine Linie.
Achtung: Der zweite Punkt gibt den Dreh- und Angelpunkt an.
  1. Punktangabe, auf welche Seite die Tür geöffnet werden soll.
  2. Einzeichnung des Türbogens
  3. Alle Linien zu einer Polylinie gruppieren.

Die Tür kann bei falscher Positionierung nachträglich manuell versetzt werden.

Fenster (Beta)[Bearbeiten]

Funktionsaufruf: fr

Ablauf:

  1. Benutze Layer "fr"
  2. Benutzer klickt 2 Punkte und zeichnet ein Rechteck und eine Linie zwischen den Punkten.
Achtung: Das Rechteck muss sich zwischen den Begrenzugen eine Wand befinden, d.h. die Punkte befinden sich jeweils auf einer Begrenzung und liegen sich schräg gegenüber.

Quelltext[Bearbeiten]

Version 5.6[Bearbeiten]

w5_6.lsp
;; Waende 5.6
;; (c) 2010 Andreas Klipp, Sascha Kuenstler
;; ------------------------------------------------------------------------
(defun POS () (initget 7))
;; ------------------------------------------------------------------------
;; Standard-Wandstaerken 80 100 120 140 160 180 205 240 270 330
(defun :wandstaerke ()
	(setq test 1)
	(while(or(= test 1)(= test 2))
		(if (= test 2)(print "Falsche Eingabe!"))
		(setq test 0)
		(print "Auswahlmoeglichkeiten:")
		(print "80, 100, 120, 140, 160, 180, 205, 240, 270, 330")
		(POS) (setq wandstaerke (getreal "\nWandstaerke: "))  								;; Eingabe "Wandstaerke"
		(cond
			((= wandstaerke 80)(setq wandstaerke 80))
			((= wandstaerke 100)(setq wandstaerke 100))
			((= wandstaerke 120)(setq wandstaerke 120))
			((= wandstaerke 140)(setq wandstaerke 140))
			((= wandstaerke 160)(setq wandstaerke 160))
			((= wandstaerke 180)(setq wandstaerke 180))
			((= wandstaerke 205)(setq wandstaerke 205))
			((= wandstaerke 240)(setq wandstaerke 240))
			((= wandstaerke 270)(setq wandstaerke 270))
			((= wandstaerke 330)(setq wandstaerke 330))
			((= 1 1)(setq test 2)))
	)
)
;; ------------------------------------------------------------------------
;; Aussenwaende
(defun C:aw ()
	(command "ortho" "ein")																	;; ORTHOMODE ein
	(command "ofang" "aus")																	;; Objektfang ein
	;; Layer
	(command "_.layer" "Neu" "w"  "") 														;; neuer Layer
	(command "_.layer" "se" "w"  "")														;; benutze Layer
	;; Zeichnen
	(setq p1 (getpoint "\nPunkt waehlen: "))												;; p1 setzen
	(setq p2 (getpoint p1 "\nPunkt waehlen: "))												;; p2 setzen
  	(command "_.line" p1 p2 "")																;; Linie von p1 zu p2 zeichnen
	(setq p3 (getpoint p2 "\nPunkt waehlen: "))												;; p3 setzen
	(command "_.erase" "letztes" "")														;; Linie zwischen p1 und p2 loeschen
	(command "_.rectang" p1 p3)																;; Rechteck von p1 zu p3 zeichnen
	(setq w1 (entlast))																		;; Wand 1 speichern
	;; Wandstaerke
	(setq wandstaerke (:wandstaerke))														;; Abfrage Standard-Wandstaerken
	(command "_.offset" wandstaerke p1 (getpoint "\nPunkt angeben, auf welche Seite versetzt werden soll:") "")
	(setq w2 (entlast))																		;; Wand 2 speichern	
	;; Schraffur
	(command "-gschraff" "E" "ANSI31" "3" "0" "a" w1 w2 "" "")  							;; Schraffur: ANSI31, Winkel: 0, Maßstab: 3
	(setq s1 (entlast))																		;; Schraffur speichern
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")																	;; ORTHOMODE aus
	(command "ofang" "aus")																	;; Objektfang aus
	(command "zoom" "grenzen")																;; Zoomen
)
;; ------------------------------------------------------------------------
;; Innenwaende
(defun C:iw ()
	(command "ortho" "ein")																	;; ORTHOMODE ein
	(command "ofang" "Schn,Lot,Näch,Hil")													;; Objektfang ein
	;; Layer
	(command "_.layer" "Neu" "w"  "") 														;; neuer Layer
	(command "_.layer" "se" "w"  "")														;; benutze Layer
	;; Zeichnen
	(setq p1 '(1 2 0))																		;; Pseudo-Koordinaten
	(setq p2 '(4 5 0))
	(while(and(/= (car p1) (car p2))(/= (cadr p1) (cadr p2)))
		(print "Bitte geben Sie eine gerade Linie ein")
		(setq p1 (getpoint "\nPunkt wählen: "))												;; p1 setzen
		(setq p2 (getpoint p1 "\nPunkt wählen: "))											;; p2 setzen
		(if(and(/= (car p1) (car p2))(/= (cadr p1) (cadr p2))) 								;; Kontrolle
			(print "Die wand ist leider schraeg geworden \n Bitte versuchen Sie es erneut"))
	)
	(command "_.line" p1 p2 "")																;; Linie von p1 zu p2 zeichnen
	;; Wandstaerke
	(setq wandstaerke (:wandstaerke))														;; Abfrage Standard-Wandstaerken
	(setq p5 (getpoint  "\nPunkt angeben, auf welche Seite versetzt werden soll:")) 
	(command "_.erase" "letztes" "")														;; Linie zwischen p1 und p2 loeschen (ansonsten kann es zu Fehlern beim break kommen)
	;; Auslesen der Koordinaten
	(setq x1 (nth 0 p1) y1 (nth 1 p1))
	(setq x2 (nth 0 p2) y2 (nth 1 p2))
	(setq x3 (nth 0 p5) y3 (nth 1 p5))
	;; Parallelen erstellen
	(cond
		((= x1 x2) 
			(if (< x1 x3) (setq p3 (list (+ x1 wandstaerke) y1 0.0)))
			(if (< x1 x3) (setq p4 (list (+ x2 wandstaerke) y2 0.0)))
			(if (> x1 x3) (setq p3 (list (- x1 wandstaerke) y1 0.0)))
			(if (> x1 x3) (setq p4 (list (- x2 wandstaerke) y2 0.0)))
		)
		((= y1 y2) 
			(if (< y1 y3) (setq p3 (list x1 (+ y1 wandstaerke) 0.0)))
			(if (< y1 y3) (setq p4 (list x2 (+ y2 wandstaerke) 0.0)))
			(if (> y1 y3) (setq p3 (list x1 (- y1 wandstaerke) 0.0)))
			(if (> y1 y3) (setq p4 (list x2 (- y2 wandstaerke) 0.0)))	
		)
	)
	;; Wand brechen und zeichnen
	(command "_.erase" s1 "")																;; Alte Schraffur loeschen		
	(command "_.break" p1 p3 "")
	(command "_.break" p2 p4 "")
	(command "_.line" p1 p2 "")	
	(command "_.line" p3 p4 "")
	;; Schraffur	
	(setq x4 (nth 0 p3) y4 (nth 1 p3))														;; Koordinaten von p3 auslesen
	(setq x6 (+ (/ (- x4 x1) 2) x1))														;; x6=(x4-x1)/2+x1;
	(setq y6 (+ (/ (- y4 y1) 2) y1))														;; y6=(y4-y1)/2+y1;
	(setq p6 (list x6 y6))																	;; Interner Punkt finden
	(command "-gschraff" "E" "ANSI31" "3" "0" "r" "v" p6 "") 								;; Neue Schraffur erstellen	
	(setq s1 (entlast))																		;; Schraffur speichern
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")																	;; ORTHOMODE aus
	(command "ofang" "aus")																	;; Objektfang aus
	(command "zoom" "grenzen")																;; Zoomen
)
;; ------------------------------------------------------------------------
;; Tueren (Beta)
(defun C:tr ()
	(command "ortho" "ein")
	(command "ofang" "Schn,Lot,Näch,Hil")
	;; Layer
	(command "_.layer" "Neu" "tr"  "") 														;; neuer Layer
	(command "_.layer" "fa" "rot" "tr" "") 													;; Layer farbe auf rot	
	(command "_.layer" "se" "tr"  "")														;; benutze Layer
	;; Zeichnen
	(setq p1 (getpoint "\n 1.Punkt waehlen: "))
	(setq p2 (getpoint p1 "\n 2.Punkt waehlen: "))
	(command "_.line" p1 p2 "")
	(setq l1 (entlast))																		;; Linie speichern
	(setq p9 (getpoint "\n 2.Bitte geben Sie die Richtung an, in die sich die Tür offnen soll: "))	
	;; Auslesen der Koordinaten
	(setq x1 (nth 0 p1) y1 (nth 1 p1))
	(setq x2 (nth 0 p2) y2 (nth 1 p2))
	(setq x9 (nth 0 p9) y9 (nth 1 p9))
	;; Türbogen
	(if( and (= x1 x2)(> x9 x1))(setq mod 1))												;; senkrecht rechts öffnen
	(if( and (= x1 x2)(< x9 x1))(setq mod 2))												;; senkrecht links öffnen
	(if( and (= y1 y2)(> y9 y1))(setq mod 3))												;; waagerecht oben öffnen
	(if( and (= y1 y2)(< y9 y1))(setq mod 4))												;; waaagerecht unten öffnen
	(cond
		((= mod 1) 																			;; letzter Befehl wird 2 mak ausgeführt	
			(if(> y1 y2)(setq p3 (list (+  x2 (- y1 y2)) (cadr p2) 0)))						;; wurde von oben nach unten gezeichnet?
			(if(< y1 y2)(setq p3 (list (+  x2 (- y2 y1)) (cadr p2) 0)))						;; von unten nach oben
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(command "_.arc" p1 "_e" p3 "_d" p1)	
			(setq l3 (entlast))	
		)
		((= mod 2) 
		
			(if(> y1 y2)(setq p3 (list (-  x2 (- y1 y2)) (cadr p2) 0)))						;; wurde von oben nach unten gezeichnet?
			(if(< y1 y2)(setq p3 (list (-  x2 (- y2 y1)) (cadr p2) 0)))						;; von unten nach oben
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(if(> y1 y2)(command "_.arc" p1 "_e" p3 "w" "90"))
			(if(< y1 y2)(command "_.arc" p1 "_e" p3 "w" "-90"))
			(setq l3 (entlast))	
		)
		((= mod 3) 
			(if(> x1 x2)(setq p3 (list ( car p2) (+ (cadr p2) (- x1 x2)))))					;; wurde von rechts nach links gezeichnet?
			(if(< x1 x2)(setq p3 (list ( car p2) (+ (cadr p2) (- x2 x1)))))					;; von links nach rechts
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(if(> x1 x2)(command "_.arc" p1 "_e" p3 "w" "90"))
			(if(< x1 x2)(command "_.arc" p1 "_e" p3 "w" "-90"))
			(setq l3 (entlast))	
		)
		((= mod 4) 
			(if(> x1 x2)(setq p3 (list ( car p2) (- (cadr p2) (- x1 x2)))))					;; von rechts nach links
			(if(< x1 x2)(setq p3 (list ( car p2) (- (cadr p2) (- x2 x1)))))					;; von links nach rechts
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(if(> x1 x2)(command "_.arc" p1 "_e" p3 "w" "-90"))
			(if(< x1 x2)(command "_.arc" p1 "_e" p3 "w" "90"))
			(setq l3 (entlast))	
		)
	)
	;; Gruppieren
	(command "_.pedit" "o" l1 l2 l3 "" "j" "v" "" "")
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")	
	(command "ofang" "aus")	
)
;; ------------------------------------------------------------------------
;; Fenster (Beta)
(defun C:fr ()
	(command "ofang" "Schn,Lot,Näch,Hil")
	;; Layer
	(command "_.layer" "Neu" "fr"  "") 														;; neuer Layer
	(command "_.layer" "fa" "blau" "fr" "") 												;; Layer farbe auf blau	
	(command "_.layer" "se" "fr"  "")														;; benutze Layer
	;; Zeichnen
	(command "_.rectang" (setq p1 (getpoint "\n 1.Punkt waehlen: ")) (setq p2 (getpoint p1 "\n 2.Punkt waehlen: ")))		
	(command "_.line" p1 p2 "")
	(command "ofang" "aus")
)

Version 5.5[Bearbeiten]

;; Waende 5.5
;; (c) 2010 Andreas Klipp, Sascha Kuenstler
;; ------------------------------------------------------------------------
(defun POS () (initget 7))
;; ------------------------------------------------------------------------
;; Standard-Wandstaerken 80 100 120 140 160 180 205 240 270 330
(defun :wandstaerke ()
	(setq test 1)
	(while(or(= test 1)(= test 2))
		(if (= test 2)(print "Falsche Eingabe!"))
		(setq test 0)
		(print "Auswahlmoeglichkeiten:")
		(print "80, 100, 120, 140, 160, 180, 205, 240, 270, 330")
		(POS) (setq wandstaerke (getreal "\nWandstaerke: "))  								;; Eingabe "Wandstaerke"
		(cond
			((= wandstaerke 80)(setq wandstaerke 80))
			((= wandstaerke 100)(setq wandstaerke 100))
			((= wandstaerke 120)(setq wandstaerke 120))
			((= wandstaerke 140)(setq wandstaerke 140))
			((= wandstaerke 160)(setq wandstaerke 160))
			((= wandstaerke 180)(setq wandstaerke 180))
			((= wandstaerke 205)(setq wandstaerke 205))
			((= wandstaerke 240)(setq wandstaerke 240))
			((= wandstaerke 270)(setq wandstaerke 270))
			((= wandstaerke 330)(setq wandstaerke 330))
			((= 1 1)(setq test 2)))
	)
)
;; ------------------------------------------------------------------------
;; Aussenwaende
(defun C:aw ()
	(command "ortho" "ein")																	;; ORTHOMODE ein
	(command "ofang" "aus")																	;; Objektfang ein
	;; Zeichnen
	(setq p1 (getpoint "\nPunkt waehlen: "))												;; p1 setzen
	(setq p2 (getpoint p1 "\nPunkt waehlen: "))												;; p2 setzen
  	(command "_.line" p1 p2 "")																;; Linie von p1 zu p2 zeichnen
	(setq p3 (getpoint p2 "\nPunkt waehlen: "))												;; p3 setzen
	(command "_.erase" "letztes" "")														;; Linie zwischen p1 und p2 loeschen
	(command "_.rectang" p1 p3)																;; Rechteck von p1 zu p3 zeichnen
	(setq w1 (entlast))																		;; Wand 1 speichern
	;; Wandstaerke
	(setq wandstaerke (:wandstaerke))														;; Abfrage Standard-Wandstaerken
	(command "_.offset" wandstaerke p1 (getpoint "\nPunkt angeben, auf welche Seite versetzt werden soll:") "")
	(setq w2 (entlast))																		;; Wand 2 speichern	
	;; Schraffur
	(command "-gschraff" "E" "ANSI31" "3" "0" "a" w1 w2 "" "")  							;; Schraffur: ANSI31, Winkel: 0, Maßstab: 3
	(setq s1 (entlast))																		;; Schraffur speichern
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")																	;; ORTHOMODE aus
	(command "ofang" "aus")																	;; Objektfang aus
	(command "zoom" "grenzen")																;; Zoomen
)
;; ------------------------------------------------------------------------
;; Innenwaende
(defun C:iw ()
	(command "ortho" "ein")																	;; ORTHOMODE ein
	(command "ofang" "Schn,Lot,Näch,Hil")													;; Objektfang ein
	;; Zeichnen
	(setq p1 '(1 2 0))																		;; Pseudo-Koordinaten
	(setq p2 '(4 5 0))
	(while(and(/= (car p1) (car p2))(/= (cadr p1) (cadr p2)))
		(print "Bitte geben Sie eine gerade Linie ein")
		(setq p1 (getpoint "\nPunkt wählen: "))												;; p1 setzen
		(setq p2 (getpoint p1 "\nPunkt wählen: "))											;; p2 setzen
		(if(and(/= (car p1) (car p2))(/= (cadr p1) (cadr p2))) 								;; Kontrolle
			(print "Die wand ist leider schraeg geworden \n Bitte versuchen Sie es erneut"))
	)
	(command "_.line" p1 p2 "")																;; Linie von p1 zu p2 zeichnen
	;; Wandstaerke
	(setq wandstaerke (:wandstaerke))														;; Abfrage Standard-Wandstaerken
	(setq p5 (getpoint  "\nPunkt angeben, auf welche Seite versetzt werden soll:")) 
	(command "_.erase" "letztes" "")														;; Linie zwischen p1 und p2 loeschen (ansonsten kann es zu Fehlern beim break kommen)
	;; Auslesen der Koordinaten
	(setq x1 (nth 0 p1) y1 (nth 1 p1))
	(setq x2 (nth 0 p2) y2 (nth 1 p2))
	(setq x3 (nth 0 p5) y3 (nth 1 p5))
	;; Parallelen erstellen
	(cond
		((= x1 x2) 
			(if (< x1 x3) (setq p3 (list (+ x1 wandstaerke) y1 0.0)))
			(if (< x1 x3) (setq p4 (list (+ x2 wandstaerke) y2 0.0)))
			(if (> x1 x3) (setq p3 (list (- x1 wandstaerke) y1 0.0)))
			(if (> x1 x3) (setq p4 (list (- x2 wandstaerke) y2 0.0)))
		)
		((= y1 y2) 
			(if (< y1 y3) (setq p3 (list x1 (+ y1 wandstaerke) 0.0)))
			(if (< y1 y3) (setq p4 (list x2 (+ y2 wandstaerke) 0.0)))
			(if (> y1 y3) (setq p3 (list x1 (- y1 wandstaerke) 0.0)))
			(if (> y1 y3) (setq p4 (list x2 (- y2 wandstaerke) 0.0)))	
		)
	)
	;; Wand brechen und zeichnen
	(command "_.erase" s1 "")																;; Alte Schraffur loeschen		
	(command "_.break" p1 p3 "")
	(command "_.break" p2 p4 "")
	(command "_.line" p1 p2 "")	
	(command "_.line" p3 p4 "")
	;; Schraffur	
	(setq x4 (nth 0 p3) y4 (nth 1 p3))														;; Koordinaten von p3 auslesen
	(setq x6 (+ (/ (- x4 x1) 2) x1))														;; x6=(x4-x1)/2+x1;
	(setq y6 (+ (/ (- y4 y1) 2) y1))														;; y6=(y4-y1)/2+y1;
	(setq p6 (list x6 y6))																	;; Interner Punkt finden
	(command "-gschraff" "E" "ANSI31" "3" "0" "r" "v" p6 "") 								;; Neue Schraffur erstellen	
	(setq s1 (entlast))																		;; Schraffur speichern
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")																	;; ORTHOMODE aus
	(command "ofang" "aus")																	;; Objektfang aus
	(command "zoom" "grenzen")																;; Zoomen
)
;; ------------------------------------------------------------------------
;; Tueren (Beta)
(defun C:tr ()
	(command "ortho" "ein")
	(command "ofang" "Schn,Lot,Näch,Hil")		
	;; Zeichnen
	(setq p1 (getpoint "\n 1.Punkt waehlen: "))
	(setq p2 (getpoint p1 "\n 2.Punkt waehlen: "))
	(command "_.line" p1 p2 "")
	(setq l1 (entlast))																		;; Linie speichern
	(setq p9 (getpoint "\n 2.Bitte geben Sie die Richtung an, in die sich die Tür offnen soll: "))	
	;; Auslesen der Koordinaten
	(setq x1 (nth 0 p1) y1 (nth 1 p1))
	(setq x2 (nth 0 p2) y2 (nth 1 p2))
	(setq x9 (nth 0 p9) y9 (nth 1 p9))
	;; Türbogen
	(if( and (= x1 x2)(> x9 x1))(setq mod 1))												;; senkrecht rechts öffnen
	(if( and (= x1 x2)(< x9 x1))(setq mod 2))												;; senkrecht links öffnen
	(if( and (= y1 y2)(> y9 y1))(setq mod 3))												;; waagerecht oben öffnen
	(if( and (= y1 y2)(< y9 y1))(setq mod 4))												;; waaagerecht unten öffnen
	(cond
		((= mod 1) 																			;; letzter Befehl wird 2 mak ausgeführt	
			(if(> y1 y2)(setq p3 (list (+  x2 (- y1 y2)) (cadr p2) 0)))						;; wurde von oben nach unten gezeichnet?
			(if(< y1 y2)(setq p3 (list (+  x2 (- y2 y1)) (cadr p2) 0)))						;; von unten nach oben
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(command "_.arc" p1 "_e" p3 "_d" p1)	
			(setq l3 (entlast))	
		)
		((= mod 2) 
		
			(if(> y1 y2)(setq p3 (list (-  x2 (- y1 y2)) (cadr p2) 0)))						;; wurde von oben nach unten gezeichnet?
			(if(< y1 y2)(setq p3 (list (-  x2 (- y2 y1)) (cadr p2) 0)))						;; von unten nach oben
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(if(> y1 y2)(command "_.arc" p1 "_e" p3 "w" "90"))
			(if(< y1 y2)(command "_.arc" p1 "_e" p3 "w" "-90"))
			(setq l3 (entlast))	
		)
		((= mod 3) 
			(if(> x1 x2)(setq p3 (list ( car p2) (+ (cadr p2) (- x1 x2)))))					;; wurde von rechts nach links gezeichnet?
			(if(< x1 x2)(setq p3 (list ( car p2) (+ (cadr p2) (- x2 x1)))))					;; von links nach rechts
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(if(> x1 x2)(command "_.arc" p1 "_e" p3 "w" "90"))
			(if(< x1 x2)(command "_.arc" p1 "_e" p3 "w" "-90"))
			(setq l3 (entlast))	
		)
		((= mod 4) 
			(if(> x1 x2)(setq p3 (list ( car p2) (- (cadr p2) (- x1 x2)))))					;; von rechts nach links
			(if(< x1 x2)(setq p3 (list ( car p2) (- (cadr p2) (- x2 x1)))))					;; von links nach rechts
			(command "_.line" p2 p3 "")
			(setq l2 (entlast))	
			(if(> x1 x2)(command "_.arc" p1 "_e" p3 "w" "-90"))
			(if(< x1 x2)(command "_.arc" p1 "_e" p3 "w" "90"))
			(setq l3 (entlast))	
		)
	)
	;; Gruppieren
	(command "_.pedit" "o" l1 l2 l3 "" "j" "v" "" "")
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")	
	(command "ofang" "aus")	
)
;; ------------------------------------------------------------------------
;; Fenster (Beta)
(defun C:fr ()
	(command "ofang" "Schn,Lot,Näch,Hil")
	(command "_.rectang" (setq p1 (getpoint "\n 1.Punkt waehlen: ")) (setq p2 (getpoint p1 "\n 2.Punkt waehlen: ")))		
	(command "_.line" p1 p2 "")
	(command "ofang" "aus")
)

Version 5.3[Bearbeiten]

w5_3.lsp
;; Waende 5.3
;; (c) 2010 Andreas Klipp, Sascha Kuenstler
;; ------------------------------------------------------------------------
(defun POS () (initget 7))
;; ------------------------------------------------------------------------
;; Standard-Wandstaerken 80 100 120 140 160 180 205 240 270 330
(defun :wandstaerke ()
	(setq test 1)
	(while(or(= test 1)(= test 2))
		(if (= test 2)(print "Falsche Eingabe!"))
		(setq test 0)
		(print "Auswahlmoeglichkeiten:")
		(print "80, 100, 120, 140, 160, 180, 205, 240, 270, 330")
		(POS) (setq wandstaerke (getreal "\nWandstaerke: "))  								;; Eingabe "Wandstaerke"
		(cond
			((= wandstaerke 80)(setq wandstaerke 80))
			((= wandstaerke 100)(setq wandstaerke 100))
			((= wandstaerke 120)(setq wandstaerke 120))
			((= wandstaerke 140)(setq wandstaerke 140))
			((= wandstaerke 160)(setq wandstaerke 160))
			((= wandstaerke 180)(setq wandstaerke 180))
			((= wandstaerke 205)(setq wandstaerke 205))
			((= wandstaerke 240)(setq wandstaerke 240))
			((= wandstaerke 270)(setq wandstaerke 270))
			((= wandstaerke 330)(setq wandstaerke 330))
			((= 1 1)(setq test 2)))
	)
)
;; ------------------------------------------------------------------------
;; Aussenwaende
(defun C:aw ()
	(command "ortho" "ein")																	;; ORTHOMODE ein
	(command "ofang" "aus")																	;; Objektfang ein
	;; Zeichnen
	(setq p1 (getpoint "\nPunkt waehlen: "))												;; p1 setzen
	(setq p2 (getpoint p1 "\nPunkt waehlen: "))												;; p2 setzen
  	(command "_.line" p1 p2 "")																;; Linie von p1 zu p2 zeichnen
	(setq p3 (getpoint p2 "\nPunkt waehlen: "))												;; p3 setzen
	(command "_.erase" "letztes" "")														;; Linie zwischen p1 und p2 loeschen
	(command "_.rectang" p1 p3)																;; Rechteck von p1 zu p3 zeichnen
	(setq w1 (entlast))																		;; Wand 1 speichern
	;; Wandstaerke
	(setq wandstaerke (:wandstaerke))														;; Abfrage Standard-Wandstaerken
	(command "_.offset" wandstaerke p1 (getpoint "\nPunkt angeben, auf welche Seite versetzt werden soll:") "")
	(setq w2 (entlast))																		;; Wand 2 speichern
	;; In Bestandteile auflösen
	(command "-gschraff" "E" "ANSI31" "3" "0" "a" w1 w2 "" "")  							;; Schraffur: ANSI31, Winkel: 0, Maßstab: 3
	(setq s1 (entlast))																		;; Schraffur speichern
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")																	;; ORTHOMODE aus
	(command "ofang" "aus")																	;; Objektfang aus
	(command "zoom" "grenzen")																;; Zoomen
)
;; ------------------------------------------------------------------------
;; Innenwaende
(defun C:iw ()
	(command "ortho" "ein")																	;; ORTHOMODE ein
	(command "ofang" "Schn,Lot,Näch,Hil")													;; Objektfang ein
	;; Zeichnen
	(setq p1 '(1 2 0))																		;; Pseudo-Koordinaten
	(setq p2 '(4 5 0))
	(while(and(/= (car p1) (car p2))(/= (cadr p1) (cadr p2)))
		(print "Bitte geben Sie eine gerade Linie ein")
		(setq p1 (getpoint "\nPunkt wählen: "))												;; p1 setzen
		(setq p2 (getpoint p1 "\nPunkt wählen: "))											;; p2 setzen
		(if(and(/= (car p1) (car p2))(/= (cadr p1) (cadr p2))) 								;; Kontrolle
			(print "Die wand ist leider schraeg geworden\n Bitte versuchen Sie es erneut"))
	)
	(command "_.line" p1 p2 "")																;; Linie von p1 zu p2 zeichnen
	;; Wandstaerke
	(setq wandstaerke (:wandstaerke))														;; Abfrage Standard-Wandstaerken
	(setq p5 (getpoint  "\nPunkt angeben, auf welche Seite versetzt werden soll:")) 
	(command "_.erase" "letztes" "")														;; Linie zwischen p1 und p2 loeschen (ansonsten kann es zu Fehlern beim break kommen)
	;; Auslesen der Koordinaten
	(setq x1 (nth 0 p1) y1 (nth 1 p1))
	(setq x2 (nth 0 p2) y2 (nth 1 p2))
	(setq x3 (nth 0 p5) y3 (nth 1 p5))
	;; Parallelen erstellen
	(cond
		((= x1 x2) 
			(if (< x1 x3) (setq p3 (list (+ x1 wandstaerke) y1 0.0)))
			(if (< x1 x3) (setq p4 (list (+ x2 wandstaerke) y2 0.0)))
			(if (> x1 x3) (setq p3 (list (- x1 wandstaerke) y1 0.0)))
			(if (> x1 x3) (setq p4 (list (- x2 wandstaerke) y2 0.0)))
		)
		((= y1 y2) 
			(if (< y1 y3) (setq p3 (list x1 (+ y1 wandstaerke) 0.0)))
			(if (> y1 y3) (setq p4 (list x2 (+ y2 wandstaerke) 0.0)))
			(if (> y1 y3) (setq p3 (list x1 (- y1 wandstaerke) 0.0)))
			(if (> y1 y3) (setq p4 (list x2 (- y2 wandstaerke) 0.0)))	
		)
	)
	;; Wand brechen und zeichnen	
	(command "_.break" p1 p3 "")
	(command "_.break" p2 p4 "")
	(command "_.line" p1 p2 "")	
	(command "_.line" p3 p4 "")
	;; Schraffur	
	(setq x4 (nth 0 p3) y4 (nth 1 p3))														;; Koordinaten von p3 auslesen
	(setq x6 (+ (/ (- x4 x1) 2) x1))														;; x6=(x4-x1)/2+x1;
	(setq y6 (+ (/ (- y4 y1) 2) y1))														;; y6=(y4-y1)/2+y1;
	(setq p6 (list x6 y6))																	;; Interner Punkt finden
	(command "_.erase" s1 "")																;; Alte Schraffur loeschen
	(command "-gschraff" "E" "ANSI31" "3" "0" "r" "v" p6 "") 								;; Neue Schraffur erstellen	
	(setq s1 (entlast))																		;; Schraffur speichern
	;; Einstellungen zurücksetzen
	(command "ortho" "aus")																	;; ORTHOMODE aus
	(command "ofang" "aus")																	;; Objektfang aus
	(command "zoom" "grenzen")																;; Zoomen
)

Beta[Bearbeiten]

waende.lsp
;; Wände
;; (c) 2009 Andreas Klipp, Sascha Künstler
;; ------------------------------------------------------------------------
(defun POS () (initget 7))
(defun C:waende ()
(setq anzahl nil dicke nil x1 nil y1 nil z1 nil x2 nil y2 nil z2 nil p1 nil p2 nil)
(setq anzahlstart nil pstart nil objektalt nil objektneu nil p3 nil)
(command "ortho" "ein")  ;; ORTHOMODE ein
(command "fang" "aus")  ;; Objektfang aus
(POS) (setq anzahl (getreal "\nAnzahl der Waende: "))  ;; Eingabe "Anzahl der Wände"
;; ------------------------------------------------------------------------
;; Standard-Wandstaerken 80 100 120 140 160 180 205 240 270 330
(setq test 1)
(while(or(= test 1)(= test 2))
	(if (= test 2)(print "Falsche Eingabe!"))
	(setq test 0)
	(print "Auswahlmoeglichkeiten:")
	(print "80, 100, 120, 140, 160, 180, 205, 240, 270, 330")
	(POS) (setq dicke (getreal "\nWandstaerke: "))  ;; Eingabe "Wandstärke"
	(cond
		((= dicke 80)(setq dicke 80))
		((= dicke 100)(setq dicke 100))
		((= dicke 120)(setq dicke 120))
		((= dicke 140)(setq dicke 140))
		((= dicke 160)(setq dicke 160))
		((= dicke 180)(setq dicke 180))
		((= dicke 205)(setq dicke 205))
		((= dicke 240)(setq dicke 240))
		((= dicke 270)(setq dicke 270))
		((= dicke 330)(setq dicke 330))
		((= 1 1)(setq test 2)))
)
;; ------------------------------------------------------------------------	
(setq klickpunkt1 (getpoint "\nPunkt wählen: "))  ;; 1. Klickpunkt setzen
(print klickpunkt1)  ;; Ausgabe der Koordinaten vom 1. Klickpunkt in der Konsole
(setq anzahlstart anzahl)  ;; Merken der Anzahl für Startpunkt der Parallelen
(setq startpunkt klickpunkt1)  ;; Startpunkt merken
;; ------------------------------------------------------------------------	
(while (not (zerop anzahl))
	(setq klickpunkt2 (getpoint klickpunkt1 "\nPunkt wählen: "))  ;; 2. Klickpunkt setzen
	(print klickpunkt2)  ;; Ausgabe der Koordinaten 2. Klickpunkt in der Konsole
	;; Auslesen der Koordinaten
	(setq x1 (nth 0 klickpunkt1))
	(setq y1 (nth 1 klickpunkt1))
	(setq z1 (nth 2 klickpunkt1))
	(setq x2 (nth 0 klickpunkt2))
	(setq y2 (nth 1 klickpunkt2))
	(setq z2 (nth 2 klickpunkt2))
	;; Parallelen erstellen
	(if (< x1 x2) (setq p1x (- x1 dicke) p1y (+ y1 dicke) p1z z1	p1 (list p1x p1y p1z)))
	(if (< x1 x2) (setq p2x (+ x2 dicke) p2y (+ y2 dicke) p2z z2	p2 (list p2x p2y p2z)))
	(if (> x1 x2) (setq p1x (+ x1 dicke) p1y (- y1 dicke) p1z z1	p1 (list p1x p1y p1z)))
	(if (> x1 x2) (setq p2x (- x2 dicke) p2y (- y2 dicke) p2z z2	p2 (list p2x p2y p2z)))
	(if (< y1 y2) (setq p1x (- x1 dicke) p1y (- y1 dicke) p1z z1	p1 (list p1x p1y p1z)))
	(if (< y1 y2) (setq p2x (- x2 dicke) p2y (+ y2 dicke) p2z z2	p2 (list p2x p2y p2z)))
	(if (> y1 y2) (setq p1x (+ x1 dicke) p1y (+ y1 dicke) p1z z1	p1 (list p1x p1y p1z)))
	(if (> y1 y2) (setq p2x (+ x2 dicke) p2y (- y2 dicke) p2z z2	p2 (list p2x p2y p2z)))
	;; p3 für Schraffur
	(if (= anzahl anzahlstart)
		(if (< x1 x2) 
			(setq p3x (- x1 (/ dicke 2)) p3y (+ y1 (/ dicke 2)) p3z z1	p3 (list p3x p3y p3z))
			(setq p3x (+ x1 (/ dicke 2)) p3y (- y1 (/ dicke 2)) p3z z1	p3 (list p3x p3y p3z))
		)
	)
	;; Zeichnen
	(command "_line" klickpunkt1 klickpunkt2 "")
	(command "_line" p1 p2 "")	
	;; Objekte abrunden
	(setq objektneu (ssget "L"))  ;; letztes Objekt auswählen
	(if (< anzahl anzahlstart) (command "Abrunden" objektalt objektneu))  ;; abrunden
	(setq objektalt objektneu)  ;; Umschreiben der Objekte
	;; Zeichnung abschließen
	(if (= anzahl anzahlstart) (setq pstart p1))  ;; Startpunkt (Parallele)
	(if (= anzahl 1) (command "_line" klickpunkt1 klickpunkt2 startpunkt ""))  ;; Klickpunkte verbinden
	(if (= anzahl 1) (command "_line" p1 p2 pstart ""))  ;; Parallelen verbinden
	;; Schleife
	(setq klickpunkt1 klickpunkt2)  ;; Umschreiben der Klickpunkte
	(setq anzahl(1- anzahl))  ;; Anzahl um 1 runterzählen
)
;; ------------------------------------------------------------------------	
(command "-gschraff" "E" "ANSI31" "3" "0" p3 "" "")  ;; Schraffur: ANSI31, Winkel: 0, Maßstab: 3
(command "ortho" "aus")  ;; ORTHOMODE aus
(command "fang" "ein")  ;; Objektfang ein
(command "zoom" "grenzen")  ;; Zoomen
)