Open main menu

< Sample documents

A little environment to integrate your construction plans in a document.
Example pdf: Carport.pdf
This example is the result of the following ConTeXt code:

\environment e-bauplan
\starttext
\Plan[prefix=situ,ech=20000,mm=4150000,titre=Plan de situation,
  projet=Abri voiture,auteur=Peter Münster]

\Plan[ech=2000,mm=351000,titre=Plan de situation (détail)]

\Plan[prefix=masse,ech=500,mm=60800,titre=Plan de masse]

\Plan[prefix=coupe,ech=100,mm=19620,titre=Coupe]

\Plan[prefix=plan,ech=50,mm=10080,titre=Plan]

\Plan[prefix=povray,ech=60,mm=15000,titre=Simulation (1)]

\Plan[prefix=photo,ech=100,mm=25000,titre=Photo (2)]
\stoptext

And here the environment file:

\startenvironment e-bauplan

%% It's a French document:
\useregime[il9]
\enableregime[il9]
\useencoding[ffr]
\definehspace[fr][:][.16667em]
\definehspace[fr][;][.16667em]
\definehspace[fr][!][.16667em]
\definehspace[fr][?][.16667em]
\mainlanguage[fr]

%% We need a lot of space:
\setuplayout[header=0pt,footer=0pt,backspace=2cm,width=middle,
  topspace=1cm,height=middle]

\setuppagenumbering[state=stop]% Doing it on our own.

%% Usage: \Plan[prefix=...,ech=...,mm=...,titre=...,projet=...,auteur=...]
%% prefix: the name of the file is "prefix-mm.{eps,pdf,jpg}"
%% ech: the scale 
%% mm: the width of the image in mm
%% titre: the titel of the page
%% projet: the name of the project
%% auteur: the name of the author; as "projet" only neccessary for the 1. page
\newdimen\Width \newdimen\Height
\def\Plan[#1]{%
  \getparameters[PL][#1]
  \Width=\the\dimexpr(\the\numexpr(20*\PLmm/\PLech)mm/20)
  \def\myFig{\externalfigure[\PLprefix-\PLmm][width=\the\Width]}%
  \setbox\scratchbox\hbox{\myFig}\Height=\ht\scratchbox
  \ifdim\Width>1.2\Height
    \setuppapersize[A4,landscape,rotated][A4]
  \else
    \setuppapersize[A4][A4]
  \fi
  \startstandardmakeup
  \midaligned{\myFig}\vfil
  {\tx Projet: \PLprojet, Auteur: \PLauteur, Date: \currentdate}\hfill
  \framed[align=lohi,offset=2ex]{{\bfc\PLtitre}\blank
  Échelle: 1/\PLech\quad\hfill(\currentpage/\lastpage)}\vskip0pt plus -1fil
  \stopstandardmakeup}
\stopenvironment

An up to date version of this module can be found at http://pmrb.free.fr/work/OS/ConTeXt/