cad-to-data
БесплатноБез исполняемых скриптовНе проверенConvert CAD/BIM files to structured data. Extract element data from Revit, IFC, DWG, DGN files.
от datadrivenconstruction★ 461 звезда на GitHubОб этом скилле
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
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": ElementCategory.COLUMN,
"IfcBeam": ElementCategory.BEAM,
"IfcStair": ElementCategory.STAIR,
"IfcRamp": ElementCategory.RAMP,
"IfcFurnishingElement": ElementCategory.FURNITURE,
"IfcPipeSegment": ElementCategory.PIPE,
"IfcDuctSegment": ElementCategory.DUCT,
"IfcCableCarrierSegment": ElementCategory.CABLE_TRAY,
"IfcSpace": ElementCategory.SPACE,
}
def extract(
self,
file_path: str,
categories: Optional[List[ElementCategory]] = None
) -> CADExtractionResult:
"""
Extract data from IFC file.
Args:
file_path: Path to IFC file
categories: Optional filter for categories
Returns:
Extraction result
"""
start_time = datetime.now()
# In production, use ifcopenshell:
# import ifcopenshell
# ifc_file = ifcopenshell.open(file_path)
# Simulated extraction
elements = self._simulate_ifc_elements()
# Filter by category if specified
if categories:
elements = [e for e in elements if e.category in categories]
# Build category counts
category_counts = {}
for element in elements:
cat = element.category.value
Установить cad-to-data в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cad-to-data?
Convert CAD/BIM files to structured data. Extract element data from Revit, IFC, DWG, DGN files.
Как установить скилл cad-to-data?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cad-to-data запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic