Skill detail

cad-to-data

Extracts structured construction and BIM data from CAD files.

MatchDirectReviewed for construction
Sourcedatadrivenconstruction/ddc_skills_for_ai_agents_in_constructionExternal source
Reported installs232Popularity signal only

Inspect before use

Automated review checks relevance, not safety or endorsement. Read the source instructions before using this skill.

Saved source preview

SKILL.md

The saved excerpt is a snapshot from review. The external source remains the complete and most current version.

---
name: "cad-to-data"
description: "Convert CAD/BIM files to structured data. Extract element data from Revit, IFC, DWG, DGN files."
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw":{"emoji":"🗂️","os":["darwin","linux","win32"],"homepage":"https://datadrivenconstruction.io","requires":{"bins":["python3"]}}}
---

# CAD To Data

## Overview

Based on DDC methodology (Chapter 2.4), this skill converts CAD and BIM files to structured data, extracting element properties, quantities, and relationships from Revit, IFC, DWG, and DGN files.

**Book Reference:** "Преобразование данных в структурированную форму" / "Data Transformation to Structured Form"

## Quick Start

```python
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Dict, Optional, Any, Tuple, Generator
from datetime import datetime
import json

class CADFormat(Enum):
    """Supported CAD/BIM formats"""
    IFC = "ifc"
    RVT = "rvt"
    DWG = "dwg"
    DXF = "dxf"
    DGN = "dgn"
    NWD = "nwd"
    STEP = "step"

class ElementCategory(Enum):
    """BIM element categories"""
    WALL = "wall"
    FLOOR = "floor"
    ROOF = "roof"
    CEILING = "ceiling"
    DOOR = "door"
    WINDOW = "window"
    COLUMN = "column"
    BEAM = "beam"
    STAIR = "stair"
    RAMP = "ramp"
    FURNITURE = "furniture"
    EQUIPMENT = "equipment"
    PIPE = "pipe"
    DUCT = "duct"
    CABLE_TRAY = "cable_tray"
    SPACE = "space"
    GENERIC = "generic"

@dataclass
class Point3D:
    """3D point"""
    x: float
    y: float
    z: float

@dataclass
class BoundingBox3D:
    """3D bounding box"""
    min_point: Point3D
    max_point: Point3D

    @property
    def width(self) -> float:
        return abs(self.max_point.x - self.min_point.x)

    @property
    def depth(self) -> float:
        return abs(self.max_point.y - self.min_point.y)

    @property
    def height(self) -> float:
        return abs(self.max_point.z - self.min_point.z)

    @property
    def volume(self) -> float:
        return self.width * self.depth * self.height

@dataclass
class MaterialInfo:
    """Material information"""
    name: str
    category: str
    color: Optional[str] = None
    area: float = 0.0
    volume: float = 0.0
    properties: Dict[str, Any] = field(default_factory=dict)

@dataclass
class CADElement:
    """Extracted CAD/BIM element"""
    id: str
    guid: str
    name: str
    category: ElementCategory
    type_name: str
    level: Optional[str] = None
    bounding_box: Optional[BoundingBox3D] = None
    properties: Dict[str, Any] = field(default_factory=dict)
    quantities: Dict[str, float] = field(default_factory=dict)
    materials: List[MaterialInfo] = field(default_factory=list)
    relationships: Dict[str, List[str]] = field(default_factory=dict)

@dataclass
class CADLayer:
    """CAD layer information"""
    name: str
    color: Optional[str] = None
    line_type: Optional[str] = None
    visible: bool = True
    element_count: int = 0

@dataclass
class CADExtractionResult:
    """Result of CAD extraction"""
    file_path: str
    file_format: CADFormat
    elements: List[CADElement]
    layers: List[CADLayer]
    levels: List[str]
    total_elements: int
    categories: Dict[str, int]
    extraction_time: float
    metadata: Dict[str, Any] = field(default_factory=dict)


class IFCExtractor:
    """Extract data from IFC files"""

    def __init__(self):
        self.schema_version = "IFC4"
        self.element_mapping = self._build_element_mapping()

    def _build_element_mapping(self) -> Dict[str, ElementCategory]:
        """Map IFC types to categories"""
        return {
            "IfcWall": ElementCategory.WALL,
            "IfcWallStandardCase": ElementCategory.WALL,
            "IfcSlab": ElementCategory.FLOOR,
            "IfcRoof": ElementCategory.ROOF,
            "IfcCeiling": ElementCategory.CEILING,
            "IfcDoor": ElementCategory.DOOR,
            "IfcWindow": ElementCategory.WINDOW,
            "IfcColumn": 
Read the full source on GitHub (opens external page)
Context

Related work