A method and system for generative controlled execution of local CAD drawings
Patent Information
- Application Number
- CN202611142829.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-09-29
AI Technical Summary
[0009]本发明的目的是为了克服现有技术中的不足,针对现有CAD自动绘图过程中存在的绘图脚本环境依赖强、工程数据下发存在泄露风险以及本地绘图执行过程难以控制的问题,提供一种生成式受控执行的CAD本地绘图方法及系统,在不依赖本地脚本开发环境的前提下,将原始地下管线数据及用户绘图配置生成受控执行的本地绘图执行包,通过受控执行机制驱动本地CAD软件完成绘制,从而在保障工程数据安全的同时,降低绘图计算机环境配置要求,并对用户的绘图执行行为进行有效约束
[0042]1.本发明通过对绘图控制模型和数据子集进行封装生成本地绘图执行包,使该执行包能够在无需外部脚本引擎解析的情况下直接在已安装CAD软件的客户端环境中独立运行。由此,实现了绘图逻辑与本地开发环境的解耦,无需预先配置复杂的脚本解释器或插件即可完成图纸绘制,显著降低了部署成本和环境依赖。
Smart Images

Figure CN122839474A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer-aided design technology, specifically to a method and system for completing local drawing based on a generative control model and driven by a controlled execution mechanism using CAD software. Background Technology
[0002] With the widespread application of CAD technology in engineering design, planning, and drafting, the demand for automatically generating CAD drawings from specific engineering data is increasing. Existing technologies commonly employ automatic CAD drawing methods, including script-based automatic drawing, parametric drawing, and automatic drawing implemented through plugins or secondary development interfaces.
[0003] In the above technical solutions, it is usually necessary to pre-deploy a specific script interpretation environment or development environment in the local computer environment, and directly drive the CAD software to complete the drawing operations through script code or parameter instructions. This type of approach has the following shortcomings in practical applications:
[0004] On the one hand, the automatic drawing process is highly dependent on the local operating environment, which usually requires users to have the corresponding script running environment or plugin installation and maintenance capabilities, increasing deployment and usage costs, and has poor compatibility in different terminal environments.
[0005] On the other hand, existing automatic drawing solutions often require the complete engineering or design data to be directly sent to the local execution environment, and the local script or plugin will parse and draw the data. During the execution process, there is a lack of effective constraints on the scope of data access and drawing behavior, and it is difficult to limit the execution path of drawing operations and the way data is used.
[0006] Furthermore, automatic drawing solutions based on fixed plugins or local scripts typically have their drawing logic tightly bound to the local execution environment. When drawing rules, engineering standards, or drawing requirements change, it is often necessary to redevelop, deploy, or upgrade the plugin program or script, making it difficult to respond to new drawing needs in a timely manner and hindering the continuous iteration and flexible expansion of the automatic drawing system.
[0007] Meanwhile, in existing technologies, CAD automatic drawing logic mostly exists in the form of script code or command sequences. The execution process has a high degree of freedom, making it difficult to uniformly and clearly control the type, sequence, and accessible data range of drawing operations. This is detrimental to ensuring the accuracy of drawing operations. Figure 1 While ensuring consistency, the drawing execution process is managed.
[0008] Therefore, how to achieve local automatic CAD drawing without relying on fixed plugins or local script development environments, effectively constrain drawing operations and data access during the drawing process, and improve the flexibility of drawing rule adjustments and system upgrades has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of existing technologies and address the problems of strong dependence on the drawing script environment, risk of leakage during engineering data distribution, and difficulty in controlling the local drawing execution process in existing CAD automatic drawing processes. This invention provides a generative and controlled execution CAD local drawing method and system. Without relying on a local script development environment, it generates a controlled execution local drawing package from the original underground pipeline data and user drawing configurations. This controlled execution mechanism drives the local CAD software to complete the drawing, thereby ensuring the security of engineering data, reducing the configuration requirements of the drawing computer environment, and effectively constraining the user's drawing execution behavior.
[0010] The objective of this invention is achieved through the following technical solution:
[0011] A generatively controlled execution method for local CAD drawing includes:
[0012] Obtain basic drawing information and raw drawing data. The basic drawing information includes at least layer information, primitive drawing information, data mapping information, and project information.
[0013] Minimize and prune the original plotting data to generate a subset of data that retains only the necessary data to complete the plotting;
[0014] A drawing control model is generated based on the basic drawing information. The drawing control model includes an atomic interface layer and a drawing process orchestration layer. The atomic interface layer is used to call the CAD interface to implement a set of atomic operations for layer control, drawing points, lines, annotations and primitives. The drawing process orchestration layer is used to generate the calling sequence and execution order of the atomic operations according to the drawing requirements to complete the drawing task.
[0015] The data subset is encapsulated with the drawing control model to generate a local drawing execution package, which is a self-contained executable unit that can run independently in the client environment;
[0016] Run the local drawing execution package in the local environment where the target CAD software is installed, and draw the required drawings by calling the local drawing interface of the target CAD software;
[0017] Generate the corresponding CAD drawing file as the drawing result.
[0018] Furthermore, the step of minimizing and cropping the original drawing data includes:
[0019] Based on the layer information and data mapping information in the basic drawing information, the field columns required for drawing are filtered out from the original drawing data;
[0020] Based on the drawing range conditions specified by the user, extract data rows that meet the drawing range conditions from the original drawing data;
[0021] The filtered field columns are combined with the extracted data rows to generate the data subset.
[0022] Furthermore, the drawing control model includes at least:
[0023] The atomic interface layer stores multiple atomic operation units in the form of structured data, and each atomic operation unit corresponds to a call function of the target CAD software's local drawing interface.
[0024] Furthermore, the drawing process orchestration layer includes:
[0025] Execution order description information is used to define the calling order among the atomic operation units;
[0026] Data mapping relationship information is used to define the data fields that each atomic operation unit needs to access and their access methods;
[0027] Execution constraint information is used to limit the operational boundary conditions of the drawing control model.
[0028] Furthermore, when running the local drawing execution package, the controlled execution mechanism includes:
[0029] Perform integrity verification: Before performing drawing operations, perform integrity verification on the local drawing execution package. If the verification fails, terminate the drawing execution.
[0030] Execution path control only supports execution according to a predefined order of atomic operations, and does not support jump execution, repeated execution, or inserted execution.
[0031] Data access control: The local drawing execution package only allows atomic operation units to access the associated subset of data in the drawing control model, and prohibits access to unassociated data.
[0032] The present invention also provides a generatively controlled execution local CAD drawing system, comprising:
[0033] Drawing task generation module: used to obtain basic drawing information and raw drawing data. The basic drawing information includes at least layer information, primitive drawing information, data mapping information and project information.
[0034] Data trimming module: Used to minimize and trim the original drawing data, generating only the subset of data necessary to complete the drawing;
[0035] Control Model Generation Module: Used to generate a drawing control model based on the basic drawing information. The drawing control model includes an atomic interface layer and a drawing process orchestration layer. The atomic interface layer is used to call the CAD interface to implement a set of atomic operations for layer control, drawing points, lines, annotations and primitives. The drawing process orchestration layer is used to generate the calling sequence and execution order of the atomic operations according to the drawing requirements to complete the drawing task.
[0036] Execution package generation module: used to encapsulate the drawing control model and data subset to generate a local drawing execution package, wherein the local drawing execution package is a self-contained executable unit that can run independently in the client environment;
[0037] The execution module is used to run the local drawing execution package in the local environment where the target CAD software is installed, and to draw the required drawings by calling the local drawing interface of the target CAD software.
[0038] The generation module is used to generate corresponding CAD drawing files as the drawing result.
[0039] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a local CAD drawing method.
[0040] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a local CAD drawing method.
[0041] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:
[0042] 1. This invention encapsulates the drawing control model and data subset to generate a local drawing execution package, enabling this package to run independently in the client environment where CAD software is already installed, without requiring an external script engine for parsing. This decouples the drawing logic from the local development environment, allowing drawing to be completed without pre-configuring complex script interpreters or plugins, significantly reducing deployment costs and environment dependencies.
[0043] 2. This invention employs a two-stage pruning process—field filtering and row truncation—to generate a minimal subset of data necessary for completing the current drawing task. Since irrelevant fields and rows are removed during the pruning process, this subset cannot be used to reconstruct the complete original drawing data. Therefore, the path for unnecessary data to be distributed is severed at the data source, effectively ensuring engineering data security and reducing the risk of data leakage.
[0044] 3. This invention, through the atomic interface layer and drawing process orchestration layer in the drawing control model, limits the set of atomic operations allowed to be executed during drawing execution and their invocation order. Simultaneously, the local drawing execution package only allows atomic operation units to access the data subsets associated with the data mapping relationship during execution, and does not support jump execution, repeated execution, or inserted execution. Therefore, it ensures dual control over the drawing operation path and data access scope, achieving consistency and controllability of local drawing behavior. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating the present invention. Detailed Implementation
[0046] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only for explaining the present invention and are not intended to limit the present invention.
[0047] Example 1
[0048] This embodiment adopts a technical architecture of generative control model construction and local controlled execution under the B / S (browser / server) architecture.
[0049] Specifically, users access the drawing service page of this invention through a browser on the client side. In the browser interface, they specify drawing range conditions (such as spatial range, pipeline type, etc.) and drawing parameters through interactive operations. Based on the user's interactive input, the client browser minimizes and trims the local original drawing data to generate a subset of data that retains only the data necessary to complete the drawing, and sends the subset of data along with the basic drawing information to the server.
[0050] After receiving the above information, the server performs two main actions: firstly, it minimizes and prunes the original drawing data according to the user-specified drawing range conditions, generating only the data subset necessary to complete the drawing; secondly, it generates a drawing control model based on the basic drawing information. Subsequently, the server encapsulates the drawing control model and the data subset into a drawing execution package that can run independently locally, and then distributes this execution package to the client.
[0051] After receiving the executable package, the client runs it directly in the local environment where the target CAD software is installed. The controlled execution logic inside the executable package drives the CAD software to complete the drawing.
[0052] For details, see Figure 1 The steps of the generatively controlled execution local CAD drawing method in this embodiment are as follows:
[0053] S1. Obtain basic drawing information and raw drawing data.
[0054] Users access the drawing service page through a browser on the client side and input basic drawing information through page interaction, including:
[0055] 101) Layer information, including layer name, color, and related configuration information;
[0056] 201) Drawing information for graphic elements, specifying the drawing requirements for points, lines, annotations, and graphic elements in the required drawing;
[0057] 301) Data mapping information, which is the configuration information of the field columns in the original drawing data required by the user, such as the coordinate column name of the drawing point, the point type column name, etc.;
[0058] 401) Project information, including project name, person in charge, region, and drawing name.
[0059] At the same time, the user-specified drawing range conditions are obtained through browser interaction. The drawing range conditions include spatial range conditions and / or pipeline type conditions.
[0060] The original drawing data includes at least the spatial geometric information of the graphic and the necessary engineering attribute information.
[0061] S2. Minimize and crop the original drawing data on the browser side to generate a data subset.
[0062] The client browser filters out the required fields from the original drawing data based on the layer information and data mapping information in the basic drawing information; at the same time, it extracts data rows that meet the drawing range conditions specified by the user through the browser; and combines the filtered fields with the extracted data rows to generate a data subset.
[0063] The data subset retains only the data necessary to complete the current plotting task. Because some fields and some row records have been removed, it is impossible to reverse and restore the complete original plotting data.
[0064] Optionally, a subset of data can be symmetrically encrypted (such as using the AES algorithm) before being uploaded to the server to further enhance data security during transmission.
[0065] S3, The server generates the drawing control model.
[0066] The server receives basic drawing information and a subset of data uploaded by the client, and generates a drawing control model based on the basic drawing information. The drawing control model includes an atomic interface layer and a drawing flow orchestration layer.
[0067] The atomic interface layer stores multiple atomic operation units in the form of structured data. Each atomic operation unit corresponds to a call function of the target CAD software's local interface, which is used to implement atomic operations for layer control, drawing points, lines, annotations, and primitives.
[0068] The drawing process orchestration layer includes:
[0069] (1) Execution order description information, used to define the calling order between atomic operation units;
[0070] (2) Data mapping relationship information, used to define the data fields that each atomic operation unit needs to access and their access methods;
[0071] (3) Execution constraint information, used to limit the operational boundary conditions of the drawing control model.
[0072] S4. The server generates a controlled local drawing execution package and sends it to the client.
[0073] The server encapsulates the drawing control model and data subset to generate a local drawing execution package (such as an EXE file). This local drawing execution package is an executable unit that does not require external script engine parsing and contains controlled execution logic. The local drawing execution package includes: the drawing control model, the data subset, and integrity verification information.
[0074] After the server generates the local drawing execution package, it sends it to the client.
[0075] S5. Perform drawing in a controlled manner in the local environment.
[0076] After receiving the local drawing execution package, the client runs the package in the local environment where the target CAD software is installed. The execution process includes the following sub-steps:
[0077] (1) Perform integrity verification: Before starting the drawing execution, perform integrity verification on the local drawing execution package. Only after the verification is passed can the drawing operation be allowed;
[0078] (2) Analyze the drawing control model;
[0079] (3) The drawing process orchestration layer calls each atomic operation unit in sequence according to the execution order description information. Each atomic operation unit completes the corresponding drawing operation by calling the local interface of the target CAD software.
[0080] (4) During execution, each atomic operation unit is only allowed to access the data fields associated with it in the data mapping relationship, and has no right to access any data outside the data subset.
[0081] During execution, jump execution, repeated execution, or inserted execution is not supported, and access to data not defined in the drawing control model is not allowed.
[0082] In addition, to avoid failure when a certain operation calling the CAD interface fails, each specific drawing behavior (i.e., the operation calling the CAD interface) in this embodiment is placed in a loop function. When the calling behavior runs successfully, the loop terminates; when an error occurs, the loop is re-executed. If the number of single drawing attempts exceeds a time threshold (e.g., 3 minutes), the drawing behavior is skipped, the error message is output, and the abnormal data is recorded in the log.
[0083] S6. Generate plotting results.
[0084] After all atomic operation units are executed, the CAD software generates the corresponding CAD drawing file as the drawing result.
[0085] To ensure controllability in the drawing execution process, this embodiment introduces a controlled execution mechanism in step S5, specifically including:
[0086] (1) Execution path control: The local drawing execution package only supports execution according to the predefined atomic operation order in the drawing control model, and does not support jump execution, repeated execution or insertion execution;
[0087] (2) Data access control: The local drawing execution package only allows atomic operation units to access the associated subset of data in the drawing control model, and prohibits access to unassociated data;
[0088] (3) Perform integrity check: Before performing drawing operations, check the integrity of the local drawing execution package. If the check fails, the drawing execution will be terminated.
[0089] Example 2
[0090] This embodiment is based on Embodiment 1 and takes the automatic CAD drawing of underground pipeline engineering as an example for further explanation.
[0091] The local CAD drawing method for underground pipelines based on generative controlled execution provided in this embodiment is as follows:
[0092] S1. Obtain basic drawing information and initialize the underground pipeline drawing task:
[0093] Users can view, organize, and segment local underground pipeline raw data through an interactive browser interface on the client side. The raw data of underground pipelines is stored locally and includes at least pipeline spatial geometry information, pipeline type identifiers, and pipeline engineering attribute information. Users specify drawing range conditions (such as spatial range, pipeline type, etc.) and drawing parameters through interactive operations in the browser interface.
[0094] In this embodiment, the original dataset of underground pipelines is recorded in two tables in Excel file format: a point table and a line table. Some data examples are shown in Table 1 and Table 2 below:
[0095] Table 1 Point Sheet
[0096]
[0097] Table 2 Line Sheet
[0098]
[0099] Simultaneously, drawing parameters are obtained through the user interface. These parameters include: layer mapping rules, pipeline linetype and symbol rules, annotation generation rules, and output drawing scale and format requirements. This embodiment generates a configuration file based on these drawing parameters, as shown in the following example:
[0100] <?xml version="1.0" encoding="UTF-8"?>
[0101] <config id="config">
[0102] <projectinfo id="project_info">
[0103] <item id="project_name" value="测试工程" / >
[0104] <item id="project_manager" value="张三" / >
[0105] <item id="project_work_id" value="123123" / >
[0106] <item id="upload_time" value="2025-12-25 14:23:56" / >
[0107] < / projectinfo>
[0108] <pointsheet id="point_sheet">
[0109] <sheetname id="point_sheet_name" value="point_sheet" / >
[0110] <columns id="point_sheet_columns">
[0111] <column id="point_id" value="检查井编码" / >
[0112] <column id="point_x" value="坐标X" / >
[0113] <column id="point_y" value="坐标Y" / >
[0114] <column id="point_z" value="地面高程(米)" / >
[0115] <column id="point_type" value="类型" / >
[0116] <column id="point_feature" value="附属物" / >
[0117] < / columns>
[0118] <typemapping id="point_sheet_type_mapping">
[0119] <mapping id="mapping_type" column="类型">
[0120] <item id="item_type_0" value="雨水" category="YS" / >
[0121] <item id="item_type_1" value="污水" category="WS" / >
[0122] < / mapping>
[0123] < / typemapping>
[0124] <featuremapping id="point_sheet_feature_mapping">
[0125] <mapping id="mapping_feature" column="特征">
[0126] <item id="item_feature_0" value="雨水井" category="YSPoint" / >
[0127] <item id="item_feature_1" value="雨水箅" category="SSPoint" / >
[0128] <item id="item_feature_2" value="来水方向" category="OOPoint" / >
[0129] < / mapping>
[0130] < / featuremapping>
[0131] < / pointsheet>
[0132] <linesheet id="line_sheet">
[0133] <sheetname id="line_sheet_name" value="line_sheet" / >
[0134] <columns id="line_sheet_columns">
[0135] <column id="line_start_point_id" value="起点编码" / >
[0136] <column id="line_end_point_id" value="终点编码" / >
[0137] <column id="line_material" value="管道材质" / >
[0138] <column id="line_diameter" value="管径(mm)" / >
[0139] <column id="line_direction" value="水流方向" / >
[0140] <column id="line_type" value="管道类别" / >
[0141] < / columns>
[0142] <typemapping id="line_sheet_type_mapping">
[0143] <mapping id="mapping_line_type" column="起始点类型">
[0144] <item id="item_line_type_0" value="雨水" category="YS" / >
[0145] <item id="item_line_type_1" value="污水" category="WS" / >
[0146] < / mapping>
[0147] < / typemapping>
[0148] <directionmapping id="line_sheet_direction_mapping">
[0149] <mapping id="mapping_direction_0" column="流向">
[0150] <item id="item_direction_0_0" value="顺流" category="S" / >
[0151] <item id="item_direction_0_1" value="逆流" category="N" / >
[0152] < / mapping>
[0153] < / directionmapping>
[0154] < / linesheet>
[0155] <layerconfig id="layer_config">
[0156] <layers id="layers">
[0157] <layer id="layer_yspoint" value="YSPOINT" / >
[0158] <layer id="layer_ystext" value="YSTEXT" / >
[0159] <layer id="layer_ysline" value="YSLINE" / >
[0160] <layer id="layer_yscq" value="YSCQ" / >
[0161] <layer id="layer_wspoint" value="WSPOINT" / >
[0162] <layer id="layer_wstext" value="WSTEXT" / >
[0163] <layer id="layer_wsline" value="WSLINE" / >
[0164] <layer id="layer_wscq" value="WSCQ" / >
[0165] <layer id="layer_sspoint" value="SSPOINT" / >
[0166] <layer id="layer_sstext" value="SSTEXT" / >
[0167] <layer id="layer_ssline" value="SSLINE" / >
[0168] <layer id="layer_sscq" value="SSCQ" / >
[0169] < / layers>
[0170] <colors id="colors">
[0171] <color id="color_yspoint" value="4" / >
[0172] <color id="color_ystext" value="4" / >
[0173] <color id="color_ysline" value="4" / >
[0174] <color id="color_yscq" value="4" / >
[0175] <color id="color_wspoint" value="1" / >
[0176] <color id="color_wstext" value="1" / >
[0177] <color id="color_wsline" value="1" / >
[0178] <color id="color_wscq" value="1" / >
[0179] <color id="color_sspoint" value="2" / >
[0180] <color id="color_sstext" value="2" / >
[0181] <color id="color_ssline" value="2" / >
[0182] <color id="color_sscq" value="2" / >
[0183] <color id="color_hspoint" value="3" / >
[0184] <color id="color_hstext" value="3" / >
[0185] <color id="color_hsline" value="3" / >
[0186] <color id="color_hscq" value="3" / >
[0187] < / colors>
[0188] < / layerconfig>
[0189] ... (Other drawing configuration information)
[0190] < / config> .
[0191] S2. Minimize and prune the original data on the client side to generate a data subset;
[0192] The client browser filters out the necessary fields for drawing from the locally loaded underground pipeline raw data based on the layer information and data mapping information in the basic drawing information. At the same time, based on the drawing range conditions (such as spatial range, pipeline type, etc.) specified by the user through the browser, it extracts data rows that meet the drawing range conditions from the raw data. The filtered fields and the extracted data rows are combined to generate a data subset.
[0193] The data subset retains only the data necessary to complete the current drawing task. Because some fields and rows have been removed, it is impossible to reconstruct the complete original underground pipeline dataset. After trimming, the client uploads the basic drawing information and the data subset to the server. The original data remains locally on the client and does not leave the user's computing environment.
[0194] Optionally, a subset of data can be symmetrically encrypted (such as using the AES algorithm) before being uploaded to the server to further enhance the security of data transmission.
[0195] The cropped data subset in this embodiment is as follows:
[0196] Data subset (point)
[0197]
[0198] Data subset (line)
[0199]
[0200] S3. The server generates a drawing control model;
[0201] The server receives basic drawing information and a subset of data uploaded by the client, and generates a drawing control model based on the basic drawing information. The drawing control model includes an atomic interface layer and a drawing flow orchestration layer.
[0202] The atomic interface layer contains multiple atomic drawing functions, each corresponding to a call encapsulation of a target CAD software's native interface, used to implement basic drawing operations that meet the requirements for drawing underground pipeline engineering drawings. In this embodiment, the atomic interface layer includes at least the following atomic drawing functions:
[0203] The point drawing function is used to draw pipeline points, pipe points, or measurement control points at specified coordinate locations.
[0204] The line drawing function is used to draw the centerline or segment of a pipeline based on the coordinates of the starting point and the ending point.
[0205] The annotation function is used to draw pipeline numbers, elevations, or pipeline attribute labels at specified locations;
[0206] The Insert Block function is used to insert standard device symbols or legends at a specified location.
[0207] Each atomic drawing function is defined according to a unified interface specification, receiving inputs such as coordinate parameters, layer parameters, color parameters, and style parameters. It completes specific drawing operations by calling the underlying CAD interface. The atomic interface layer only contains the definitions of the aforementioned atomic drawing functions; it does not contain any business logic, flow control, or data traversal code, nor does it contain any freely executable script code.
[0208] Here, we take the function of drawing points as an example:
[0209] def draw_point(self, block_path, p, p1, t, textlayer, pointlayer):
[0210] start_time = time.time()
[0211] last_exception = None
[0212] while time.time() - start_time < 30:
[0213] try:
[0214] self.acad.ActiveDocument.ActiveLayer = self.acad.ActiveDocument.Layers.Item(textlayer)
[0215] text = self.acad.model.AddText(t, p1, textSize)
[0216] self.ActiveLayer = self.acad.ActiveDocument.Layers.Item(pointlayer)
[0217] block = self.acad.model.InsertBlock(p, block_path, xRate,yRate, zRate, 0)
[0218] return text.handle, block.handle
[0219] except:
[0220] traceback.print_exc()
[0221] last_exception = e
[0222] time.sleep(0.1)
[0223] continue
[0224] raise TimeoutError(f"Function execution exceeded {timeout} seconds, last exception: {last_exception}")
[0225] The drawing process orchestration layer contains flow control code generated based on user-provided drawing parameters and data subsets. This code reads data from the data subset according to a predefined execution order and calls the corresponding atomic drawing functions in the atomic interface layer to complete the drawing task of underground pipeline diagrams. The drawing process orchestration layer includes:
[0226] (1) Execution order description information, used to define the calling order between each drawing step. In this embodiment, the execution order of drawing underground pipeline drawings is as follows: first, draw pipeline points, then draw point number annotations next to each pipeline point, and finally draw pipeline segments according to the topological connection relationship between pipeline points;
[0227] (2) Data mapping relationship information, used to define the data fields to be accessed in each drawing step and the access method thereon. For example, the point drawing step needs to access the “coordinate X”, “coordinate Y” and “inspection well code” fields in the point table; the line drawing step needs to access the “starting point code” and “ending point code” fields in the line table, and obtain the starting and ending point coordinates by associating the point table with the starting point code and the ending point code;
[0228] (3) Execution constraint information, used to limit the running boundary conditions of the drawing control model, including target CAD software version compatibility requirements and running timeout control, etc.
[0229] Here, we'll take the main code as an example:
[0230] def drawData(self):
[0231] self.dt = drawUtils()
[0232] print('Drawing tools initialization complete')
[0233] pointList = []
[0234] self.root = self.loadConfig(ConfigXML)
[0235] print('Basic drawing information read complete')
[0236] self.dt.sort_layer(self.root)
[0237] print('Layer configuration complete')
[0238] self.tpf = self.getPointData(dataSet)
[0239] self.ldf = self.getLineData(dataSet)
[0240] print('Data subset reading completed')
[0241] print('Start plotting points')
[0242] for index, row in self.tpf.iterrows():
[0243] try:
[0244] leixingFlag = get_value_by_id(self.root, 'point_type')
[0245] POINTLAYER, TEXTLAYER = self.getPointLayerConfig(self.root, row[leixingFlag])
[0246] x = float(row[get_value_by_id(self.root, 'point_x')])
[0247] y = float(row[get_value_by_id(self.root, 'point_y')])
[0248] z = float(row[get_value_by_id(self.root, 'point_z')] or 0)
[0249] pointText = row[get_value_by_id(self.root, 'point_id')]
[0250] pointjson = {'id': pointText, 'x': x, 'y': y, 'z': z}
[0251] pointList.append(pointjson)
[0252] p = APoint(y, x, z)
[0253] p1 = APoint(y + self.offsetX, x + self.offsetY, 0)
[0254] featureFlag = get_value_by_id(self.root, '"point_feature')
[0255] BLOCKTYPE = self.getBlock(self.root, row[featureFlag])
[0256] self.dt.draw_point(BLOCKTYPE, p, p1, pointText, TEXTLAYER,POINTLAYER)
[0257] except:
[0258] print('Incorrect point list: ' + str(index) + ', Number: ' + str(pointText))
[0259] traceback.print_exc()
[0260] print('Diagram completed').
[0261] S4. Generate a local drawing execution package. The server encapsulates the drawing control model generated in step S3 and the data subset generated in step S2 to generate a local drawing execution package. The local drawing execution package includes at least: a drawing control model file, a drawing data subset file, and execution verification information. The local drawing execution package is an executable unit that does not require external script engine parsing and contains controlled execution logic.
[0262] S5. Controlled execution of local drawing: After receiving the local drawing execution package, the client runs the package in the local environment where the target CAD software is installed. The execution process includes:
[0263] (501) Pre-execution verification: Perform integrity verification on the local drawing execution package. After the verification is passed, proceed to the drawing execution stage;
[0264] (502) Control Model Analysis: Analyze the drawing control model, construct the drawing execution queue according to the execution order description information in the drawing process orchestration layer, and load the data subset corresponding to each atomic drawing operation unit according to the data access mapping field;
[0265] (503) Controlled drawing execution: The drawing operation is executed by calling the corresponding CAD interface one by one according to the atomic drawing operation sequence defined in the drawing control model. During the execution, each atomic drawing operation unit can only access its mapped data field; jump execution, repeated execution or insertion execution is not supported.
[0266] S6. Drawing Result Generation: After completing all drawing operations, the CAD software generates underground pipeline CAD drawings as the drawing result.
[0267] Example 3
[0268] Based on the same inventive concept, this application also provides a generatively controlled execution CAD local drawing system, which can be used to implement the method described in Embodiment 1, specifically including the following:
[0269] Drawing task generation module: used to obtain basic drawing information and raw drawing data. The basic drawing information includes at least layer information, primitive drawing information, data mapping information and project information.
[0270] Control Model Generation Module: Used to generate a drawing control model based on the basic drawing information. The drawing control model includes an atomic interface layer and a drawing process orchestration layer. The atomic interface layer is used to call the CAD interface to implement a set of atomic operations for layer control, drawing points, lines, annotations and primitives. The drawing process orchestration layer is used to generate the calling sequence and execution order of the atomic operations according to the drawing requirements to complete the drawing task.
[0271] Data trimming module: Used to minimize and trim the original drawing data, generating only the subset of data necessary to complete the drawing;
[0272] Execution package generation module: used to encapsulate the drawing control model and data subset to generate a local drawing execution package, wherein the local drawing execution package is a self-contained executable unit that can run independently in the client environment;
[0273] The execution module is used to run the local drawing execution package in the local environment where the target CAD software is installed, and to draw the required drawings by calling the local drawing interface of the target CAD software.
[0274] The generation module is used to generate corresponding CAD drawing files as the drawing result.
[0275] Preferably, embodiments of this application also provide a specific implementation of an electronic device capable of implementing all steps of the generatively controlled execution CAD local drawing method in the above embodiments. The electronic device specifically includes the following:
[0276] Processor, memory, communications interface, and bus;
[0277] The processor, memory, and communication interface communicate with each other via a bus; the communication interface is used to realize information transmission between server-side devices, metering devices, and user-side devices.
[0278] The processor is used to call a computer program in memory, and when the processor executes the computer program, it implements all the steps in the generatively controlled execution of the CAD local drawing method in the above embodiments.
[0279] Embodiments of this application also provide a computer-readable storage medium capable of implementing all steps of the generatively controlled execution CAD local drawing method in the above embodiments. The computer-readable storage medium stores a computer program that, when executed by a processor, implements all steps of the generatively controlled execution CAD local drawing method in the above embodiments.
[0280] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, hardware + program embodiments are relatively simple in description because they are fundamentally similar to method embodiments; relevant parts can be referred to the descriptions in the method embodiments.
[0281] While this application provides method operation steps as shown in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-inventive labor. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only execution order. In actual device or client product execution, the method can be executed in the order shown in the embodiments or drawings or in parallel (e.g., in a parallel processor or multi-threaded processing environment).
[0282] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0283] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0284] This invention is not limited to the embodiments described above. The above description of specific embodiments is intended to illustrate and explain the technical solutions of this invention. The specific embodiments described above are merely illustrative and not restrictive. Without departing from the spirit and scope of the claims, those skilled in the art can make many specific modifications based on the teachings of this invention, and these modifications all fall within the scope of protection of this invention.
Claims
1. A generatively controlled execution local CAD drawing method, characterized in that, include: Obtain basic drawing information and raw drawing data. The basic drawing information includes at least layer information, primitive drawing information, data mapping information, and project information. Minimize and prune the original plotting data to generate a subset of data that retains only the necessary data to complete the plotting; A drawing control model is generated based on the basic drawing information. The drawing control model includes an atomic interface layer and a drawing process orchestration layer. The atomic interface layer is used to call the CAD interface to implement a set of atomic operations for layer control, drawing points, lines, annotations and primitives. The drawing process orchestration layer is used to generate the calling sequence and execution order of the atomic operations according to the drawing requirements to complete the drawing task. The data subset is encapsulated with the drawing control model to generate a local drawing execution package, which is a self-contained executable unit that can run independently in the client environment; Run the local drawing execution package in the local environment where the target CAD software is installed, and draw the required drawings by calling the local drawing interface of the target CAD software; Generate the corresponding CAD drawing file as the drawing result.
2. The local CAD drawing method according to claim 1, characterized in that, The step of minimizing and cropping the original drawing data includes: Based on the layer information and data mapping information in the basic drawing information, the field columns required for drawing are filtered out from the original drawing data; Based on the drawing range conditions specified by the user, extract data rows that meet the drawing range conditions from the original drawing data; The filtered field columns are combined with the extracted data rows to generate the data subset.
3. The local CAD drawing method according to claim 1, characterized in that, The drawing control model includes at least: The atomic interface layer stores multiple atomic operation units in the form of structured data, and each atomic operation unit corresponds to a call function of the target CAD software's local drawing interface. Furthermore, the drawing process orchestration layer includes: Execution order description information is used to define the calling order among the atomic operation units; Data mapping relationship information is used to define the data fields that each atomic operation unit needs to access and their access methods; Execution constraint information is used to limit the operational boundary conditions of the drawing control model.
4. The local CAD drawing method according to claim 1, characterized in that, When running the local drawing execution package, the controlled execution mechanism includes: Perform integrity verification: Before performing drawing operations, perform integrity verification on the local drawing execution package. If the verification fails, terminate the drawing execution. Execution path control only supports execution according to a predefined order of atomic operations, and does not support jump execution, repeated execution, or inserted execution. Data access control: The local drawing execution package only allows atomic operation units to access the associated subset of data in the drawing control model, and prohibits access to unassociated data.
5. A generatively controlled execution local CAD drawing system for implementing the local CAD drawing method as described in any one of claims 1-4, characterized in that, include: Drawing task generation module: used to obtain basic drawing information and raw drawing data. The basic drawing information includes at least layer information, primitive drawing information, data mapping information and project information. Data trimming module: Used to minimize and trim the original drawing data, generating only the subset of data necessary to complete the drawing; Control Model Generation Module: Used to generate a drawing control model based on the basic drawing information. The drawing control model includes an atomic interface layer and a drawing process orchestration layer. The atomic interface layer is used to call the CAD interface to implement a set of atomic operations for layer control, drawing points, lines, annotations and primitives. The drawing process orchestration layer is used to generate the calling sequence and execution order of the atomic operations according to the drawing requirements to complete the drawing task. Execution package generation module: used to encapsulate the drawing control model and data subset to generate a local drawing execution package, wherein the local drawing execution package is a self-contained executable unit that can run independently in the client environment; The execution module is used to run the local drawing execution package in the local environment where the target CAD software is installed, and to draw the required drawings by calling the local drawing interface of the target CAD software. The generation module is used to generate corresponding CAD drawing files as the drawing result.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the local CAD drawing method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the local CAD drawing method according to any one of claims 1 to 4.