Update sample.txt
Browse files- sample.txt +41 -20
sample.txt
CHANGED
|
@@ -1,24 +1,45 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
• Automated Flags: The system should perform basic cross-drawing checks (e.g., verifying that if relay 50-L1 is meant to trip breaker 52-L1, the connection is correctly reflected in the schematics) and flag discrepancies for human review.
|
| 12 |
-
|
| 13 |
-
Phase 3: AI-Driven Generative Design & Compliance
|
| 14 |
-
• Generative AI: Utilizing AI trained on historical data and protection philosophies to infer and generate project-specific elements (like close/trip coils).
|
| 15 |
-
• Audit Trail: Crucial requirement. The system must generate a clear "decision tree" showing how the software arrived at its conclusions. Their legal team requires this to prove responsible charge for the signing engineer.
|
| 16 |
-
|
| 17 |
-
Phase 4: Ancillary Data Extraction (Future Tools)
|
| 18 |
-
• Automated Cable Lists: Once the core integration is stable, the system should scan the schematics using OCR/Vision AI to extract cable loops, color codes, and connections, automatically populating this data into an Excel spreadsheet.
|
| 19 |
-
|
| 20 |
-
Requested Sample Files As requested during our internal discussions, I have attached the sample files so you can visualize the required data flow. Please find the following attached:
|
| 21 |
-
• AutoCAD files
|
| 22 |
-
• PDF Files
|
| 23 |
-
• Equipment BOM (303.01)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ezdxf
|
| 2 |
+
from collections import Counter
|
| 3 |
|
| 4 |
+
def count_components_with_details(file_path):
|
| 5 |
+
try:
|
| 6 |
+
doc = ezdxf.readfile(file_path)
|
| 7 |
+
inventory = []
|
| 8 |
+
|
| 9 |
+
for layout in doc.layouts:
|
| 10 |
+
for insert in layout.query('INSERT'):
|
| 11 |
+
name = insert.dxf.name
|
| 12 |
+
|
| 13 |
+
# Filter out system/meta blocks
|
| 14 |
+
if name.startswith('*') or name == 'WD_M' or 'TB' in name.upper() or 'TTLB' in name.upper():
|
| 15 |
+
continue
|
| 16 |
+
|
| 17 |
+
# 1. GET THE PICK POINT (Insertion Point)
|
| 18 |
+
# Returns a Vector object (x, y, z)
|
| 19 |
+
ip = insert.dxf.insert
|
| 20 |
+
pick_point = f"({ip.x:.2f}, {ip.y:.2f})"
|
| 21 |
+
|
| 22 |
+
# 2. Extract attributes
|
| 23 |
+
raw_attribs = {att.dxf.tag: att.dxf.text for att in insert.attribs if att.dxf.text.strip()}
|
| 24 |
+
attr_str = " | ".join([f"{k}: {v}" for k, v in raw_attribs.items()])
|
| 25 |
+
if not attr_str:
|
| 26 |
+
attr_str = "(No Attributes)"
|
| 27 |
+
|
| 28 |
+
# We store the pick point along with name and attributes
|
| 29 |
+
inventory.append((name, pick_point, attr_str))
|
| 30 |
|
| 31 |
+
print(f"=== DETAILED INVENTORY FOR: {file_path} ===")
|
| 32 |
+
print(f"TOTAL COMPONENTS: {len(inventory)}")
|
| 33 |
+
print("-" * 120)
|
| 34 |
+
print(f"{'Block Name':<20} | {'Pick Point (X,Y)':<18} | {'Attribute Details'}")
|
| 35 |
+
print("-" * 120)
|
| 36 |
+
|
| 37 |
+
for name, p_point, attrs in inventory:
|
| 38 |
+
print(f"{name:<20} | {p_point:<18} | {attrs}")
|
| 39 |
|
| 40 |
+
except Exception as e:
|
| 41 |
+
print(f"Error: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
# Usage
|
| 44 |
+
file_path = r"C:\Users\navinshrivatsan\Desktop\dxf_one_line_drawings\NRE-EC-101.0.dxf"
|
| 45 |
+
count_components_with_details(file_path)
|