Local RAG for CAD API: Overcoming Knowledge Gaps in Proprietary Interfaces
Hexagon
An engineer faced the need to automate tasks in Smart3D, but knowledge of the API was a bottleneck. He built a local RAG pipeline: decompiled libraries, extracted facts, enriched them via LLM, created embedding indices, and implemented an agent with verification — so the model generates code based solely on real API entities.
An author working with Hexagon's Smart3D (Intergraph Smart 3D) computer-aided design (CAD) system ran into an automation problem: knowledge of the proprietary application programming interface (API) was expensive and hard to come by, while public large language models (LLMs) kept hallucinating nonexistent methods due to a lack of training data. He decided to build a local retrieval-augmented generation (RAG) pipeline that extracts knowledge directly from the system's own libraries.
First, he decompiled the compiled Smart3D assemblies and wrote a parser to pull out method signatures, XML documentation, and facts from method bodies (calls, exceptions, objects created). Then, using a language model, he enriched this data—formulating usage scenarios and search prompts while strictly limiting himself to verified facts only. For embeddings, he chose the multilingual bge-m3 model, since engineers' queries come in both Russian and English. The chunks became entity cards containing the signature, description, facts, and prompts.
The result is an agent that uses vector search to find relevant entities, uses them as context to generate C# code, and verifies the output by referencing the source data. The system is already being used in a live project to speed up automation.
Source: Habr — хаб NLP —
original
