An interactive method for generating AutoCAD assembly drawing parts lists
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-14
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]为了避免现有技术的不足之处,本发明提供一种AutoCAD装配图明细表交互式生成方法,用以解决现有技术中存在手动生成工程项目AutoCAD装配图明细表工作量繁重、无法及时更新的不足的问题
[0042]本公开的实施例中,通过上述AutoCAD装配图明细表交互式生成方法,能够高效高质量处理大批量明细数据,快速生成装配图明细表,使装配图明细表的维护只需要在AutoCAD软件外部进行即可;支持用户进行个性化设置,以匹配不同需求的明细表类型、格式;采用AutoCAD自带的LISP接口,仅利用了最常见的文本写入和字符替换等基本语句,不涉及复杂的功能命令,可靠性得以保障。
Smart Images

Figure CN117933208B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of interactive engineering drawing schedules, and more particularly to an interactive method for generating AutoCAD assembly drawing schedules. Background Technology
[0002] Engineering projects often involve hundreds or even thousands of components, parts, and standard parts. To fully and accurately reflect the designer's intent and facilitate the transfer of project information from the design phase to the manufacturing phase, the parts list typically contains a wide variety of detailed information. It generally needs to specify the file types, components, parts, standard parts, purchased parts, and materials involved in the entire assembly drawing. Furthermore, for each item, it is usually necessary to indicate the item's name, its sheet size, the item's drawing number or the standard number it belongs to, the drawing number and quantity of the component or part it contains, the total quantity, and remarks. Therefore, annotating the parts list for assembly drawings in AutoCAD is a tedious and time-consuming task. Additionally, due to the nature of engineering... Figure 1 Generally, in the final stage of engineering design, changes in project requirements or parts of the design can significantly impact engineering drawings. These changes to assembly drawings undoubtedly exacerbate the designer's workload. Under the influence of these two factors, ensuring the accuracy and completeness of the assembly details in the engineering drawings requires immense patience and effort. Omissions, errors, and duplicates frequently occur, posing significant risks to ensuring the project is completed on time and to the required quality.
[0003] Currently, most project development units manually compile assembly drawing lists in AutoCAD software, and no directly related technologies have been found in publicly available information. The main reason is that deep secondary development of AutoCAD software is quite complex. Its latest ObjectARX development interface requires complex configuration and a strong programming foundation, while the earlier LISP interface type was relatively simple, supporting data types and structures that differ significantly from most current object-oriented programming languages, resulting in a substantial amount of code required for developing complex functions. Summary of the Invention
[0004] To avoid the shortcomings of existing technologies, this invention provides an interactive method for generating AutoCAD assembly drawing detail tables, which solves the problems of heavy workload and inability to update AutoCAD assembly drawing detail tables in engineering projects when manually generating them.
[0005] According to an embodiment of this disclosure, an interactive method for generating AutoCAD assembly drawing parts lists is provided, the method comprising:
[0006] Import the detailed table data file filled out according to the preset template; the detailed table data file includes a brief introduction of the detailed table and its specific entries.
[0007] Parse the detail table data file to perform detail clustering and synchronous sorting;
[0008] The parsed detail table data file is used to assemble the detail table configuration, adding the target location and template location of the detail table to generate the runtime script file and initialize the runtime script file.
[0009] Based on the running script file, read the data file of the detail table to be processed, and interactively determine the location information of the detail table to be processed;
[0010] Based on the location information of the to-be-processed parts list and the data file of the to-be-processed parts list, generate the assembly drawing parts list.
[0011] Furthermore, the introductory information should at least include the project code, the name of the bill of quantities, the engineering drawing number, and the relevant personnel. The specific items should at least include the serial number, sheet size, drawing number, type of item, name, and specifications.
[0012] Furthermore, the steps of parsing the detail table data file to perform detail clustering and synchronous sorting include:
[0013] Based on the detail type in the detail table data file, define the corresponding dynamic array structure variable and different types of drawing number character array variables, and obtain the active sheet page, total number of columns, and total number of rows;
[0014] Based on the dynamic array structure variable, the drawing number character array variable, the sheet page, the total number of columns, and the total number of rows, perform detailed clustering and synchronous sorting on the detail table data file.
[0015] Furthermore, the steps of assembling the detailed table configuration into the parsed detailed table data file, adding the detailed table target location and detailed table template location to generate the runtime script file, and initializing the runtime script file include:
[0016] Generate a script execution configuration file, including settings for updating layers and annotation scales;
[0017] Add capture commands and location data output commands for the target location and template location of the detail table;
[0018] After the location data is output, the script runs a command to disable object snap in the configuration file to avoid interference from the object snap function when locating table content later. Then it enters a waiting state.
[0019] When the script execution configuration file generation completion indicator is received, stop waiting and automatically run the generated execution script file;
[0020] After the script file is generated, restore the configuration and the initial settings before running the script.
[0021] Furthermore, the step of reading the data file of the detail table to be processed based on the running script file, and interactively determining the location information of the detail table to be processed, includes:
[0022] After the script file is generated, it enters a waiting state;
[0023] After the user runs the script file in AutoCAD and determines the location of the bill of quantities and the location of the bill of quantities template, the script file outputs a location selection indicator message from the user.
[0024] After capturing the identification information, the location information of the details table to be processed is input, and the script function is generated in the running script file to interactively determine the location information of the details table to be processed.
[0025] Furthermore, the step of generating the assembly drawing detail table based on the location information and data file of the detail table to be processed includes:
[0026] Import the data file of the detailed list to be processed, and initialize the data file of the detailed list to be processed;
[0027] Update the location data of the assembly drawing detail table based on the location information of the detail table to be processed, define the table page number variable, detail content location variable and table format content location variable, and generate an initial assembly drawing detail table with an empty homepage based on the assembly drawing detail homepage template and the table location selected by the user.
[0028] According to the order of detail types, the table detail types of the data file to be processed are output in order, and the first row of the imported data file to be processed is identified during the organization process.
[0029] Using the coordinates of the top left corner of the initial assembly drawing detail table as a reference point, update the initial coordinates of the contents of the initial assembly drawing detail table, keeping the vertical coordinates of the detail contents unchanged. Then, from left to right, update the horizontal coordinates of the initial assembly drawing detail table according to the alignment of the detail contents in different columns, and write the AutoCAD command for generating single-line text.
[0030] Use AutoCAD script functions to make uniform modifications to center or left-align the text;
[0031] At the beginning of each type of item or after each assembly item is completed, after the AutoCAD command outputs, the vertical coordinates of the next item are updated according to the tabular data.
[0032] Determine if the coordinates are greater than the maximum vertical coordinates allowed by the current table template; if so, update the coordinates of the top left corner of the new table according to the table format data, generate a new blank second page table using the second page template of the detail table, and then update the initial coordinates of the initial assembly drawing detail table.
[0033] If the initial assembly drawing list contains multiple item groups, then in the new blank next page table, new relative coordinates need to be set according to the relative horizontal position coordinates of the ungenerated content in the item group.
[0034] After all details are completed, the total number of pages in the expected initial assembly drawing detail sheet has been determined;
[0035] Based on the table format data of the bill of materials, the coordinates of the upper left corner of the initial assembly drawing bill of materials are updated table by table, the output coordinates of the corresponding brief information are calculated, and the additional information of the bill of materials is generated to generate the assembly drawing bill of materials.
[0036] Furthermore, the method also includes:
[0037] Once the assembly drawing parts list is generated, a completion notification is sent to the running script file.
[0038] Once the execution script running in AutoCAD receives a completion flag, it will automatically run, automatically generate an assembly list in AutoCAD, and issue a completion flag.
[0039] Furthermore, the method also includes:
[0040] Upon receiving the completion flag from the running script file, empty content is output to the assembly drawing detail table in an overwrite manner, and the assembly drawing detail table is forcibly deleted.
[0041] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:
[0042] In the embodiments of this disclosure, the interactive generation method for AutoCAD assembly drawing detail tables described above can efficiently and effectively process large batches of detail data and quickly generate assembly drawing detail tables. This allows the maintenance of assembly drawing detail tables to be performed only outside of the AutoCAD software. It supports personalized settings for users to match different detail table types and formats. By using the LISP interface built into AutoCAD, it only utilizes the most common basic statements such as text writing and character replacement, without involving complex function commands, thus ensuring reliability. Attached Figure Description
[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0044] Figure 1 This diagram illustrates the steps of an interactive method for generating an AutoCAD assembly drawing parts list according to an exemplary embodiment of this disclosure.
[0045] Figure 2 A flowchart illustrating a specific embodiment of the interactive method for generating AutoCAD assembly drawing schedules in an exemplary embodiment of this disclosure is shown. Detailed Implementation
[0046] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0047] Furthermore, the accompanying drawings are merely illustrative diagrams of embodiments of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0048] This example implementation provides an interactive method for generating AutoCAD assembly drawing parts lists. (See reference...) Figure 1 As shown, the interactive method for generating the AutoCAD assembly drawing schedule may include steps S101 to S105.
[0049] Step S101: Import the detailed table data file filled in according to the preset template; wherein, the detailed table data file includes the brief information of the detailed table and its specific item content;
[0050] Step S102: Parse the detail table data file to perform detail clustering and synchronous sorting on the detail table data file;
[0051] Step S103: Assemble the detailed table configuration on the parsed detailed table data file, add the detailed table target location and detailed table template location to generate the running script file, and initialize the running script file;
[0052] Step S104: Based on the running script file, read the data file of the detail table to be processed, and interactively determine the location information of the detail table to be processed;
[0053] Step S105: Generate the assembly drawing detail table based on the location information of the detail table to be processed and the data file of the detail table to be processed.
[0054] The interactive method for generating assembly drawing parts lists in AutoCAD described above can efficiently and effectively process large batches of detailed data and quickly generate assembly drawing parts lists. This allows for the maintenance of assembly drawing parts lists to be performed outside of the AutoCAD software. It supports personalized settings for users to match different parts list types and formats. By using the LISP interface built into AutoCAD, it only utilizes the most common basic statements such as text writing and character replacement, without involving complex function commands, thus ensuring reliability.
[0055] Below, we will refer to Figures 1 to 2 The steps of the interactive generation method for AutoCAD assembly drawing schedules described in this example embodiment will be explained in more detail.
[0056] In one embodiment, this method employs C++ language and the LISP (ListProcessing) interface supported by AutoCAD software for joint functional development, enabling rapid automatic generation of assembly drawings and significantly improving the speed and quality of assembly drawing detail list generation. For example... Figure 2 As shown, the main steps of this application are as follows:
[0057] 1. Import the detailed data file
[0058] Import the Excel file filled out according to the given template. The Excel file contains two parts of data: one is the brief information of the bill of quantities, including the project code, bill of quantities name, engineering drawing number and relevant personnel; the other is the specific items in the bill of quantities, such as serial number, sheet size, drawing number, item type, name, specifications and other information.
[0059] 2. Parse the detailed data file
[0060] (1) Parsing and initialization
[0061] Variable Definition: Based on the detail type content in the detail table, define the corresponding dynamic array (DAS) structure variable. i It is used to store various types of data in the details table; in addition, it defines corresponding character array variables DAC for different types of details. i This is used to sort drawing numbers of the same detail type;
[0062] Software connection: Use the OLE interface (Object Linking and Embedding) provided by C++Builder to connect to the Office software installed on the local computer, open the imported detail table Excel file, and obtain the active sheet page, total number of columns, and total number of rows.
[0063] (2) Clustering and synchronous sorting of details table content
[0064] Detailed clustering: Read the table content row by row and column by column, store the table data into a temporary dynamic array structure variable TS, and store the detail drawing number of the corresponding detail type separately into the string array variable DAC defined in the "parse initialization" step. i In the middle. After the current line of information is parsed, the temporary dynamic array structure variable DAC is... i The pointer is stored in the corresponding dynamic array structure variable DAS. i Then reset TS to prepare for the next line read, until the number of lines read is greater than the total number of lines;
[0065] Synchronous sorting within the details class: Utilizing the quicksort algorithm for each DAC. i All strings in the file are sorted by ASCII code, and each DAC is backed up. i The order of all strings in the unsorted string.
[0066] 3. Generate script file 1 (i.e., run script file): Assembly details table configuration and user run script file.
[0067] Generate an AutoCAD LISP script runtime configuration file, including update layer and annotation scale settings. Simultaneously, add snap commands and location data output commands for the target location and template location of the parts list (including the first and second pages). After the location data is output, the script executes a command to disable object snap to avoid interference from object snap functionality during subsequent table content positioning, and then enters a waiting state. When it receives a completion notification from the algorithm indicating that the assembly table generation script has been completed, it stops waiting and automatically runs the generated script. After the script generation is complete, restore the configuration and the initial AutoCAD settings before running the script.
[0068] 4. Interact to determine the location information of the details table (i.e., the location information of the details table to be processed).
[0069] After the script is generated, the algorithm enters a waiting state. Once the user runs the script in AutoCAD and determines the location of the parts list and the parts list template, the script outputs a location selection indicator. The algorithm captures this indicator, inputs the location information of the parts list to be generated into the algorithm, and then enters the assembly table generation script function.
[0070] 5. Generate script file 2: Table detail generation script (i.e. assembly drawing detail table)
[0071] (1) Initialize table format data
[0072] Import the detailed table format configuration file (i.e., the detailed table data file to be processed) filled out according to the given template, including format data and positioning data. The format data includes font, font size, alignment, number of rows between the starting row, number of rows between different detail types, and number of rows between the same detail type, etc. The positioning data includes table coordinates, column width, row height, table height, etc.
[0073] (2) Initialization of generation process configuration
[0074] Capture the table position determined by user interaction and update the table position data. Define table page number variables, detail content position variables, and table format content position variables. Generate an empty detail table on the homepage based on the assembled detail homepage template and the table position selected by the user.
[0075] (3) Organize the generation order of different types of details
[0076] Following the order of detail types given in the table template, the details are output sequentially according to the read table details. During the organization process, it is necessary to determine the detail type of the first row output in the imported Excel file. For the first row of output details, the corresponding starting row interval is set according to the table format data; for subsequent output details, the interval row for different detail types is set according to the table format data.
[0077] (4) Generate table details row by row using the script
[0078] Using the top-left corner of the details table as a reference point, update the initial coordinates of the details. Keeping the vertical coordinates of the details unchanged, then from left to right, update the horizontal coordinates of the details according to the alignment of the details in different columns, and write the AutoCAD command to generate single-line text.
[0079] (5) Handling cases where there are 2 details in a single column.
[0080] Use AutoCAD functions to uniformly modify and center or left-align the text. The main process is as follows: Use the selection set to obtain the coordinates of the lower left corner and alignment of the previously generated text (i.e., the second detail) → Calculate the total text length of the second detail → Update the selection range to obtain the coordinates of the lower left corner and alignment of the other detail in the same table (i.e., the first detail) → Calculate the total text length of the first detail → Calculate the total length of the two details and their left and right spacing relative to the table → Adjust the alignment coordinates of the two details and update the text position of the details.
[0081] (6) Generate table page number update
[0082] After each type of item begins or after each assembly item detail is completed and output by the AutoCAD script command, the vertical coordinates of the next item detail are updated based on the table format data. Then, it is checked whether the vertical coordinates exceed the maximum allowed by the current table template. If so, the coordinates of the top-left corner of the new table are updated based on the table format data, and a new blank next-page table is generated using the item detail table next-page template. The initial coordinates of the item detail content are then updated. If the assembly item detail table contains multiple item detail groups, new relative coordinates must be set in the new blank next-page table based on the relative horizontal coordinates of the ungenerated content within the item detail group.
[0083] (7) Generate script to generate detailed table summary information
[0084] Once all details are completed, the total number of pages in the expected assembly detail sheet is determined. Then, based on the table format data, the coordinates of the top-left corner of the detail sheet are updated table by table, the output coordinates of the corresponding introductory information are calculated, and a script for generating additional information for the detail sheet is generated.
[0085] 6. Issue a completion indicator for the detailed list script generation.
[0086] Once the parts list script is generated, a completion flag is sent to the running script file. Upon receiving this flag, the running script in AutoCAD automatically executes the script, automatically generates the assembly parts list in AutoCAD, and sends a completion flag to the algorithm.
[0087] 7. Script content protection settings
[0088] After receiving the completion flag from the running script file, the algorithm outputs empty content to the detail table script in an overwrite manner and forcibly deletes the script, thereby protecting the core content of the algorithm.
[0089] The interactive method for generating assembly drawing parts lists in AutoCAD described above can efficiently and effectively process large batches of detailed data and quickly generate assembly drawing parts lists. This allows for the maintenance of assembly drawing parts lists to be performed outside of the AutoCAD software. It supports personalized settings for users to match different parts list types and formats. By using the LISP interface built into AutoCAD, it only utilizes the most common basic statements such as text writing and character replacement, without involving complex function commands, thus ensuring reliability.
[0090] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0091] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
Claims
1. An interactive method for generating assembly drawing detail sheets in AutoCAD, characterized in that, The method includes: Step S101: Import the detailed table data file filled in according to the preset template; wherein, the detailed table data file includes the brief information of the detailed table and its specific item content; Step S102: Parse the detail table data file to perform detail clustering and synchronous sorting on the detail table data file; Step S103: Assemble the detailed table configuration on the parsed detailed table data file, add the detailed table target location and detailed table template location to generate the runtime script file, and initialize the runtime script file; specifically including: Generate a script execution configuration file, including settings for updating layers and annotation scales; Add capture commands and location data output commands for the target location and template location of the detail table; After the location data is output, the script runs a command to disable object snap in the configuration file to avoid interference from the object snap function when locating table content later. Then it enters a waiting state. When the script execution configuration file generation completion indicator is received, stop waiting and automatically run the generated execution script file; After the script file is generated, restore the initial settings. Step S104: Based on the running script file, read the data file of the detail table to be processed, and interactively determine the location information of the detail table to be processed; specifically including: After the script file is generated, it enters a waiting state; After the user runs the script file in AutoCAD and determines the location of the bill of quantities and the location of the bill of quantities template, the script file outputs a location selection completion indicator. After capturing the identification information, the location information of the detailed list to be processed is input, and the script function is generated in the running script file to interactively determine the location information of the detailed list to be processed. Step S105: Generate the assembly drawing detail table based on the location information and data file of the detail table to be processed; specifically including: Import the data file of the detailed list to be processed, and initialize the data file of the detailed list to be processed; Update the location data of the assembly drawing detail table based on the location information of the detail table to be processed, define the table page number variable, detail content location variable and table format content location variable, and generate an initial assembly drawing detail table with an empty homepage based on the assembly drawing detail homepage template and the table location selected by the user. According to the order of detail types, the table detail types of the data file to be processed are output in order, and the first row of the imported data file to be processed is identified during the organization process. Using the coordinates of the top left corner of the initial assembly drawing detail table as a reference point, update the initial coordinates of the contents of the initial assembly drawing detail table, keeping the vertical coordinates of the detail contents unchanged. Then, from left to right, update the horizontal coordinates of the initial assembly drawing detail table according to the alignment of the detail contents in different columns, and write the AutoCAD command for generating single-line text. Use AutoCAD script functions to make uniform modifications to center or left-align the text; At the beginning of each type of item or after each assembly item is completed, after the AutoCAD command outputs, the vertical coordinates of the next item are updated according to the tabular data. Determine if the coordinates are greater than the maximum vertical coordinates allowed by the current table template; if so, update the coordinates of the top left corner of the new table according to the table format data, generate a new blank second page table using the second page template of the detail table, and then update the initial coordinates of the initial assembly drawing detail table. If the initial assembly drawing list contains multiple item groups, then in the new blank next page table, new relative coordinates need to be set according to the relative horizontal position coordinates of the ungenerated content in the item group. After all details are completed, the total number of pages in the expected initial assembly drawing detail sheet has been determined; Based on the table format data of the parts list, update the upper left corner coordinates of the initial assembly drawing parts list table by table, calculate the output coordinates of the corresponding brief information, and generate a script to generate additional information for the parts list.
2. The interactive method for generating AutoCAD assembly drawing detail sheets according to claim 1, characterized in that, The introductory information should include at least the project code, the name of the bill of quantities, the drawing number, and the relevant personnel. The specific items should include at least the serial number, sheet size, drawing number, type of item, name, and specifications.
3. The interactive method for generating AutoCAD assembly drawing detail sheets according to claim 2, characterized in that, The steps of parsing the detail table data file to perform detail clustering and synchronous sorting include: Based on the detail type in the detail table data file, define the corresponding dynamic array structure variable and different types of drawing number character array variables, and obtain the active sheet page, total number of columns, and total number of rows; Based on the dynamic array structure variable, the drawing number character array variable, the sheet page, the total number of columns, and the total number of rows, perform detailed clustering and synchronous sorting on the detailed table data file.
4. The interactive method for generating AutoCAD assembly drawing detail sheets according to claim 3, characterized in that, The method also includes: Once the script for generating supplementary information in the details table is complete, it sends a completion notification to the running script file. Once the execution script running in AutoCAD receives the completion flag, it will automatically run, automatically generate the assembly parts list in AutoCAD, and issue a completion flag.
5. The interactive method for generating AutoCAD assembly drawing detail sheets according to claim 4, characterized in that, The method also includes: Upon receiving the completion flag from the running script file, empty content is output to the detail table additional information generation script in an overwrite manner, and the detail table additional information generation script is forcibly deleted.
Citation Information
Patent Citations
Method for processing part sequence number and list of CAD
CN101661516A
System and method for automatically generating BOM by using VBA function
CN111985015A
Method for generating engineering drawing detailed statement based on CATIA secondary development
CN116305344A