File size: 4,114 Bytes
e305028 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
import streamlit as st
import numpy as np
import pandas as pd
from datetime import datetime
class BIMAnalyzer:
"""محلل نماذج BIM المتقدم"""
def __init__(self):
self.supported_formats = ['.ifc', '.rvt', '.nwd', '.dwg']
def analyze_bim_model(self, file):
"""تحليل نموذج BIM"""
try:
# تحليل المكونات
components = self._analyze_components(file)
# تحليل التكاليف
costs = self._analyze_costs(components)
# تحليل التعارضات
clashes = self._analyze_clashes(file)
return {
'components': components,
'costs': costs,
'clashes': clashes,
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
}
except Exception as e:
return {'error': str(e)}
def _analyze_components(self, file):
"""تحليل مكونات النموذج"""
return {
'structural': {
'columns': {'count': 120, 'volume': 450.5},
'beams': {'count': 350, 'volume': 680.2},
'slabs': {'count': 45, 'volume': 1200.8}
},
'architectural': {
'walls': {'count': 280, 'area': 3500.6},
'windows': {'count': 150, 'area': 450.3},
'doors': {'count': 95, 'area': 220.5}
},
'mep': {
'hvac': {'length': 2800.5, 'units': 35},
'plumbing': {'length': 1500.2, 'fixtures': 180},
'electrical': {'length': 3500.8, 'fixtures': 420}
}
}
def _analyze_costs(self, components):
"""تحليل التكاليف بناءً على المكونات"""
return {
'structural': 2500000,
'architectural': 1800000,
'mep': 1200000,
'total': 5500000
}
def _analyze_clashes(self, file):
"""تحليل التعارضات في النموذج"""
return {
'critical': 5,
'major': 12,
'minor': 28,
'locations': [
{'level': 'Ground Floor', 'count': 15},
{'level': 'First Floor', 'count': 18},
{'level': 'Second Floor', 'count': 12}
]
}
def render_analysis(self, analysis_results):
"""عرض نتائج التحليل في واجهة المستخدم"""
st.header("تحليل نموذج BIM")
# عرض ملخص المكونات
st.subheader("ملخص المكونات")
components = analysis_results['components']
col1, col2, col3 = st.columns(3)
with col1:
st.metric("عدد الأعمدة", components['structural']['columns']['count'])
with col2:
st.metric("عدد الجسور", components['structural']['beams']['count'])
with col3:
st.metric("عدد البلاطات", components['structural']['slabs']['count'])
# عرض التكاليف
st.subheader("تحليل التكاليف")
costs = analysis_results['costs']
cost_data = pd.DataFrame({
'القسم': ['الهيكل الإنشائي', 'المعماري', 'الكهروميكانيك'],
'التكلفة': [costs['structural'], costs['architectural'], costs['mep']]
})
st.bar_chart(cost_data.set_index('القسم'))
# عرض التعارضات
st.subheader("تحليل التعارضات")
clashes = analysis_results['clashes']
col1, col2, col3 = st.columns(3)
with col1:
st.metric("تعارضات حرجة", clashes['critical'], delta="يجب المعالجة فوراً")
with col2:
st.metric("تعارضات رئيسية", clashes['major'])
with col3:
st.metric("تعارضات ثانوية", clashes['minor'])
|