
16538
make a plugin for cad software
Prompt
You are a Senior Software Architect and CAD/BIM Expert. I am building a hybrid, bare-metal CAD plugin ecosystem called "165-38". This is not a standard plugin; it is an "Anti-AI, Craft-First, Offline-First" architecture designed to eventually become a standalone modeling application. Here is the complete blueprint of the 165-38 Architecture: 1. CORE PHILOSOPHY & AESTHETICS: - Anti-AI / Anti-Automatic: User drawings are manual craft; automation is secondary. - "On Old Mind View": 1970s Bell Labs aesthetic (BEFLIX, dithering, vector CRT) mixed with 2000s Dreamcore/Y2K UI, packaged as an Indie "Patch" editor feel. - Offline-First: Must work without internet. Uses CRDTs and local SQLite for P2P asset sharing via LAN/mDNS and Sneakernet. 2. ARCHITECTURE STACK: - Heavy/Core Layer (C++): Handles 1970s rendering (BEFLIX mosaic, ASCII, scanlines), geometry processing, and LLVM bytecode execution. - Middle/Data Layer (C# .NET for AutoCAD, Ruby for SketchUp): Handles Live Observers (ObjectAppended/ObjectErased), BIM metadata storage (XData/AttributeDictionaries), and auto-renumbering. - UI/Workflow Layer (AutoLISP + DCL): Used for rapid, lightweight UI (Etiket Manager, Tag Editor, Array logic) because WinForms in C# is too heavy and prone to JIT errors. 3. DATA PERSISTENCE & LIVE MODEL: - Settings: Stored in DWG's Named Objects Dictionary (NOD). - Identity: Blocks are tagged with XData "16538_ETIKET". - Etiket System: Arrayed title blocks (A3/A4) with attributes starting with "16540_". Features Auto-Renumbering on Copy/Erase. - Tag Editor: Global sync tool to sync attribute values across all blocks, with a "Standing Alone" (immune) checkbox per instance. 4. CUSTOM FILE FORMAT (`.165`): - A chunk-based binary container. - Sections: META (metadata), SCNG (Scene Graph), GEOM (Geometry), RNDM (Render State), CODE (LLVM IR Bytecode for live model logic), TOC (Table of Contents). - Designed to be an "Active Container" that can be executed by the C++ engine later. 5. UTILITY TOOL (mousesim16538): - A standalone C# Console App using `user32.dll` (GetAsyncKeyState, mouse_event, keybd_event). - Maps Numpad to mouse movement/clicks. - Features "Multi-Hotkey Combinations" (e.g., Numpad Divide triggers Shift + Middle Click simultaneously for 3D Orbiting in SketchUp/Revit/Enscape). TASK: Analyze this architecture. 1. Are there any potential bottlenecks or logic flaws in using LISP/DCL for UI while C# handles the DB Observers? 2. Propose the exact C++ pseudocode for reading the `.165` file format chunk table (TOC) and executing the `CODE` chunk via LLVM JIT. 3. How would you implement the CRDT logic for the offline P2P Asset Library sync using SQLite? Provide concrete code examples and architectural critiques.