script-generated room plans

This commit is contained in:
stuebinm 2022-12-19 19:59:57 +01:00
commit 3317ad71e7
10 changed files with 68594 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
out/*
svg/*

8745
Level+0.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 413 KiB

11241
Level+1.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 568 KiB

10878
Level+2.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 544 KiB

11780
Level+3.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 594 KiB

11856
Level+4.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 601 KiB

4195
Level+5.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 231 KiB

9715
Level-1.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 489 KiB

171
generate.scm Executable file
View file

@ -0,0 +1,171 @@
#!/usr/bin/env gosh
(use sxml.ssax)
(use sxml.serializer)
(use sxml.sxpath)
(use sxml.tools)
(use gauche.process)
(define rooms-level-1
'(("H1-U.1" . "Lärmraum")
("H1-U.2" . "Lounge")
("H1-U.3" . "Garderobe")
("H1-U.4" . "Hauptwasseranschluss\nHauptstromkasten")
("H1-U.5" . "Toiletten")
("H1-U.6" . "Heizung")
("H1-U.7" . "Lagerbereich 1")
("H1-U.8" . "Lagerbereich 2\nRaum1")
("H1-U.9" . "Lagerbereich 2\nRaum2")
("H2-U.1" . "Strom")
("H2-U.2" . "Batterieraum")
("H2-U.3" . "Heizung")
("H2-U.4" . "Tiefgarage")))
(define rooms-level+0
'(("H1-0.1" . "Info-Point")
("H1-0.2" . "Lager/Teambereich")
("H1-0.3" . "Ausstellung\nHinführung")
("H1-0.4" . "Akkreditierung")
("H1-0.5" . "Glühweinstand")
("H2-0.1" . "Info-Wand")
("H2-0.2" . "Graffitiarea")))
(define rooms-level+1
'(("H1-1.1" . "Lager")
("H1-1.2" . "Werkstatt")
("H1-1.3" . "VOC")
("H2-1.1" . "Toiletten")
("H2-1.2" . "Toiletten")
("H2-1.3" . "Austellungsraum 1")
("H2-1.4" . "VOC#2")
("H2-1.5" . "Teambereich")
("H2-1.6" . "Vortragsraum 1\nAhlam")
("H2-1.7" . "Nachbereitung\nFlexraum")
("H2-1.8" . "Sanitäterraum")))
(define rooms-level+2
'(("H1-2.1" . "Ruheraum\nAufenthalt")
("H1-2.2" . "Bibliothek\nSiebdruck\nKleidertausch")
("H1-2.3" . "Awareness")
("H1-2.4" . "Flexraum\nAwerness")
("H1-2.5" . "Toiletten")
("H1-2.6" . "Toiletten")
("H2-2.1" . "Toiletten")
("H2-2.2" . "Toiletten")
("H2-2.3" . "Lager")
("H2-2.4" . "Ausstellungsraum 2\nfür Kunst und Backup\nUrbane Praxis")
("H2-2.5" . "Workshopraum 1")
("H2-2.6" . "Nachbereitung\nFlexraum")
("H2-2.7" . "Ausstellungsraum 3")))
(define rooms-level+3
'(("H1-3.1" . "Austellungsraum 5")
("H1-3.2" . "Lager")
("H1-3.3" . "Lager")
("H1-3.4" . "nicht benutzbar")
("H1-3.5" . "Toiletten")
("H1-3.6" . "Toiletten")
("H2-3.1" . "Toiletten")
("H2-3.2" . "Toiletten")
("H2-3.3" . "Ausstellungsraum 4")
("H2-3.4" . "Workshopraum 2")
("H2-3.5" . "Workshopraum\nFlex")
("H2-3.6" . "Workshopraum 3")
("H2-3.7" . "Nachbereitung\nFlexraum")
("H2-3.8" . "Sponsoring Raum")))
(define rooms-level+4
'(("H1-4.1" . "Flexraum 1")
("H1-4.2" . "Flexraum 2")
("H1-4.3" . "Flexraum 3")
("H1-4.4" . "Flexraum 4")
("H1-4.5" . "Toiletten")
("H1-4.6" . "Toiletten")
("H2-4.1" . "Toiletten")
("H2-4.2" . "Toiletten")
("H2-4.3" . "Essenslager")
("H2-4.4" . "Workshopraum 4")
("H2-4.5" . "Kantine\nKüche")
("H2-4.6" . "Workshopraum\nFlex")
("H2-4.7" . "Essensbereich")
("H2-4.8" . "Stände\nMindzone\nTombola")))
(define rooms-level+5
'(("H1-5.1" . "Flexraum 5")
("H1-5.2" . "Vortragsraum 2\nBhavani")
("H1-5.3" . "Toiletten")
("H1-5.4" . "Toiletten")
("H2-5.1" . "Timeout Raum")
("H2-5.2" . "Timeout Raum\n(Küche)")
("H2-5.3" . "Timeout Raum\n(Küche)")))
(define (mk-path id)
(sxpath `(// (* (@ id (equal? ,id))))))
(define (mk-element id text)
(display (format "changing element with id ~a\n" id))
`((http://www.w3.org/2000/svg:text
(@ (xml:space "preserve")
(transform "scale(0.26458333)")
(style "font-size:50px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;white-space:pre;fill:white;fill-opacity:1;stroke:white;stroke-linejoin:round;fill-rule:nonzero;stroke-linecap:round;stroke-opacity:1;stroke-width:0.6em")
(id "anchor"))
(http://www.w3.org/2000/svg:tspan
(@ (y 30))
,(string-append id ":\n" text)))
(http://www.w3.org/2000/svg:text
(@ (xml:space "preserve")
(transform "scale(0.26458333)")
(style "font-style:normal;font-weight:normal;font-size:50px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;white-space:pre;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1")
(id "anchor"))
(http://www.w3.org/2000/svg:tspan
(@ (y 30))
,(string-append id ":\n" text)))))
(define (adjust-file infile outfile alist)
(display (format "building file ~a...\n" outfile))
(let* ([svg (call-with-input-file
infile
(lambda (port) (ssax:xml->sxml port '())))]
[set-text (lambda (roomid text)
(map (lambda (elem)
(sxml:change-content! elem (mk-element roomid text)))
((mk-path roomid) svg)))])
(map (lambda (a)
(set-text (car a) (cdr a)))
alist)
(call-with-output-file
outfile
(lambda (port) (srl:sxml->xml svg port)))
))
(do-process '(mkdir -p svg))
(do-process '(mkdir -p out))
(define levels
`(("Level-1" . ,rooms-level-1)
("Level+0" . ,rooms-level+0)
("Level+1" . ,rooms-level+1)
("Level+2" . ,rooms-level+2)
("Level+3" . ,rooms-level+3)
("Level+4" . ,rooms-level+4)
("Level+5" . ,rooms-level+5)
))
(map (lambda (level)
(adjust-file (string-append (car level) ".svg") (string-append "svg/" (car level) ".svg") (cdr level))
(do-process `(inkscape ,(string-append "svg/" (car level) ".svg") ,(string-append "--export-pdf=out/" (car level) ".pdf"))))
levels)
(do-process
(append '(pdfunite)
(map (lambda (level) (string-append "out/" (car level) ".pdf")) levels)
'("out/combined.pdf")))

11
shell.nix Normal file
View file

@ -0,0 +1,11 @@
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs;
mkShell {
buildInputs = [
gauche
inkscape
poppler_utils
];
}