excel-to-bim
Push Excel data back to BIM models. Update parameters, properties, and attributes from structured spreadsheets.
What this skill does
# Excel to BIM Update
## Business Case
### Problem Statement
After extracting BIM data to Excel and enriching it (cost codes, classifications, custom data):
- Changes need to flow back to the BIM model
- Manual re-entry is error-prone
- Updates must match by element ID
### Solution
Push Excel data back to BIM models, updating element parameters and properties from spreadsheet changes.
### Business Value
- **Bi-directional workflow** - BIM → Excel → BIM
- **Bulk updates** - Change thousands of parameters
- **Data enrichment** - Add classifications, codes, costs
- **Consistency** - Spreadsheet as single source of truth
## Technical Implementation
### Workflow
```
BIM Model (Revit/IFC) → Excel Export → Data Enrichment → Excel Update → BIM Model
```
### Python Implementation
```python
import pandas as pd
from pathlib import Path
from typing import Dict, Any, List, Optional, Tuple
from dataclasses import dataclass, field
from enum import Enum
import json
class UpdateType(Enum):
"""Type of BIM parameter update."""
TEXT = "text"
NUMBER = "number"
BOOLEAN = "boolean"
ELEMENT_ID = "element_id"
@dataclass
class ParameterMapping:
"""Mapping between Excel column and BIM parameter."""
excel_column: str
bim_parameter: str
update_type: UpdateType
transform: Optional[str] = None # Optional transformation
@dataclass
class UpdateResult:
"""Result of single element update."""
element_id: str
parameters_updated: List[str]
success: bool
error: Optional[str] = None
@dataclass
class BatchUpdateResult:
"""Result of batch update operation."""
total_elements: int
updated: int
failed: int
skipped: int
results: List[UpdateResult]
class ExcelToBIMUpdater:
"""Update BIM models from Excel data."""
# Standard ID column names
ID_COLUMNS = ['ElementId', 'GlobalId', 'GUID', 'Id', 'UniqueId']
def __init__(self):
self.mappings: List[ParameterMapping] = []
def add_mapping(self, excel_col: str, bim_param: str,
update_type: UpdateType = UpdateType.TEXT):
"""Add column to parameter mapping."""
self.mappings.append(ParameterMapping(
excel_column=excel_col,
bim_parameter=bim_param,
update_type=update_type
))
def load_excel(self, file_path: str,
sheet_name: str = None) -> pd.DataFrame:
"""Load Excel data for update."""
if sheet_name:
return pd.read_excel(file_path, sheet_name=sheet_name)
return pd.read_excel(file_path)
def detect_id_column(self, df: pd.DataFrame) -> Optional[str]:
"""Detect element ID column in DataFrame."""
for col in self.ID_COLUMNS:
if col in df.columns:
return col
# Case-insensitive check
for df_col in df.columns:
if df_col.lower() == col.lower():
return df_col
return None
def prepare_updates(self, df: pd.DataFrame,
id_column: str = None) -> List[Dict[str, Any]]:
"""Prepare update instructions from DataFrame."""
if id_column is None:
id_column = self.detect_id_column(df)
if id_column is None:
raise ValueError("Cannot detect ID column")
updates = []
for _, row in df.iterrows():
element_id = str(row[id_column])
params = {}
for mapping in self.mappings:
if mapping.excel_column in df.columns:
value = row[mapping.excel_column]
# Convert value based on type
if mapping.update_type == UpdateType.NUMBER:
value = float(value) if pd.notna(value) else 0
elif mapping.update_type == UpdateType.BOOLEAN:
value = bool(value) if pd.notna(value) else False
elif mapping.update_type == UpdateType.TEXT:
value = str(value) if pd.notna(value) else ""
params[mapping.bim_parameter] = value
if params:
updates.append({
'element_id': element_id,
'parameters': params
})
return updates
def generate_dynamo_script(self, updates: List[Dict],
output_path: str) -> str:
"""Generate Dynamo script for Revit updates."""
# Generate Python code for Dynamo
script = '''
# Dynamo Python Script for Revit Parameter Updates
# Generated by DDC Excel-to-BIM
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
# Update data
updates = '''
script += json.dumps(updates, indent=2)
script += '''
# Apply updates
TransactionManager.Instance.EnsureInTransaction(doc)
results = []
for update in updates:
try:
element_id = int(update['element_id'])
element = doc.GetElement(ElementId(element_id))
if element:
for param_name, value in update['parameters'].items():
param = element.LookupParameter(param_name)
if param and not param.IsReadOnly:
if isinstance(value, (int, float)):
param.Set(float(value))
elif isinstance(value, bool):
param.Set(1 if value else 0)
else:
param.Set(str(value))
results.append({'id': element_id, 'status': 'success'})
else:
results.append({'id': element_id, 'status': 'not found'})
except Exception as e:
results.append({'id': update['element_id'], 'status': str(e)})
TransactionManager.Instance.TransactionTaskDone()
OUT = results
'''
with open(output_path, 'w') as f:
f.write(script)
return output_path
def generate_ifc_updates(self, updates: List[Dict],
original_ifc: str,
output_ifc: str) -> str:
"""Generate updated IFC file (requires IfcOpenShell)."""
try:
import ifcopenshell
except ImportError:
raise ImportError("IfcOpenShell required for IFC updates")
ifc = ifcopenshell.open(original_ifc)
for update in updates:
guid = update['element_id']
# Find element by GUID
element = ifc.by_guid(guid)
if not element:
continue
# Update properties
for param_name, value in update['parameters'].items():
# This is simplified - actual IFC property handling is more complex
# Would need to find/create property sets and properties
pass
ifc.write(output_ifc)
return output_ifc
def generate_update_report(self, original_df: pd.DataFrame,
updates: List[Dict],
output_path: str) -> str:
"""Generate report of planned updates."""
report_data = []
for update in updates:
for param, value in update['parameters'].items():
report_data.append({
'element_id': update['element_id'],
'parameter': param,
'new_value': value
})
report_df = pd.DataFrame(report_data)
report_df.to_excel(output_path, index=False)
return output_path
class RevitExcelUpdater(ExcelToBIMUpdater):
"""Specialized updater for Revit via ImportExcelToRevit."""
def __init__(self, tool_path: str = "ImportExcelToRevit.exe"):
super().__init__()
self.tool_path = Path(tool_path)
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.