Generating DXF files, problems with extrusion direction

I am writing a programme to create DXF files for import into autocad. I need to create a complex three dimensional object with solid colour.
I have a mesh for the shape I want to make, but I am defeated by the way that the dxf file format represents world and object co-ordinates. Can anyone tell me how I translate from a set of (x,y,z) coordinates into the numbers for the codes (10,20,30 etc .... 210,220,230) necessary for the SOLID object.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.