We have developed a WFSOutputFormat to write DXF (plain or zipped) in response to a GetFeature request.
If anyone is interested in it, we would like to commit it as a community module.
Some features from the README:
There have been multiple revisions of the format, so we need to choose a "version"
of DXF to write. The extension implements version 14, but can be easily extended
(through SPI providers) to write other versions too.
Each single query is rendered as a layer. Geometries are encoded as
entities (if simple enough to be expressed by a single DXF geometry
type) or blocks (if complex, such as polygons with holes or collections).
Some options are available to control the output generated. They are
described in the following paragraphs.
GET requests format_options
------------------------------------------------------------------------------
The following format_options are supported:
1) version: (number) creates a DXF in the specified version format
2) asblock: (true/false) if true, all geometries are written as blocks
and then inserted as entities. If false, simple geometries are directly
written as entities.
3) colors: (comma delimited list of numbers): colors to be used for the
DXF layers, in sequence. If layers are more than the specified colors, they
will be reused many times. A set of default colors is used if the option is
not used. Colors are AutoCad color numbers (7=white, etc.).
4) ltypes: (comma delimited list of line type descriptors): line types
to be used for the DXF layers, in sequence. If layers are more than
the specified line types, they will be reused many times. If not specified,
all layers will be given a solid, continuous line type. A descriptor
has the following format: <name>!<repeatable pattern>[!<base length>], where
<name> is the name assigned to the line type, <base length> (optional)
is a real number that tells how long is each part of the line pattern
(defaults to 0.125), and <repeatable pattern> is a visual description
of the repeatable part of the line pattern, as a sequence of - (solid line),
* (dot) and _ (empty space). For example a dash-dot pattern would be expressed
as --_*_.
5) layers: (comma delimited list of strings) names to be assigned to
the DXF layers. If specified, must contain a name for each requested
query. By default a standard name will be assigned to layers.
POST options
------------------------------------------------------------------------------
Unfortunately, it's not currently possibile to use format_options in POST
requests. The only thing we chose to implement is the layers options, via
the handle attribute of Query attributes. So, if specified, the layer
of a Query will be named as its handle attribute.
The handle attribute of the GetFeature tag can also be used to override
the name of the file produced.