DEV Community

Om Prakash
Om Prakash

Posted on • Originally published at pixelapi.dev

Vastu Compliance API — score a floor plan and get an AutoCAD DXF on the same call

Vastu Compliance API — score a floor plan and get an AutoCAD DXF on the same call

Most architects in India hit the same conversation on every residential project. The floor plan is laid out for light, plumbing runs, parking. Then the client (or the client's family) asks the question: is this Vastu compliant? What follows is usually a couple of hours of someone pointing at a printed plan, a pencil, and a polite negotiation. There are very few tools that let you check this programmatically — most of what's online is "name your facing direction and we'll tell you whether to put the kitchen in the south-east", which is fine if you only own one room and you've also forgotten which side of the plot you're standing on.

We just shipped something more useful. POST /v1/vastu/analyze takes a structured description of your floor plan and returns a per-rule report against twenty-one traditional Vastu Shastra rules. POST /v1/vastu/export-dxf takes the same payload and returns an AutoCAD-openable DXF file with the rooms colour-coded by compliance, the 3×3 zone grid drawn with each cell labelled in cardinal + Sanskrit names (NE / Ishanya, SE / Agneya, SW / Nairutya, NW / Vayavya, plus the central Brahmasthan), and a printable Issues + Recommendations block in the right margin. Both endpoints are pure CPU. No GPU credits.

Why this is different

There's a reason most of the existing Vastu "tools" online are toys. Real Vastu rules are about positions, not labels. Saying "kitchen south-east" is not the same as saying "the centroid of the kitchen rectangle is in the bottom-right ninth of the plot, and that ninth doesn't overlap the central Brahmasthan cell." If you want output that can stand up to an architect's scrutiny, you have to do the geometry.

This API does the geometry. You give it a plot rectangle (width × depth in feet), a list of rooms as (name, x, y, w, h) rectangles with the SW corner as origin, and optional points for the main entrance, water tank, and septic tank. The engine builds the 3×3 zone grid, figures out which zone each room's centroid sits in, runs every rule, and returns a severity-weighted score on 0–100.

Each rule has a severity (critical / high / medium / low) that determines its weight in the final score. Putting a kitchen in the NE zone is a critical fail — it directly contradicts the Ishanya zone's water-and-light meaning. Putting the dining room in the south is a low-severity warning — it's not where you'd ideally place it, but it doesn't break anything.

The full rule list, with rule_id, severity, and one-line description, is on the docs page. The whole engine is also pure-Python with zero non-stdlib dependencies, which means it's deterministic — same input, same output, no model variance. Forty-six unit tests cover the zone math, every individual rule, the input parser, and the DXF exporter's structural validity. Every deploy must pass all forty-six.

What you submit

A single JSON object. All distances in feet. Origin at the south-west corner of the plot.

{
  "facing": "north",
  "plot": {"width_ft": 40, "depth_ft": 60},
  "rooms": [
    {"name": "kitchen",        "x": 30, "y": 3,  "w": 8,  "h": 12},
    {"name": "master_bedroom", "x": 2,  "y": 3,  "w": 13, "h": 12},
    {"name": "bedroom",        "x": 2,  "y": 40, "w": 13, "h": 15},
    {"name": "pooja_room",     "x": 32, "y": 48, "w": 6,  "h": 8},
    {"name": "toilet",         "x": 2,  "y": 50, "w": 6,  "h": 6},
    {"name": "living_room",    "x": 18, "y": 40, "w": 18, "h": 15}
  ],
  "main_entrance": {"x": 20, "y": 58},
  "features": {"water_tank": {"x": 36, "y": 56}}
}
Enter fullscreen mode Exit fullscreen mode

The room names that map to specific rules: kitchen, dining_room, living_room, drawing_room, master_bedroom, bedroom, children_bedroom, guest_room, bathroom, toilet, pooja_room, prayer_room, study, office, home_office, storage, store_room, garage, staircase. Anything else is accepted but won't trigger zone-specific rules — it'll still count toward the centre-of-plot occupancy check.

What you get back

curl -X POST https://api.pixelapi.dev/v1/vastu/analyze \
  -H "Content-Type: application/json" \
  -d @my-plan.json
Enter fullscreen mode Exit fullscreen mode
{
  "score": 100.0,
  "bucket": "excellent",
  "summary": "Strong Vastu alignment overall.",
  "rule_counts": {"pass": 14, "fail": 0, "warning": 0, "na": 7},
  "findings": [
    {
      "rule_id": "kitchen_se",
      "name": "Kitchen in Southeast (Agneya)",
      "status": "pass",
      "severity": "high",
      "detail": "Kitchen is in SE — ideal Agneya placement (fire element).",
      "suggestion": ""
    },
    {
      "rule_id": "kitchen_not_ne",
      "name": "Kitchen NOT in Northeast",
      "status": "pass",
      "severity": "critical",
      "detail": "Kitchen is in SE, not NE — good.",
      "suggestion": ""
    }
    // ... 19 more entries
  ]
}
Enter fullscreen mode Exit fullscreen mode

The interesting field is findings — one entry per rule. When a rule fails or warns, the suggestion field carries a concrete fix:

Kitchen is in NW — acceptable alternative if SE not feasible.
suggestion: Move kitchen to SE if you can; NW is the second-best option.

Use this directly in a UI. Loop over findings, group by status, render the failures in red with their suggestion in italics underneath. The compliance review writes itself.

The DXF — the part that makes this useful for actual architects

If you want the same layout as a printable, editable plan, hit /v1/vastu/export-dxf with the same payload and you get back the file. R2010 format, decimal feet ($INSUNITS=2), opens in AutoCAD, DraftSight, LibreCAD, BricsCAD, and any other DXF-compatible CAD tool.

curl -X POST https://api.pixelapi.dev/v1/vastu/export-dxf \
  -H "Content-Type: application/json" \
  -d @my-plan.json \
  -o my-house.dxf
Enter fullscreen mode Exit fullscreen mode

The DXF carries a sensible layer structure so you can toggle bits on and off in the Layer Manager:

  • PLOT — outer plot boundary.
  • VASTU_ZONES — 3×3 dashed zone grid.
  • ZONE_LABELS — each cell labelled with cardinal + Sanskrit name.
  • ROOMS_PASS (green), ROOMS_WARN (yellow), ROOMS_FAIL (red), ROOMS_NA (white) — colour-coded room polylines so a glance tells you what to fix.
  • ROOM_LABELS — name + zone tag + status per room.
  • ENTRANCE — triangle marker pointing inward from the wall the door is on.
  • FEATURES — water tank and septic tank as labelled circles.
  • REPORT — score, bucket, Issues list, Recommendations list, in the right margin so the compliance summary prints on the same sheet.

I wrote tests for this part. Round-trip the DXF (write → read back → write again) and you should get an equivalent file with the same layers and same entity counts. We assert that. We also assert that every room polyline's bounding box matches the input Room rectangle within one foot — so the geometry actually round-trips.

Why we're shipping the rules engine separately from a floor-plan generator

If you've been following the Indian architecture-AI space, you know there are tools that promise to generate floor plans from text prompts. Most of them are wrappers around image diffusion models. They produce something that looks like a floor plan from across the room, but the labels are gibberish, the walls aren't to scale, and you can't export to DXF because there's no underlying vector representation — it's pixels all the way down.

We had a go at that earlier this month using one of the popular image generators. The output was, predictably, a watercolour render of a floor plan with garbled annotations. Beautiful for a marketing slide, useless for an architect.

So we did the boring thing instead: we wrote a real rules engine that takes structured input. It scores layouts deterministically, and it emits real CAD geometry. If you want to pair it with a generator, you can — anything that can output rectangles works as input. RPLAN-CGAN, HouseGAN++, your own CSV, your own pencil-on-graph-paper sketch transcribed by hand. The compliance check is the same.

Image-to-layout extraction (so you can upload a JPEG of a hand-drawn plan and have it parsed into the JSON shape) is on the roadmap. That's a separate piece — OCR plus room segmentation. We'll ship it when the parsing is reliable. In the meantime, structured input is what you'd be feeding any generator anyway.

Pricing

Free during beta. The rules engine is pure Python doing some arithmetic on rectangles — it costs nothing to run, so there's no credit deduction. Rate-limited to 30 requests / minute / IP, which is more than any reasonable architect's working session needs.

If you build something on top of it, please do let us know — support@pixelapi.dev. We'd especially like to hear about Vastu rules we missed (the engine is currently at twenty-one but the tradition has hundreds, prioritised differently across regions). Adding a rule is twenty lines of Python and a unit test.

Try it without writing code

Sign in to your dashboard at pixelapi.dev and click 🪔 Vastu Compliance in the left sidebar. There's a small editor with a sample 2BHK payload, an Analyze button that prints the per-rule findings inline, and a Download DXF button that gives you a fresh AutoCAD-openable file. No API key needed when you're using the dashboard.

Full API reference: pixelapi.dev/docs/vastu.html.
Step-by-step tutorial with curl/Python/JS: pixelapi.dev/tutorials/vastu-compliance.html.

Top comments (0)