A 3D modeling method decoupling code text and feature tree

By decoupling feature definition and feature tree in the 3D modeling system, and utilizing scripting programming language and artificial intelligence, the system enables free interactive feature tree and panel parametric editing, solving the problem that unregistered feature operations cannot be parametrically edited in existing technologies, and improving the flexibility and efficiency of modeling operations.

CN123118919APending Publication Date: 2026-11-17HANGZHOU YANXINGHEYI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611451753.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-18
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing 3D modeling systems cannot simultaneously achieve interactive feature tree and panel parametric editing with the freedom of using code as the modeling carrier. Furthermore, unregistered feature operations cannot be parametrically edited, and there is a lack of a modeling architecture that decouples code text from features.

Method used

By maintaining code text written in a scripting programming language, combined with artificial intelligence and user interface operations, feature definitions and feature trees are decoupled, allowing statements with unregistered features to be executed as usual and automatically generating editable feature tree nodes, thus enabling interactive editing.

Benefits of technology

It enables interactive feature tree and panel parametric editing within the same modeling system, and allows for the free use of code as the modeling carrier. Unregistered feature operations can also be parametrically edited, improving the flexibility and efficiency of modeling operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118919A_ABST
    Figure CN123118919A_ABST
Patent Text Reader

Abstract

This application discloses a 3D modeling method that decouples code text from feature trees. It maintains code text written in a scripting programming language, and modeling operations are implemented by executing this code text. This code text is injected by artificial intelligence and / or generated by appending statements through user interface operations, and is not constrained by user interface templates or feature registry entries. The interface layer maintains a feature registry entry, which includes feature definition declarations, identification keys, code line construction functions, and editing protocols. It obtains a statement summary from the code text; unrecognized statements do not generate feature tree nodes but are executed normally. Function call statements are matched according to their identification keys: statements matching feature definitions generate editable feature tree nodes; unmatched statements are executed normally, filtered by shape, and statements returning shapes automatically generate default editable feature tree nodes and display them; non-shape statements do not generate feature tree nodes. This application decouples the feature tree from the code, and parametric editing does not depend on the interface feature coverage.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is related to the following patent applications filed by the applicant on the same day. This application family comprises seven documents, sequentially numbered as Related Application 1 to Related Application 7, corresponding to user file numbers 001 to 007 respectively: "An Automatic Determination and Output Method for Result Shape in 3D Modeling" (User File Number 001), "An Undo / Redo Method for Code-Driven Modeling Based on UI Operations" (User File Number 002), "A 3D Modeling Method with Dual Implementation of Scripted Mesh and Boundary Representation" (User File Number 003), "An AI / UI Collaborative Modeling System with Code Text as the Unique Interface Contract" (User File Number 005), "A Method for Editing Parameter Expressions in 3D Modeling" (User File Number 006), and "A Method for Cross-Kernel and Cross-History Persistence of Topological References in 3D Modeling" (User File Number 007). The user file number for this application is 004. The above applications and this application are based on different technical aspects of the same 3D modeling system, each solving different technical problems and employing different technical means; their protection scopes do not overlap. Technical Field

[0002] This application relates to the field of 3D modeling technology, specifically to a 3D modeling method that decouples code text from feature trees. In this application, AI refers to artificial intelligence, and UI refers to user interface. Background Technology

[0003] There are currently two paradigms for 3D parametric modeling systems, each with its own inherent limitations.

[0004] The first category is traditional parametric CAD systems (such as Onshape, Fusion 360, SolidWorks, CATIA, etc.), characterized by the binding of features, user interface (UI), and code: features are the primary concept of the modeling system, each feature has a fixed parameter panel UI, and code (such as FeatureScript and macros) is the projection of features; the two cannot be separated. This type of system has the following drawbacks: First, users cannot introduce operations that the UI does not recognize. To perform an operation that the UI does not support, users must abandon interactive parametric design and resort to pure script programming, or wait for the vendor to update the feature library. "UI capability equals modeling capability"—for example, if a user needs a custom knurled feature or irregular hole feature, and it is not in the UI feature library, parametric editing through the feature tree and parameter panel is impossible. Second, macro-recorded code is generated by the system, is verbose, unmaintainable, and contains a large amount of UI state noise, making it difficult for artificial intelligence to intervene and modify. Third, feature definitions are bound to the kernel, preventing third parties from adding new feature types without modifying the kernel, resulting in a closed feature ecosystem.

[0005] The second type is pure script-based CAD systems (such as OpenSCAD, CadQuery CQ editor, etc.), characterized by code as the modeling medium, where users create models by writing scripts. This type of system has the following drawbacks: First, it lacks interactive feature trees and parametric editing panels; parameter changes require manually locating and modifying values ​​in the code, resulting in low efficiency and unsuitability for non-programming users. Second, it lacks the concept of features; function calls in the script are not recognized as editable feature tree nodes, preventing users from viewing the model's feature structure through the interface. Third, parameter modifications require a full script re-execution, making incremental recalculation based on feature structure impossible.

[0006] In terms of feature recognition and editing, existing technologies include the following solutions, all of which have shortcomings. Programmable features, represented by FeatureScript, allow users to write custom features using code, but features remain a primary concept within the modeling system; the code is the feature definition, and the UI is bound to the code. The feature parameter panel is automatically generated from the parameter declarations (annotations) in the feature definition. Features must be explicitly registered and have their parameters declared to obtain a parametric editing UI; function calls not registered as features cannot obtain parametric editing capabilities. In systems like FreeCAD, the feature tree is a core concept, and Python macros are operation records rather than modeling carriers. Feature recognition is bound to the core object and cannot recognize arbitrary script statements. Node graph systems like Blender Geometry Nodes use node graphs as features; code text does not constitute the modeling basis. Node graphs and code text are two different modeling carriers and cannot be unified. In general macro-recorded parametric systems, the recorded code is bound to the feature; operations not recognized by the UI cannot be recorded, and there is no fallback execution or AI completion channel. Furthermore, existing technologies for modeling driven by natural language or scripts often use CAD atomic operation sequences as the execution carrier: translating modeling intentions into instruction sequences that simulate manual operation steps in traditional modeling software (such as selecting geometry, calling extrusion, and setting parameters), which are then executed via the target software's automation interface. The semantic space of operation sequences is limited to the traditional CAD operation set and cannot accommodate modeling language capabilities such as variables, constants, parameter references, control flow, function calls, and third-party libraries—for example, conditional branches (such as "if a certain dimension exceeds a threshold, combine geometry in different ways") and conditional expressions cannot be expressed in operation sequences, but can be directly written as branch statements or ternary expressions in modeling languages. Modeling languages ​​that use code text written in scripting languages ​​as the modeling carrier have far stronger expressive capabilities than operation sequences; the two are at different levels in terms of expression carriers, and operation sequence-driven systems do not possess the code text object upon which this application relies.

[0007] At the granularity of feature recognition, the feature recognition in the aforementioned existing technologies is all bound to feature definitions or kernel objects: either a function must be registered as a feature before it can be recognized, or the feature tree nodes directly correspond to kernel objects. There is no mechanism where "the interface layer registers features on its own through a feature registry and performs recognition based on statement content"—that is, the code layer only has statements and no concept of features; feature recognition is entirely determined by the feature registry of the interface layer, and statements not recognized by any feature are executed as usual. In terms of editing capabilities, operations without registered features in existing technologies are either not executable or can only be edited as pure scripts—features must be predefined (registered) and parameters declared to obtain parameterized editing capabilities. There is no channel where "unmatched statements are executed as usual without blocking the modeling chain, and operations without predefined features can still be parameterized edited"—that is, when the UI does not recognize an operation, it does not refuse to execute or downgrade to pure script; instead, the interface layer automatically generates a default editable node to edit the parameters of the operation by detecting the type of the return value in the execution result at runtime (features do not need to be predefined or parameter declared). Artificial intelligence can also rewrite its code without restriction, making parameterized editing independent of the coverage of UI features.

[0008] Therefore, existing technologies lack a modeling architecture that decouples code text from features: the code layer only has statements and no feature concept; the UI layer registers features on its own through a feature registry; statements not recognized by any features are executed normally; statements that cannot be recognized are executed normally by the interface layer without generating feature tree nodes; operations that the UI does not recognize can still be parameterized and edited—the interface layer edits its parameters through default editable nodes (no parameter declaration is required, and the return value type is determined by runtime detection), and artificial intelligence can rewrite its code text without restriction. Summary of the Invention

[0009] The technical problem this application aims to solve is: how to simultaneously obtain interactive feature tree and panel parametric editing (traditional CAD experience) and modeling freedom with code as the modeling carrier and arbitrary statements (script CAD experience) within the same modeling system, and make the parametric editing capability independent of the coverage of UI features.

[0010] In this application, feature definitions, feature tree nodes, and feature trees are three levels of the same conceptual system: Feature definitions are entries in the feature registry of the interface layer (definition level), declaring identification keys, code line construction functions, and editing protocols, and are registered and maintained by the interface layer; Feature tree nodes are nodes in the feature tree (instance level), which are editable nodes generated after a statement is matched to a feature definition by an identification key. The same feature definition can correspond to multiple feature tree nodes generated by multiple matching statements; The feature tree is composed of feature tree nodes, displaying the modeling process in the order of statement execution. The feature registry is a registry for storing feature definitions in the interface layer. Statements in the code text do not carry feature definition identifiers—statements do not embed the declaration of their corresponding feature definitions, and whether a statement can be identified as a feature tree node is determined by the interface layer based on the feature registry matching. In this application, "feature" refers to feature definitions unless otherwise specified. Shape: A type of three-dimensional solid object with geometric data features, including vertex positions and indices, or registered by the object during creation via the shape construction interface, and the interface layer determines whether the object belongs to a shape at runtime based on these features. Shape Construction Interface: A construction interface provided by the scripting language for creating shape objects and registering them as shapes during creation; after an object is created through the shape construction interface, the interface layer determines that it belongs to a shape at runtime. Scripting Language: A programming language capable of writing and interpreting scripts; General-Purpose Scripting Language: A scripting language that possesses general programming elements such as variables, functions, and control flow, and does not rely on specific CAD software-specific interfaces, such as Python, JavaScript, and TypeScript. Because the above languages ​​are fully covered in the pre-training corpus of AI models, the modeling code generated by AI based on general-purpose scripting languages ​​has higher quality and fewer defects; however, the method of this application is not limited to general-purpose scripting languages, and other scripting languages ​​can also be used.

[0011] To address the aforementioned technical problems, this application provides a 3D modeling method that decouples code text from feature trees. This method first maintains code text written in a scripting programming language, and modeling operations are implemented by executing this code text. The code text is written and injected by artificial intelligence using a scripting programming language, and / or continuously appended to the code text by user interface operations during the modeling process. Modeling statements written by the artificial intelligence and modeling statements appended by the user interface coexist in the same code text. The modeling code written by the artificial intelligence using a scripting programming language is not limited by code templates that can be generated or edited by the user interface, nor is it constrained by features already registered in the feature registry. The feature registry is maintained by the interface layer. Each feature definition in the feature registry declares an identification key, a code line construction function, and an editing protocol. The identification key includes the function name of the calling function and an optional package name. The default identification key for the package name only matches function call statements without a package name. Statements in the code text do not embed the declarations of their corresponding feature definitions; the correspondence between statements and feature definitions is determined by the interface. The layer is determined based on the aforementioned feature registry; a statement digest of the code text is obtained, which is obtained by the code execution engine parsing the code text and provided to the interface layer through the interface contract. This is a sequence of digests generated line by line for identifiable statements (function call statements that can be parsed to obtain the package name, function name, output variables, and parameters of the calling function), which at least includes the package name, function name, output variables, and parameters of the calling function; for unidentifiable statements, the interface layer does not generate feature tree nodes, but the statement is still executed as normal according to the code text; for each function call statement in the statement digest, the interface layer performs a match based on its package name and function name with the identification key in the feature registry, regardless of the statement source: statements that match the feature definition automatically generate editable feature tree nodes and provide interactive editing according to the editing protocol, while statements that do not match the feature definition are executed as normal, where statements whose called function returns a shape automatically generate default editable feature tree nodes.

[0012] In one implementation, upon responding to an edit operation, the edited parameters are rewritten as the corresponding statement code text, and the updated code text is executed to generate a new execution result. Specifically, statements matching feature definitions are rewritten using a code line construction function, and statements generating default editable feature tree nodes are rewritten according to the parameter format of the statement code text. The editing protocol includes a backfill function and a collection function: the backfill function extracts parameters from the statement code text into interface parameters and records the identifier of the statement being edited; the parameters include literal parameters and parameter slots in parameter reference format. The collection function collects the interface parameters into a new parameter set. During editing, the original statement is located using the statement identifier, and the statement's code text is rewritten while maintaining its position. Thus, a two-way mapping is formed between UI parameters and code lines, and the editing action is located at a specific statement without disturbing other statements; the parameter slot in the form of parameter reference is edited through the parameter slot editing entry of the feature tree node: the parameter slot editing entry is the editing control provided for the parameter slot on the feature tree node, and the interface layer writes the edited value back to the position of the parameter slot in the code text. The editing result is uniformly converged into updating the code text and executing it; the fine mechanism of parameter slot editing (recording of parameter slot source information, editing unit driven by editing intent, character range fidelity replacement and locating parameter declaration line across files through parameter reference) is disclosed by the associated application six.

[0013] In one implementation, statements that do not match a feature definition are further categorized according to the value type of the output variable in the execution result: For statements whose called functions return a shape, the interface layer automatically generates a default editable feature tree node, presented with a default icon and default name, generates a default editing control according to the parameter type, and provides interactive editing based on the default editing control; the determination of a shape return value is based on the runtime type of the output variable value in the execution result—the statement is executed as usual, and the interface layer determines whether to generate a default editable feature tree node based on whether the value type of the output variable in the execution result is a shape, without requiring any metadata such as function type definition or parameter declaration; for statements whose called functions return a non-shape value (such as numerical calculation functions), the interface layer does not generate a default editable feature tree node, does not render the feature tree node, and executes as usual. Thus, the editability of the feature tree node is driven by both the feature registry and the return value type. Features do not need to be predefined or have parameter declarations—default editable nodes are only for modeling functions that produce shapes. Third-party library functions that have not registered features can obtain default parameterized editing capabilities as long as the return value is a shape, and are no longer universally unable to be parameterized.

[0014] In one implementation, statements that do not render feature tree nodes include any of the following: statements whose call names include package names and whose return values ​​are not shapes; and other syntax text that is not a statement call. Thus, statements that do not render feature tree nodes execute normally, do not generate editing entries, and do not lose code capabilities; in statements that generate feature tree nodes, if the parameter slots are calculated expressions (expressions will be lost when the form is written back) or the positional parameters are in non-variable reference form (the correspondence with named parameters cannot be statically determined), the form editing controls are unavailable, but editing is performed through the parameter slot editing entry with the parameter slot as the editing object, and the editing result is uniformly converged into updated code text and executed.

[0015] In one implementation, statements that do not match feature definitions still proceed to the execution result, and their output variables are used as input references for subsequent statements. Statements that do not render feature tree nodes do not block the modeling chain. Thus, operations that the UI does not recognize do not affect modeling execution; they simply do not render feature tree nodes and continue to execute as normal.

[0016] In one implementation, the code text also includes parameter lines, which declare parameters as constant assignments; statement parameters reference the parameter lines using parameter references; in response to parameter value modifications, the parameter lines are rewritten and the updated code text is executed. Therefore, the essence of parametric modeling is "parameter lines + reference relationships + recalculation," and UI features are merely an input channel for parameter editing.

[0017] In one implementation, the interface editing channel and the AI ​​editing channel coexist: for statements without a matched feature definition, the return value is a default editable feature tree node for shape generation, and the interface layer edits its parameters (editing parameters of the default feature type) via the default editing control; for statements without a matched feature definition or statements that cannot be recognized, AI editing is responded to, and the AI ​​rewrites the code text of the statement and executes the updated code text, which is not restricted by the feature registry and function type definition, and can rewrite any statement, so that operations without registered features also have parameterized editing capabilities. Thus, operations that the UI does not recognize can still be modified—the interface layer edits parameters via the default editable node, and the AI ​​rewrites the code without restriction. When the interface channel does not exist, the AI ​​channel automatically completes it, and the parameterization capability does not depend on the UI feature coverage range.

[0018] In one implementation, the statement summary is a sequence of summaries arranged in the order of statement appearance, containing statement identifiers. These identifiers are stable sequence numbers assigned during parsing based on the order of statement appearance in the code text, and remain unchanged during rewriting while maintaining the position of the statement. When inserting or deleting statements in the code text, the statement sequence numbers after the insertion point are sequentially extended. The term "stable" means that it does not drift due to local rewriting of its parameter values ​​or positions. The interface renders feature tree nodes according to the statement summaries. Statements that generate feature tree nodes correspond one-to-one with the nodes through the statement identifiers. Statements that do not generate feature tree nodes are not rendered.

[0019] In one implementation, the execution result includes the complete set of output variables, terminal geometry, assembly / grouping structure, and active non-geometric values; the interface constructs a feature tree and a scene tree based on the terminal mapping and assembly / grouping structure.

[0020] The difference between this application and metadata-driven property editors (such as .NET PropertyGrid, Unity / GodotInspector, Onshape feature declaration auto-generation parameter panel, and low-code property editors) is that the latter all use "object instance properties" or "explicit feature / parameter declarations" as trigger sources, statically mapping editing controls from metadata or parameter specifications, and the editing action directly writes back to the object property or triggers feature regeneration; while this application uses "arbitrary script statements" as trigger sources, and the interface layer determines whether the statement can obtain an editable node in the feature tree based on the feature registry and shape filtering. The two are fundamentally different in the following four aspects: First, the triggering chain is different: This application starts from the code statement, obtains the statement digest parsed by the code execution engine, matches the feature registry by package name and function name, and then judges the unmatched statement by runtime shape filtering. The whole process is implemented after the code is executed, while the metadata-driven attribute editor is driven by static analysis of the code. Secondly, no predefined features are required: Systems like Onshape require features to be explicitly registered (registerFeature) and their parameter specifications declared before a parameterized editing interface can be obtained. Unregistered function calls do not appear in the feature UI at all. However, this application automatically generates default editable feature tree nodes for statements that do not match feature definitions, based solely on whether the return value of the execution result is a shape (shape filtering). There is no need to pre-register the feature definition of the function in the feature registry, which is the opposite of Onshape. Third, shape filtering: This application only generates default editable feature tree nodes for statements whose called functions return shapes, and does not generate nodes for statements whose return values ​​are not shapes (such as numerical calculations and string processing), which is a specialization of 3D modeling semantics; the metadata-driven attribute editor has no concept of shape and generates controls for all reflective attributes; Fourth, the shape determination in this system is based on actual data at runtime and does not depend on a type system. In contrast, systems like .NET PropertyGrid are type-based and require a static or dynamic type hierarchy. This system uses a dynamic scripting language and supports third-party packages, lacking a unified type hierarchy for 3D modeling.

[0021] The difference between this application and related application 1, "An Automatic Determination and Output Method for Result Shape in 3D Modeling," lies in the following: both involve runtime shape type determination, but the determination objects, purposes, and processes differ. Firstly, the determination objects differ: after executing the modeling script, related application 1 performs runtime type determination on all objects in the variable context, identifying the variable names corresponding to objects belonging to the shape type as shape candidates and constructing a shape candidate set; this application only performs runtime shape type determination on the return values ​​of statements that do not match feature definitions, determining only the return value of a single statement and not constructing a shape candidate set. Secondly, the determination purposes differ: related application 1 uses consumption determination to determine the result display set, where consumption determination determines whether a shape candidate is referenced as input for geometric operations by subsequent statements after the last assignment, and the result display set is used for interface display, model export, and name-based referencing; this application's runtime shape type determination is used to determine whether unmatched statements generate default editable feature tree nodes, serving the editability of the feature tree level, and does not involve the result display set. Third, the judgment processes differ: the judgment in the first related application includes two stages: shape candidate set construction and consumption judgment; the judgment in this application only determines the shape type of a single unmatched statement return value, without a consumption judgment stage. Therefore, the runtime shape type judgment (i.e., shape filtering judgment) in this application and the result shape judgment in the first related application belong to different levels of judgment. They work together to connect "shapes being recognized as editable nodes in the feature tree" with "shapes entering the interface for display, model export, and presentation results by name reference" within the same modeling system.

[0022] The distinction between this application and related application 5, "An AI / UI Collaborative Modeling System with Code Text as the Unique Interface Contract," lies in the following: the statement digest of this application is the same as that of related application 5, sharing the same parsing structure. Both are in a generator-consumer relationship within the same structure—the statement digest is obtained by the code execution engine of related application 5 from parsing the code text and is uniformly provided to the functional modules via the interface contract module. Its parsing, field composition, statement identifier allocation, and the generation mechanism that generates entries only for modeling statement lines all belong to related application 5. This application, as a consumer, obtains the digest and then performs identification key matching, shape filtering gating, and feature tree node generation, without claiming a specific statement digest generation mechanism. Therefore, the statement digest acquisition step in the claims of this application does not claim a parsing generation mechanism, and the two applications do not repeatedly claim the same structure at the claim level.

[0023] This application has the following beneficial effects: First, since all geometric data comes from code text and statements do not carry feature definition identifiers, feature definitions are only entries in the feature registry of the interface layer. The feature tree is decoupled from the code, and UI capabilities are not equal to modeling capabilities. Second, since statements that do not match feature definitions are executed as usual and feature tree nodes are not rendered, third-party, artificial intelligence, or handwritten code that the UI does not recognize does not block the modeling chain, and all modeling operations can be executed. Third, since features do not need to be predefined or have parameters declared, default editable feature tree nodes are automatically generated when the return value of an unmatched statement is detected at runtime. Editability is driven by both the feature registry and the return value type. Features that are not predefined (unregistered) in the UI also gain parameterized editing capabilities. Fourth, because the statement summaries are arranged in the order of statement appearance and the statement identifiers remain stable after editing, the statements that generate feature tree nodes correspond one-to-one with the nodes, resulting in a stable interface display. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments of this application or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 A schematic diagram of the system structure of a 3D modeling method for decoupling code text and feature tree provided in an embodiment of this application; Figure 2 A flowchart illustrating a sentence recognition and editability classification process provided for an embodiment of this application; Figure 3 This is a flowchart illustrating a unified closing mechanism for editing, as provided in an embodiment of this application. Detailed Implementation

[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0027] The following description of some technologies involved in the embodiments of this application is provided to aid understanding and should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, some descriptions of well-known functions and structures are omitted in the following description.

[0028] Figure 1The system architecture of the method described in this application is illustrated, including a code storage module, a feature registry, a feature tree rendering module, an editing protocol module, an artificial intelligence editing channel module, and a unified interface module, as well as a parser belonging to the code execution engine. The method described in this application is implemented in a scripted 3D modeling system, which consists of an interface layer and a code execution engine. The code text is written and injected by artificial intelligence using a scripting programming language, generated by UI operations, or generated jointly by both. The code written by artificial intelligence is not limited by code templates that can be generated or edited by the user interface, nor is it constrained by features already registered in the feature registry. The interface layer only interacts with two types of data: code text and statement summaries. The parser is located within the code execution engine and is not part of the interface layer. Statement identifiers and output variable names are assigned by the code execution engine. The code execution engine is an engine that performs modeling with the code text as input and parses the code text to generate the statement summaries; its architecture and interface are detailed in related application five.

[0029] The modeling language runtime layer is separated from the interface layer. The interface layer is an independent component that can be implemented independently by third parties. The runtime layer only interacts with the code text and statement summaries and is unaware of the feature registry and feature tree nodes. Any interface layer (including third-party interfaces) can access the same modeling language. The feature registry, feature matching, and editing all occur in the interface layer, and the modeling language runtime layer remains unchanged regardless of changes to the interface layer.

[0030] Figure 2 The process of statement recognition and editability classification is illustrated. The code text is the sole source of geometric data, and the 3D model is a derivative generated by executing the code text. All modeling operations are implemented as changes to the code text. 3D data is generated by executing the code text and stored in the code storage of the interface layer. This storage consists of statements organized line by line, with each line containing one statement or parameter line. Statement types are unrestricted (function calls, import statements, variable declarations, conditional branches and conditional expressions, control flow statements, comments, etc., can all appear). The code execution engine parses the code text: function call statements that can parse out structured information such as the package name, function name, output variables, and parameters are identifiable statements. A statement summary is generated for each statement and provided to the interface layer via the interface contract. Statements that cannot parse out the above structured information (such as import statements, variable declaration statements, control flow statements, comments, etc., are unidentifiable statements. No statement summary is generated, and the interface layer does not generate feature tree nodes; however, the statement still executes normally along with the code text.

[0031] Take, for example, a modeling script jointly generated by artificial intelligence and the interface layer: const w = 40 let part0 = box(w) let part1 = union(part0, box2) The statements "const w = 40" and "let part0 = box(w)" are generated by artificial intelligence, while the statement "let part1 = union(part0, box2)" is appended by the interface layer according to the template format. All three coexist in the same modeling script in the order of the statements. "let part0 = box(w)" and "let part1 = union(part0, box2)" are recognizable function call statements, generating statement summaries; "const w = 40" (parameter line) does not generate feature tree nodes in the interface layer. Through feature registry matching: "box" matches the basic feature definition, and "union" matches the Boolean feature definition. The interface layer constructs editable feature tree nodes (box node and union node) on the feature tree respectively. The parameter "box2" in the statement "let part1 = union(part0, box2)" is a parameter slot in parameter reference form. Users can edit the "box2" parameter slot by clicking the parameter slot editing entry in the union node. The editing results are uniformly converged into updated code text and executed.

[0032] The statement summary is a sequence of summaries arranged in the order of statement appearance, rather than an intermediate tree representation. It is obtained by the code execution engine parsing the code text and provided to the interface layer through the interface contract. Its generation mechanism (line-by-line identification of modeling statements, field composition, and statement identifier allocation) is described in related application 5. This application, as a consumer, obtains the statement summary and uses it only for feature tree recognition and node construction. Each summary includes: statement identifier (a stable sequence number assigned according to the order of appearance of the statement in the code text, which remains unchanged during rewriting while keeping the statement's position unchanged; when inserting or deleting a statement, the statement sequence number after the insertion point is shifted), package name of the calling function (can be empty), function name, parameters (supporting literals, parameter references, variable references, and call references), positional parameters, output variables, and reference relationships. The interface layer constructs feature trees, scene trees, and assembly trees based on the statement summaries.

[0033] Both "unidentifiable" and "unmatched" statements belong to the interface layer's classification. The AI ​​layer can directly rewrite and edit both types of statements without distinction. Parameter lines (constant assignment form) are variable declaration statements and do not participate in feature registry matching; their editing is handled by rewriting the parameter line. Parameter slots in the form of parameter references in statement parameters are edited through the parameter slot editing entry of the feature tree node: the parameter slot editing entry is the editing control provided for the parameter slot on the feature tree node. The interface layer writes the edited value back to the position of the parameter slot in the code text, and the editing result is uniformly converged to update the code text and executed. The fine mechanism of parameter slot editing (recording of parameter slot source information, editing intent-driven editing units, character range fidelity replacement, and locating parameter declaration lines across files via parameter references) is disclosed in the associated application six. The parameter slot editing entry is uniformly provided by the interface layer for the statements that generate feature tree nodes, and does not depend on whether the statement matches the feature definition.

[0034] The interface layer maintains a feature registry. Feature definitions are registered through a registration interface, and a uniqueness assertion is performed during registration: duplicate feature types, operation names preempted by two feature definitions, and submission types preempted by two feature definitions all result in an error. The feature registry maintains three index tables: by feature type, by operation name (call name), and by submission type.

[0035] Each feature definition declares: Feature type name; Identification key – a set of operation names (function names that call functions), identified as a mapping of statement content (statement summary → feature definition), independent of the statement source; Code line construction function – interface parameters → a line of code text, the code line consists of function name, position input, output variable and parameter object, the output variable name is inferred and assigned by the naming service according to the number of inputs and used variable names; Parameter normalization function – normalizes interface parameters into code parameters; Display protocol – thumbnail (a visual preview of the modeling result corresponding to this feature, such as a geometric thumbnail), icon key (the interface layer is mapped to the icon component through the icon mapping table), human-readable node name (such as "stretch 10mm", generated by feature type and key parameter values) and detailed description (hover tooltip); Editor – tool mode, backfill function and collection function.

[0036] Identification Rules: For each function call statement that generates a statement summary, the UI layer queries the feature registry based on its function name and package name. The package name can be omitted when declaring the identification key in the feature definition: built-in feature definitions only declare the function name (package name omitted), matching only function call statements without a package name; third-party feature definitions can declare an identification key with a package name (e.g., "gear-lib.external"), matching only call statements with the same package name. Statements with non-empty package names (third-party library calls) do not match built-in feature definitions with the default package name, preventing functions with the same name in third-party libraries from accidentally matching built-in features (e.g., "mech.box" from a third-party library does not match the basic body "box", "mech.chamfer" does not match the chamfer "chamfer"); built-in calls without package names match feature definitions by function name. If a match is found, an editable feature tree node is automatically generated; otherwise, a "not matched" flag is returned. The feature layer only produces and consumes code text and statement summaries, never modifying execution semantics; registering a feature definition is equivalent to extending the editable surface of the UI, unrelated to code execution.

[0037] In one implementation (taking a practical implementation of this system as an example), the feature definition is implemented in the following code form. The feature definition interface is as follows, and its fields correspond one-to-one with the feature definition structure of this application (identification key, parameter normalization function, code line construction function, display protocol, editing protocol): / / Feature definition interface: A feature definition = identification key + code line construction + display protocol + editing protocol interface FeatureDef { type: string; / / Characteristic type name (registration key, unique) ops: string[]; / / Identification key: The full name of the function to be called for this feature identification buildArgs(params: CommandParams): Args; / / Parameter normalization function: UI parameters → code parameters buildCode(params: CommandParams, ctx): string; / / Code line construction function: UI parameters → one line of modeling language code getIconKey(summary): IconKey; / / Display protocol: icon key (UI layer mapped to icon component) deriveLabel(summary, args): string; / / Display protocol: human-readable node name (generated from feature type and key parameter values) editor: { / / Editing Agreement toolMode: string; backfill(summary, codeLine, scopedId, fileId): void; / / Backfill function: code line → interface parameters, and record the identifier of the statement being edited. collectArgs(): Args; / / Collection function: UI parameters → New parameter set }; } Basic feature definition—The five calls (box / sphere / cylinder / cone / wedge) share a single feature definition, with the identification key being the five function names: const primitive: FeatureDef = { type: 'primitive', ops: ['box', 'sphere', 'cylinder', 'cone', 'wedge'], / / Identifier key: a set of function names to call buildArgs: (params) => { / * Only take numeric and array fields as code parameters * / }, buildCode: (params, ctx) => { const outputs = deriveOutputs('box', [], 1, ctx.currentCode); / / The output variable name is inferred by the naming service based on the number of input variables and the names of already used variables. return formatCodeLine({ callee: 'box', positional: [40, 40, 10],outputs, args}); / / Generate code line: part0 = box(40, 40, 10) }, getIconKey: (s) => opIcons[s.callee], deriveLabel: (s, args) => `cuboid ${w}×${d}×${h}`, / / Human-readable node name: "cuboid 40×40×10" editor: { toolMode: 'primitive', backfill: (summary, codeLine, scopedId, fileId) => { const { args} = codeToArgs(codeLine); / / Backfill: Extract code line parameters into UI parameters primitivesStore.openEditPanel(fileId, type, params); setEditing(summary.id, scopedId); / / Records the identifier of the statement being edited. }, collectArgs: () => primitivesStore.getParams(), / / Collect: UI parameters into a new parameter set }, } The definitions of the remaining features are similar to those in the code above, and will not be listed one by one.

[0038] The feature registry maintains all feature definitions through a registration interface. During registration, a uniqueness assertion is performed: duplicate feature types or operation names preempted by two feature definitions will result in an error. Recognition involves querying the feature registry based on the function name called in the statement digest. If a match is found, the statement digest is mapped to its feature definition. Calls with non-empty package names do not match the default built-in feature definition for that package name, returning a "not matched" flag, which is then used by shape filtering to determine the next step in the process.

[0039] Taking this script as an example: "let part0 = box(40)" is matched with the basic body feature definition by the recognition key box, and an editable box feature tree node is generated; "let part1 = union(part0, box2)" is matched with the boolean feature definition by the recognition key union, and an editable union feature tree node is generated; after the user clicks the box node, the interface layer calls its backfill function to extract the code line parameters to the editing panel, and after the parameters are modified and confirmed, the collection function is called to collect new parameters, and the code line construction function rewrites the code text and executes it.

[0040] The feature tree is rendered line by line based on statement summaries: The interface renders feature tree nodes line by line based on statement summaries. Statements that generate feature tree nodes have one node per line; statements that cannot be recognized or do not generate feature tree nodes are not rendered. Node rendering rules: Statements matching feature definitions are rendered as feature tree nodes. Thumbnails, icons, and human-readable node names are taken from the feature definition's display protocol. Statements not matching feature definitions do not render feature tree nodes and execute normally along with the code text. Feature tree nodes are bound to statement identifiers, not line numbers: When inserting or deleting statements causes the sequence number to advance, the correspondence between nodes and statements is maintained by the statement identifier and does not change due to the sequence number advancement.

[0041] Editability is determined by multiple dimensions: Statements that do not match feature definitions and whose called functions do not return shapes will not render feature tree nodes but will still execute normally. For statements that generate feature tree nodes, if the parameter slots are calculated expressions or the positional parameters are non-variable references, the form editing controls will be unavailable, but the parameter slot editing entry point will be retained: editing will be performed through this entry point using the parameter slot as the editing object, and the editing result will uniformly converge to updating the code text and executing it; for statements that do not render feature tree nodes, their source code can be viewed through the code text and is available to all statements.

[0042] In one implementation, statements that do not match a feature definition are categorized according to the value type of the variables produced in the execution result, forming a default editable third type of feature tree node. For statements whose called functions return shapes, the interface layer automatically generates default editable feature tree nodes: presented with a default icon (such as a general function icon) and a default name (function name or "package name.function name"), and generates default editing controls according to parameter type—numerical parameters generate numeric input controls, enumeration / union type parameters generate drop-down selection controls, string parameters generate text input controls, boolean parameters generate switch controls, array / vector parameters generate element-by-element numeric input groups, shape / entity reference parameters generate selection controls referencing variables produced by other statements, and expression text parameters generate expression input controls. Parameters that cannot be classified into the above parameter types (such as function references, object literals, complex forms like rest / destructuring, etc.) are not available for default editing controls and cannot be edited through default controls; this situation does not lose parameterization capabilities, and the AI ​​editing channel can rewrite the code text of any statement without restriction (see the AI ​​editing channel in this specification). Shape refers to a type of three-dimensional solid object with geometric data characteristics (such as basic solids, composite solids, and derived solids). These geometric data characteristics include vertex positions and indices, or are registered during object creation via the shape construction interface. The return value is determined based on the runtime type of the variable values ​​produced in the execution result: the statement is executed normally first, and the interface layer checks the value type of the variable produced in the execution result. Only if the value type is "shape" is a default editable feature tree node generated. The generation of the default editable node is delayed until after the statement execution is complete. This determination requires no metadata such as function type definition or parameter declaration. If there is no function type definition, after the user modifies the parameters using the default edit control, the interface layer maps the control values ​​back to the code parameters according to the parameter format of the statement code text (positional parameters in order, named parameters by name), rewrites the code text of the function call statement (keeping the statement position unchanged), and executes the updated code text. For statements whose called functions do not return a shape (such as the numerical calculation function "math.max" or string processing functions), the interface layer does not generate a default editable feature tree node, does not render the feature tree node, and executes normally.

[0043] Optionally, if the called function has a static function type definition provided by the library (such as the TypeScript type declaration of the built-in library or the function signature list exported by the third-party library), the interface layer can also statically determine and generate a default editable node in advance based on the declared return value type, and the default edit control corresponds one-to-one with the declared parameters. This enhancement does not change the path of generating the default node by runtime when no type definition is required.

[0044] The editing protocol is a two-way mapping between backfilling and collection: When an editable node is clicked, the interface layer calls the backfilling function defined by the feature—extracting parameters (such as codeToArgs) from the line of code text and writing them into the tool status, recording the identifier of the statement being edited, and activating the corresponding tool mode; after the user modifies the parameters in the panel or editing control and confirms, the interface layer calls the collection function to collect the new set of parameters, and the line of code is rewritten into new code text by the code line construction function (keeping the statement position unchanged), and the updated code text is executed to generate a new execution result. Parameters support both literal and parameter reference formats: literal parameters are edited through backfilling / collection and code line rewriting; parameter reference format slots (referencing variables or parameter declaration lines generated by other statements) are edited via the parameter slot editing entry point of the feature tree node: the parameter slot editing entry point is the editing control provided for the parameter slot on the feature tree node. The interface layer writes the edited value back to the position of the parameter slot in the code text, and the editing result is uniformly converged into updated code text and executed; the fine mechanism of parameter slot editing (recording of parameter slot source information, editing intent-driven editing units, character range fidelity replacement, and cross-file positioning of parameter declaration lines via parameter reference) is disclosed in related application six. For statements that generate default editable feature tree nodes without matching feature definitions, their editing backwrite is performed according to the parameter format of the statement's code text: the interface layer maps the edited parameters collected by the default editing control back to the code parameters according to the parameter arrangement format in the statement's code text (positional parameters in order, named parameters in name), rewrites the statement's code text (keeping the statement position unchanged), executes the updated code text, and generates a new execution result. The execution results are processed by a unified consumer terminal as updated geometric data and scene trees; the specific processing by this consumer terminal is outside the scope of this application.

[0045] Figure 3 This demonstrates a unified editing workflow. All editing actions in this system converge to "update code text and execute": UI form editing rewrites the line (without changing its position) using a code line construction function, then updates the code text; parameter editing rewrites the parameter line; deletion operations delete the line and cascade downstream operations, then update the code text; AI editing directly rewrites the code text (any statement, including calls the UI doesn't recognize). After unified consolidation, the updated code text is executed, generating a new execution result. The execution result includes the complete set of output variables (all shape variables, including multiple outputs and unregistered third-party combinations), terminal geometry, assembly / grouping structure, and active non-geometric values ​​(return values ​​from third-party measurement / query functions). The interface layer uses this data to construct feature trees, scene trees, and assembly trees. The execution interface uses the code text as the entry point and the updated code text as input. The interface layer and the code execution engine communicate via code text and statement summaries.

[0046] In one implementation, the feature registry organizes feature definitions by functional domain, and each geometric tool is registered in the form of a feature definition: each feature definition declares an identification key (a set of operation names), a line-of-code construction function (interface parameters → a line of code text), a parameter normalization function, a display protocol, and an editor; the line-of-code construction function produces the function name, position input, output variable, and parameter object of the line of code, and the output variable name is deduced and assigned by the naming service according to the number of inputs and the used variable names. The editing loop is as follows: After an editable node is clicked, the code line parameters are extracted into interface parameters by the backfill function, and the identifier of the statement being edited is recorded (parameters include literals and parameter reference forms). After the user confirms the parameter modification, the collection function collects the new parameter set, and the code line construction function rewrites the line into new code text while keeping the statement position unchanged. The updated code text is then executed, and a new execution result is generated. Parameter slots in parameter reference form are edited through the parameter slot editing entry of the feature tree node. The editing results are uniformly converged into updated code text and executed. The statement identifier is a stable sequence number assigned according to the order of appearance of the statement in the code text. It remains unchanged during the rewriting while keeping the statement position unchanged. When inserting or deleting a statement, the statement sequence number after the insertion point is extended. The rewriting does not disturb other statements.

[0047] In one implementation, the interface editing channel and the AI ​​editing channel coexist. Interface editing channel: For statements that do not match feature definitions but return a shape, a default editable feature tree node is generated. The interface layer edits the parameters of this operation using the default editing controls (editing parameters of the default feature type). AI editing channel: For any statement (including statements without registered features, without function type definitions, or unrecognizable statements), AI rewrites its code text, unrestricted by the feature registry and function type definitions. It can rewrite any statement and execute the updated code text to generate a new execution result. Thus, operations not recognized by the UI can still be modified—the interface layer edits parameters via default editable nodes, and AI rewrites code without restriction; when the interface channel is absent (unregistered or does not generate editable feature tree nodes), the AI ​​channel automatically completes the code, and the parameterization capability does not depend on the UI feature coverage.

Claims

1. A 3D modeling method decoupling code text and feature tree, characterized in that, include: The code text is maintained in a scripting programming language, and the modeling operation is implemented by executing the code text; the code text is written and injected by artificial intelligence in a scripting programming language, and / or statements are continuously appended to the code text by user interface operation during the modeling process, and the modeling statements written by artificial intelligence and the modeling statements appended by user interface operation coexist in the same code text; The feature registry is maintained by the interface layer. Each feature definition in the feature registry declares an identification key, a code line construction function, and an editing protocol. The identification key includes the function name of the calling function and, optionally, the package name. Artificial intelligence uses scripting programming languages ​​to write modeling code. Its code structure is not limited by the code templates that can be generated or edited by the user interface, nor is it constrained by the features already registered in the feature registry. The statements in the code text do not embed the declarations of their corresponding feature definitions. The correspondence between statements and feature definitions is determined by the interface layer based on the aforementioned feature registry. Execute the code text to obtain the execution result, which includes the runtime return values ​​generated by the execution of each statement; Obtain a statement summary of the code text. The statement summary is a sequence of summaries arranged in the order of the statements and includes at least the package name, function name, output variables, and parameters of the calling function. Statements that do not contain corresponding entries in the statement summary are unrecognizable statements. The interface layer does not generate feature tree nodes for them, but the statements are still executed as normal according to the code text. For each function call statement in the statement summary, the interface layer performs a match based on its package name and function name against the identification key in the feature registry, independent of the statement's source: If a statement matches a feature definition, an editable feature tree node is automatically generated after the code text is executed, and interactive editing is provided according to the feature definition's editing protocol; if no feature definition is matched, the statement is executed normally, and its shape type is determined based on the runtime return value generated after execution: for unmatched statements with a return value of a shape, a default editable feature tree node is automatically generated and displayed in the feature tree. The generation of the default editable feature tree node does not require pre-registration of the function's feature definition in the feature registry; for unmatched statements with a return value other than a shape, no feature tree node is generated, the statement is executed normally, and the modeling process is not interrupted.

2. The method according to claim 1, characterized in that, The editing protocol includes a backfill function and a collection function: the backfill function extracts the parameters in the statement code text into interface parameters and records the statement identifier being edited. The statement identifier is a stable sequence number assigned according to the order in which the statement appears in the code text. The parameters include literal parameters and parameter slots in parameter reference form. The collection function gathers the interface parameters into a new parameter set; during editing, the original statement is located by the statement identifier, and the code text of the statement is rewritten while keeping the statement position unchanged.

3. The method according to claim 1, characterized in that, The feature tree node provides an entry point for parameter slot editing in the form of parameter references. The parameter slot editing results are uniformly converged into updated code text and executed.

4. The method according to claim 1, characterized in that, The feature definition also declares a display protocol, which includes thumbnails of feature tree nodes, human-readable node names, and detailed descriptions. The thumbnails are visual previews of the modeling results corresponding to the feature, and the node names consist of human-readable text generated from feature type and key parameter values. The interface layer renders the feature tree nodes according to the display protocol.

5. The method according to claim 1, characterized in that, The statement summary is a sequence of summaries arranged in the order of statement appearance, containing statement identifiers. The statement identifiers remain unchanged during rewriting while keeping the statement's position constant. When inserting or deleting statements in the code text, the statement sequence number after the insertion point is shifted sequentially, and the statement identifiers do not drift due to local rewriting of their parameter values ​​or positions. The interface layer renders feature tree nodes according to the statement summaries. Statements that generate feature tree nodes correspond one-to-one with the nodes through the statement identifiers, and statements that do not generate feature tree nodes are not rendered.

6. The method according to claim 1, characterized in that, The package name in the identification key can be omitted. An identification key with an omitted package name only matches function call statements without a package name, while an identification key with a package name only matches function call statements with the same package name.