S-CANVAS (Saman Corp.) — DXF + DEM + AI 기반 3D 조감도 생성 엔진. ~24k LOC Python (scanvas_maker.py 7072 LOC GUI + 구조물 파서/빌더 다수). 이 커밋은 7-iter cleanup이 적용된 상태로 import: - F821 8 + B023 6: 비동기 lambda + except/loop 변수 캡처 NameError (Py3.13에서 reproduce 확인된 진짜 버그) - RUF012 4 + RUF013 1: ClassVar / implicit Optional 명시화 - F811/B905/B904/F401/F841/W293/F541/UP/SIM/RUF/PLR 700+ cleanup/modernization 신규 파일: - ruff.toml: target=py313, Korean unicode/저자 스타일/도메인 복잡도 무력화 - requirements-py313.txt: pyproj>=3.7, scipy>=1.14, numpy>=2.0.2 (Py3.13 wheel) - .gitignore: gcp-key.json, 캐시, 백업, 생성 이미지 제외 검증: ruff 0 errors, py_compile 0 errors, import 33/33 OK on Py3.13.13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
import ezdxf
|
|
import numpy as np
|
|
|
|
def analyze_dxf(filepath):
|
|
print(f"Analyzing: {filepath}")
|
|
doc = ezdxf.readfile(filepath)
|
|
msp = doc.modelspace()
|
|
|
|
points = []
|
|
|
|
# 1. LWPOLYLINE, POLYLINE
|
|
for entity in msp.query('LWPOLYLINE POLYLINE'):
|
|
elevation = 0
|
|
if hasattr(entity, 'dxf'):
|
|
elevation = entity.dxf.elevation if hasattr(entity.dxf, 'elevation') else 0
|
|
|
|
for p in entity.get_points():
|
|
if len(p) >= 3:
|
|
points.append((p[0], p[1], p[2]))
|
|
else:
|
|
points.append((p[0], p[1], elevation))
|
|
|
|
# 2. LINE
|
|
for entity in msp.query('LINE'):
|
|
points.append(entity.dxf.start)
|
|
points.append(entity.dxf.end)
|
|
|
|
if not points:
|
|
print("No points found!")
|
|
return
|
|
|
|
pts = np.array(points)
|
|
min_vals = np.min(pts, axis=0)
|
|
max_vals = np.max(pts, axis=0)
|
|
ranges = max_vals - min_vals
|
|
|
|
print("\n[Statistics]")
|
|
print(f"Total points: {len(pts)}")
|
|
print(f"X: {min_vals[0]:.2f} to {max_vals[0]:.2f} (Range: {ranges[0]:.2f})")
|
|
print(f"Y: {min_vals[1]:.2f} to {max_vals[1]:.2f} (Range: {ranges[1]:.2f})")
|
|
print(f"Z: {min_vals[2]:.2f} to {max_vals[2]:.2f} (Range: {ranges[2]:.2f})")
|
|
|
|
# Ratio
|
|
if ranges[0] > 0 and ranges[1] > 0:
|
|
xy_avg_range = (ranges[0] + ranges[1]) / 2
|
|
z_ratio = (ranges[2] / xy_avg_range) * 100
|
|
print(f"Z-Ratio to XY: {z_ratio:.4f}%")
|
|
if z_ratio < 0.1:
|
|
print("WARNING: Z-range is extremely small compared to XY. Vertical exaggeration is required.")
|
|
|
|
if __name__ == "__main__":
|
|
analyze_dxf('사연댐 전체계획 평면도_contour.dxf')
|