# Insert table at point (10,10,0) table = acad.model.AddTable(APoint(10, 10), table_height, table_width, 5, # row height 20) # column width
;; Create table (sqlite:exec db "CREATE TABLE IF NOT EXISTS attributes (block_name TEXT, tag TEXT, value TEXT)") sqlite autocad
# Generate MText report text = "WEEKLY REPORT\n" text += f"Generated: datetime.now()\n" text += "-" * 50 + "\n" # Insert table at point (10,10,0) table = acad
# Get weekly changes cursor.execute(""" SELECT date, COUNT(*) FROM changes WHERE date >= date('now', '-7 days') GROUP BY date """) # Insert table at point (10
This approach gives you flexible reporting from SQLite directly within AutoCAD, whether you need simple data extraction or complex formatted reports with calculations and summaries.
doc.ModelSpace.AddMText(APoint(10, 10), 100, text) conn.close() -- Formatted output .output report.html SELECT '<tr><td>' || block_name || '</td><td>' || COUNT(*) || '</td></tr>' as html_row FROM attributes GROUP BY block_name; Quick Setup Commands: # Install SQLite ODBC (Windows) sqliteodbc.exe /quiet Test database connection sqlite3 project.db "SELECT 'Connection OK';" Export to CSV for AutoCAD sqlite3 project.db -csv -header "SELECT * FROM data" > data.csv Import CSV into AutoCAD table Use DATAEXTRACTION command