Metadata-Version: 2.4
Name: automason
Version: 1.2.0
Summary: Automated building generation for Blender
Author: Mark Holcroft
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy
Provides-Extra: blender
Requires-Dist: bpy==5.1.2; extra == "blender"

# Automason Docker Container

This Docker container allows you to run the Automason building generation tool in a containerized environment. It includes Blender 5.1.2 and all necessary dependencies to generate 3D building models with stone cladding.

## Building the Container

From the `src/docker` directory, run:

```bash
docker build --platform linux/x86_64 -t automason .
```

Or use the build script:

```bash
./build.sh
```

## Usage

### Basic Usage

Run with the default configuration:

```bash
docker run --platform linux/x86_64 \
  -v $(pwd)/output:/home/automason/automason/output \
  automason
```

### Using a Custom Configuration

Create your own JSON configuration file and mount it into the container:

```bash
docker run --platform linux/x86_64 \
  -v $(pwd)/my-config.json:/home/automason/automason/src/python/my-config.json \
  -v $(pwd)/output:/home/automason/automason/output \
  automason --config my-config.json
```

### Skip Stone Cladding

To generate buildings without stone cladding (faster execution):

```bash
docker run --platform linux/x86_64 \
  -v $(pwd)/output:/home/automason/automason/output \
  automason --no-clad
```

### Custom Output Directory

Specify a different output directory inside the container:

```bash
docker run --platform linux/x86_64 \
  -v $(pwd)/output:/home/automason/custom-output \
  automason --output-dir /home/automason/custom-output
```

## Command Line Options

- `--config CONFIG_FILE`: Path to JSON configuration file (default: `automason.json`)
- `--output-dir OUTPUT_DIR`: Directory for output files (default: `/home/automason/automason/output`)
- `--no-clad`: Skip stone cladding application for faster execution
- `--help`: Show help message

## Configuration File Format

The configuration file should be in JSON format. See `example-config.json` for a complete example:

```json
{
  "template": "../blender/Automason.blend",
  "output": "../../output/example.blend",
  "components": [
    {
      "collection": "Collection",
      "name": "simple_house",
      "faces": ["X+", "X-", "Y+", "Y-"],
      "x_pos": 0, "y_pos": 0, "z_pos": 0,
      "x_size": 4, "y_size": 3, "z_size": 2.5,
      "spacing_divisor": 0.5,
      "wall_thickness": 0.4,
      "roof": {
        "height": 1.0,
        "gabled": true,
        "main_axis": "X",
        "add_beams": true
      },
      "stone": {
        "density": 0.995,
        "minx": 0.08, "maxx": 0.75,
        "miny": 0.08, "maxy": 0.75,
        "minz": 0.05, "maxz": 0.18,
        "gap": 0.001,
        "swell_factor": 0.05
      },
      "openings": [
        {
          "type": "door",
          "name": "front_door",
          "face": "Y+",
          "width": 0.8,
          "height": 1.8
        }
      ]
    }
  ]
}
```

## Output

The container will generate a `.blend` file in the specified output directory. This file can be opened in Blender to view and further modify the generated building model.

## Volume Mounts

- Mount your configuration file to `/home/automason/automason/src/python/your-config.json`
- Mount your output directory to `/home/automason/automason/output` (or your custom output path)

## Examples

### Generate a Simple House

```bash
# Using the included example configuration
docker run --platform linux/x86_64 \
  -v $(pwd)/output:/home/automason/automason/output \
  automason --config example-config.json

# The generated file will be available at ./output/example.blend
```

### Interactive Mode

To explore the container interactively:

```bash
docker run --platform linux/x86_64 -it \
  -v $(pwd)/output:/home/automason/automason/output \
  --entrypoint /bin/bash \
  automason
```

Then inside the container:

```bash
cd /home/automason/automason/src/python
/opt/blender/blender --background --python automason.py -- automason.json
```

## Testing

Run the test script to verify everything works:

```bash
./test.sh
```

## Troubleshooting

1. **Permission Issues**: Make sure the output directory is writable
2. **Configuration Errors**: Check that your JSON configuration is valid
3. **Missing Files**: Ensure all required STL files are present in the container
4. **Memory Issues**: Complex models with stone cladding require significant memory

## Container Structure

- Blender 5.1.2 installed in `/opt/blender/`
- Automason scripts in `/home/automason/automason/src/python/`
- STL stone models in `/home/automason/automason/src/blender/`
- Output directory at `/home/automason/automason/output/`
- Template file at `/home/automason/automason/src/blender/Automason.blend`
