Large language model driving type FMT automatic modeling method supporting MCP protocol
By embedding the Python interpreter in the FMT software and registering the modeling operation functions as Python callable scripts, combined with the MCP protocol, direct integration of large language models and FMT software is achieved, solving the problem of high modeling language requirements of FMT software and improving the automatic modeling capabilities.
Patent Information
- Application Number
- CN202510971551.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-09-23
AI Technical Summary
Existing FMT software has high modeling language requirements, high learning costs, limited automation interfaces, and lacks the ability to directly integrate and execute large language models with FMT software.
By embedding the Python interpreter into the FMT modeling software and registering the core modeling operation functions as Python callable scripts, and coordinating with the remote instruction format defined by the MCP protocol, a cross-language and cross-module modeling control link between the large language model and the FMT software is realized. The MCP protocol service module is constructed, and the large language model is used to identify user intentions and generate JSON commands to control the modeling operations of the FMT software.
It realizes the full-chain closed loop of natural language-script instructions-software operation behavior-real-time feedback, supports large language models to directly control the actual software modeling process, and greatly improves the automatic modeling capabilities.
Smart Images

Figure CN120688410A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of three-dimensional modeling and artificial intelligence control systems, and in particular to a large language model-driven FMT automatic modeling method supporting the MCP protocol, which enables a large language model to automatically control FMT software for CAD modeling through natural language scripts. Background Art
[0002] Fast Modeling Tools (FMT), a key support tool developed by a team from the University of Electronic Science and Technology of China for multi-physics design of traveling wave tubes, offers efficient 3D modeling capabilities. FMT uses an imperative modeling approach, describing the modeling process with Pascal-style statements, and automatically generates 3D structures in SAT format.
[0003] However, this approach requires users to master the modeling language, resulting in high learning costs and limited automated interfaces. Currently, proposals have been made to generate FMT commands using large language models (LLMs), but these approaches remain at the level of text generation, converting natural language to commands, and lack the ability to directly integrate and execute LLMs with FMT software. Summary of the Invention
[0004] In response to the above-mentioned problems or shortcomings, the present invention provides a large language model-driven FMT automatic modeling method that supports the MCP protocol. By embedding the Python interpreter into the FMT modeling software and registering the core modeling operation function as a Python callable script, in conjunction with the remote instruction format defined by the MCP (Model Control Protocol) protocol, a cross-language, cross-module modeling control link from the large language model to the FMT software is realized. Compared with the prior art, the present invention realizes a full-chain closed loop of natural language-script instruction-software operation behavior-real-time feedback, supports the large language model to directly control the actual software modeling process, and greatly improves the automatic modeling capability.
[0005] A large language model-driven FMT automatic modeling method supporting the MCP protocol, the specific steps are as follows:
[0006] Step 1. Embed the Python interpreter into the FMT software so that the FMT software can run Python script commands.
[0007] Step 2. Register the FMT modeling function as a Python script command
[0008] The modeling operation-related functions (implemented in C++) in the FMT software are encapsulated as a Python-callable bridge interface and registered in the custom module cppmodule so that it can be called by Python scripts.
[0009] Step 3. Build the MCP protocol service module
[0010] Based on Qt's TCP service functionality, we built a local listening MCP instruction receiving module, MCP Server. This module parses the JSON formatted instructions sent remotely by the Large Language Model (LLM), extracts the Python code in the code field, and executes it using PyRun_SimpleString.
[0011] Step 4. Large language model deployment and message generation
[0012] The large language model is mounted on a host platform that supports MCP tool calls. These platforms act as a bridge between natural language and control commands, responsible for identifying user intent, generating JSON commands that conform to the MCP protocol format, and sending the commands to the MCP server in the FMT software via a TCP connection.
[0013] Step 5. Command execution and echo
[0014] The MCP Server passes the received Python script commands to the Python interpreter for execution, triggering the modeling operation function. At the same time, the FMT software writes execution logs or error information back to the MCP Server, which then feeds back to the host platform.
[0015] Step 6. Host platform feedback large language model
[0016] After receiving the return result from the MCP Server, the Host platform embeds the result into the context for reference by the large language model. The large language model uses this to determine whether to proceed with the next instruction or display the modeling results to the user.
[0017] The beneficial effects of the present invention are as follows: the present invention proposes a large language model-driven FMT automatic modeling method that supports the MCP protocol. By embedding a Python interpreter into the FMT modeling software and registering the core modeling operation function as a Python callable script, in conjunction with the remote instruction format defined by the MCP (Model Control Protocol) protocol, the user describes the modeling intention through natural language; then the large language model is used to decompose the natural language input by the user according to the intention, generate a complete FMT modeling program, and automatically manipulate the FMT to complete the modeling operation; finally, a full-chain closed loop of natural language-script instruction-software operation behavior-real-time feedback is realized, supporting the large language model to directly control the actual software modeling process, thereby greatly improving the automatic modeling capability. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of the deployment process of the present invention;
[0019] Figure 2 The present invention complies with the JSON instruction format of the MCP protocol specification;
[0020] Figure 3 It is a workflow diagram of the present invention;
[0021] Figure 4 is a working example of an embodiment;
[0022] Figure 5 It is an FMT modeling program for generating a large language model of an embodiment;
[0023] Figure 6 Is an embodiment of the large language model operation FMT software by compiling Figure 5 A three-dimensional model generated by a modeling program. DETAILED DESCRIPTION
[0024] To facilitate those skilled in the art to understand the technical content of the present invention, the present invention is described in detail below using the Qwen3 model as a basic model and Cline as a host platform as an example with reference to the accompanying drawings.
[0025] A flowchart of a large language model driven FMT automatic modeling method supporting MCP protocol, such as Figure 1 As shown, it includes six parts: Step 1. Embed the Python interpreter into the FMT software, Step 2. Register the FMT modeling function as a Python script command, Step 3. Build the MCP protocol service module, Step 4. Deploy the large language model and generate messages, Step 5. Instruction execution and echo, and Step 6. Host platform feedback the large language model.
[0026] Step 1. Embed the Python interpreter into the FMT software
[0027] Embed a Python interpreter in the FMT 3D modeling software. Initialize the interpreter by calling Py_Initialize() and keep it active during the program lifecycle, allowing the software to run Python script commands.
[0028] Step 2. Register the FMT modeling function as a Python script command
[0029] The modeling operation-related functions in the FMT software (implemented in C++) are encapsulated as a Python-callable bridge interface and registered in the custom module cppmodule so that it can be called by scripts and supported by FMT.
[0030] The eight modeling-related functions in the FMT software include creating a model, importing text, exporting text, testing text, updating the current drawing, updating all drawings, calculating dimensional tolerances, and saving model parameters. These functions are implemented in C++ as __cpp_create_model, __cpp_import_text, __cpp_export_text, __cpp_test_text, __cpp_refresh_current_drawing, __cpp_refresh_all_drawings, __cpp_cal_tolerance, and __cpp_save_param. The corresponding Python bridge interface functions are create_model(), import_text(), export_text(), test_text(), refresh_current_drawing(), refresh_all_drawings(), cal_tolerance(), and save_param(). Each function is registered in the cppmodule module as PyObject*func(PyObject*, PyObject*) and added to the Python interpreter via PyModule__Create and PyImport_AppendInittab.
[0031] Step 3. Build the MCP protocol service module
[0032] Within the Qt framework, a local listening service, called the MCP Server, is built using QTcpServer and connected via TCP. This module adheres to the MCP (Model Control Protocol) specification and is used to receive JSON instructions from the Large Language Model (LLM). JSON instructions consist of two fields: "type" and "code." The "type" field specifies the execution type of the message, and the "code" field contains the Python script code to be executed. This module parses the JSON instructions sent remotely by the Large Language Model, extracts the Python code in the "code" field, and executes it using PyRun_SimpleString.
[0033] Step 4. Large language model deployment and message generation
[0034] The Cline platform within Visual Studio Code integrates with the Qwen3 model's API, making it the host platform for invoking MCP tools. Leveraging the large language model's universal understanding of natural language, Cline acts as a bridge between natural language and control commands, identifying user intent, generating JSON commands that conform to the MCP protocol format, and sending these commands to the MCP server within the FMT software via a TCP connection.
[0035] Step 5. Command execution and echo
[0036] The MCP Server executes the received Python script command (the code field value parsed from the JSON command in Step 4) through the interpreter, triggering the modeling operation function. Simultaneously, the FMT software system uses the sys.stdout redirection mechanism to write execution logs or error information back to the MCP Server, which then feeds back to the host.
[0037] Step 6. Host platform feedback large language model
[0038] After receiving the response from the MCP Server, the Host platform embeds the response into the context for the large language model to reference. The model can then use this information to determine whether to proceed with the next instruction or display the modeling results to the user.
[0039] In this example, the natural language input describing the modeling intention is "Create a new round tube with an inner diameter of 2 and an outer diameter of 6, save it as pipe.sat, make it steel, and color it gray." The large language model splits the natural language description and performs reasoning. Figure 5 In this embodiment, the large language model performs split reasoning based on the natural language description input by the user to generate the FMT modeling program. In each round of reasoning, the large language model will execute an MCP tool to generate the FMT modeling program and operate the FMT software, and finally complete the three-dimensional modeling. Figure 6 The amount cannot implement the language model operation FMT software by compiling Figure 5 A three-dimensional model generated by a modeling program.
[0040] It can be seen from the above embodiments that the present invention embeds the Python interpreter into the FMT modeling software, registers the core modeling operation function as a Python callable script, and cooperates with the remote instruction format defined by the MCP (Model Control Protocol) protocol. The user describes the modeling intention through natural language; then uses the large language model to decompose the natural language input by the user according to the intention, generates a complete FMT modeling program, and automatically manipulates the FMT to complete the modeling operation; finally realizes the full chain closed loop of natural language-script instruction-software operation behavior-real-time feedback, supports the large language model to directly control the actual software modeling process, and greatly improves the automatic modeling capability. The modeling of complex three-dimensional models can be completed by performing Boolean operations and combined assembly operations on simple three-dimensional models, effectively improving the direct integration and execution capabilities of the rapid modeling tool FMT software and the large language model.
Claims
1. A large model driven FMT automatic modeling method supporting the MCP protocol, characterized in that: The specific steps are as follows: Step 1. Embed the Python interpreter into FMT to enable FMT to run Python script commands; Step 2. Register the FMT modeling function as a Python script command; Encapsulate the modeling operation-related functions in FMT into a Python-callable bridge interface and register it in the custom module cppmodule so that it can be called by scripts and supported by FMT. Step 3. Build the MCP protocol service module; Based on Qt's TCP service function, a local monitoring MCP instruction receiving module MCP Server is built to parse the JSON format instructions sent remotely by the large language model, extract the Python code in the code field, and execute it through PyRun_SimpleString; Step 4. Large model deployment and message generation; The large language model is mounted on the Host platform that supports MCP tool calls. The Host platform acts as a bridge between natural language and control commands, responsible for identifying user intent, generating JSON commands that comply with the MCP protocol format, and sending the commands to the MCP Server in the FMT software through a TCP connection. Step 5. Command execution and echo; The MCP Server passes the received Python script command to the Python interpreter for execution, triggering the modeling operation function. At the same time, the FMT software writes the execution log or error information back to the MCP Server, which then feeds back to the Host platform. Step 6. Host platform feedback large model; After receiving the return result from the MCP Server, the Host platform embeds the result into the context for reference by the large language model. The large language model then determines whether to continue to initiate the next instruction or display the modeling results to the user.
2. The large model driven FMT automatic modeling method supporting the MCP protocol as claimed in claim 1, characterized in that: Step 1 initializes the interpreter by calling Py_Initialize() and maintains its active state during the program life cycle, so that the software supports running Python script strings.
3. The large model driven FMT automatic modeling method supporting the MCP protocol as claimed in claim 1, characterized in that: The modeling operation related functions of the FMT software in step 2 include eight functions: creating a model, importing text, exporting text, text testing, updating the current drawing, updating all drawings, calculating dimensional tolerances, and saving model parameters.
4. The large model driven FMT automatic modeling method supporting the MCP protocol as claimed in claim 3, characterized in that: The relevant functions in step 2 are encapsulated through C++, and each function is registered in the cppmodule module in the form of PyObject*func(PyObject*, PyObject*), and added to the Python interpreter through PyModule__Create and PyImport_AppendInittab.
5. The large model driven FMT automatic modeling method supporting the MCP protocol as claimed in claim 1, characterized in that: The MCP instruction receiving module MCP Server in step 3 complies with the MCP protocol specification. For the JSON format instruction sent remotely by the large model, it extracts the message execution type of the type field in the JSON format instruction and the Python code in the code field and executes them through PyRun_SimpleString.
Citation Information
Cited By
Gateway dynamic self-coding system and method based on model context protocol
CN121333908A
Function interaction method and system for embedded system and large model, and embedded terminal
CN122219896A