Method for quickly drawing three-dimensional geological profile sketch based on autolisp
The method for rapidly drawing 3D geological profile illustrations using the Autolisp language solves the problem of low efficiency in drawing geological profile maps in existing technologies. It enables rapid, accurate, and standardized drawing of 3D geological model profile maps, thereby improving the efficiency and quality of geological exploration results compilation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIBET XIANGLONG MINING CO LTD
- Filing Date
- 2025-07-25
- Publication Date
- 2026-04-10
AI Technical Summary
In the field of geological exploration, the existing technology for exporting profile maps from 3D geological modeling software to CAD platforms for text illustration is characterized by low operational efficiency and cumbersome procedures. This results in geologists spending a lot of time on repetitive mechanical work, which affects the efficiency of output.
A rapid drawing method for 3D geological profile illustrations based on Autolisp is adopted. It achieves automated processing by using interactive rectangular positioning for rapid clipping, fence-based rapid clipping, rapid addition of borders, and attribute-driven batch selection of primitive objects, replacing the traditional manual operation process.
This significantly improves the efficiency of geological profile drawing, reducing the time required to complete a single illustration from half an hour to within 2 minutes, thus reducing repetitive operation time for geologists and improving the efficiency and quality of geological results compilation.
Smart Images

Figure CN120973277B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of three-dimensional geological model profile drawing and report illustration, and particularly to a three-dimensional geological profile illustration rapid drawing method based on Autolisp. BACKGROUND
[0002] In the field of geological exploration, three-dimensional geological modeling software is usually used to model geological bodies, and related functions of the software are used to generate two-dimensional geological profile drawings. However, in order to meet the specific requirements of accuracy, standardization and aesthetics of drawings in the text of geological design or geological report, the generated profile drawings often need to be imported into a computer-aided design (CAD) platform for a large amount of manual editing, modification and standardization processing, so as to form the final available professional illustrations. The process of drawing the profile drawings generated in the three-dimensional geological software into the report illustrations involves tedious post-processing work, such as concentrating geological elements as much as possible, deleting irrelevant coordinate lines for placing legends, adding borders, etc. When a geological exploration project involves many geological profiles, this mechanical repetitive process occupies a large amount of time of the geologists, so that they cannot effectively focus on the core work of geology. Therefore, it is necessary to use computer technology to develop and integrate this mechanical repetitive process again, so that the geologists can efficiently draw the profile cutouts of the three-dimensional geological model into report illustrations.
[0003] In the current process of drawing profile drawings from three-dimensional geological modeling software to CAD platform for text illustration, there is a serious bottleneck in operation efficiency, and the core problem is that the process of drawing report illustrations in CAD is relatively tedious: for the intersecting fault lines and stratigraphic boundaries in complex geological profiles, repeated clicking operations are required when relying on the original TRIM command to implement cutting, and the operation process is long and inefficient; in the process of building a standard frame, multiple steps such as offset, extension, cutting, line adjustment, etc. need to be manually executed to meet the requirements of drawing specifications; for densely distributed and similar graphic elements, the operation accuracy and efficiency of the original CAD command are low.
[0004] The above operations significantly prolong the post-processing and drawing period of a single illustration, and geologists are forced to invest most of their efforts in mechanical repetitive work, which seriously squeezes the core work of value creation. Especially for large-scale exploration projects, the number of profiles to be processed increases dramatically, causing a serious mismatch of geological talent resources, and manual drawing of illustrations seriously restricts the efficiency of geological achievement output. SUMMARY
[0005] The application provides a three-dimensional geological profile drawing method based on Autolisp, which is based on Autolisp language to develop CAD secondary, and a set of highly automated and intelligent three-dimensional geological model profile drawing post-processing tool chain is written, which completely replaces the existing CAD drawing process which relies on a large number of manual operations, and realizes the fast, accurate and standardized drawing of three-dimensional geological model profile drawing into report drawings, greatly improving the efficiency and quality of the results preparation in the field of geological exploration, and solving the problems of mechanical repetitive labor in the process of drawing drawings by geological personnel.
[0006] To achieve the above object, the application adopts the following technical scheme:
[0007] The three-dimensional geological profile drawing method based on Autolisp comprises the following steps:
[0008] S1. Interactive rectangular positioning and rapid cutting; the diagonal points of the rectangle are obtained by interacting with the user, the minimum horizontal coordinate, the maximum horizontal coordinate, the minimum vertical coordinate and the maximum vertical coordinate of the rectangle are determined according to the diagonal points, a temporary rectangle is drawn and a closed fence point list is generated based on the four coordinates, the external line segments of the rectangle are cut based on the temporary rectangle as the boundary and the closed fence point list as the selector, and a preliminarily cut profile drawing is obtained;
[0009] S2. Rapid cutting of the upper part of the ground line based on the fence mode; based on the preliminarily cut profile drawing obtained in S1, the datum line is obtained by interacting with the user, the key points of the datum line are extracted and an upper fence point list is generated, the upper part of the ground line intersecting with the upper fence point list is cut, and a simplified profile drawing is obtained;
[0010] S3. Rapidly increase the frame; based on the simplified profile drawing obtained in S2, the left and right polylines are selected as the datum line object after the object capture is closed, the end point coordinates of the datum line are extracted, the inner and outer frame coordinates are calculated and the ground line extrapolation rectangle and the inner and outer frame are drawn, the object capture is restored after the frame line width attribute is modified, and a profile drawing with a standard frame is obtained;
[0011] S4. Attribute-driven batch selection of graphic objects; based on the profile drawing with a standard frame obtained in S3, the reference object is selected by interacting with the user and its attribute combination is extracted, the objects matching the attribute combination are filtered out by traversing all objects in the drawing, the matching number is highlighted and output, and a standardized drawing directly used for report is obtained.
[0012] In S1 of the specification, obtaining the diagonal points of the rectangle comprises: using an interactive function to obtain the first corner point and the diagonal point of the rectangle specified by the user, determining whether the user has completed the selection, and if so, proceeding to the next step, otherwise, exiting the process.
[0013] In the specification, in S1, generating the closed fence point list includes: calculating the one-thousandth of the distance between the opposite corners of the rectangle as the offset, and generating the closed fence point list in the order of top left corner→top right corner→bottom right corner→bottom left corner→top left corner based on the offset expanded outside the minimum and maximum horizontal and vertical coordinates of the rectangle.
[0014] In the specification, in S2, when extracting the reference line key points, if the reference line is a closed polyline, by judging whether the head and tail vertices coincide, the tail point is deleted to remove the repeated coordinates, and it is ensured that the generated fence point list only covers the upper area of the reference line.
[0015] In the specification, in S2, generating the upper fence point list includes: extracting the end points or vertices of the reference line, adding an offset to the coordinates of each point to obtain the initial fence point, and adding an additional offset point at the beginning and end of the fence point list to cover the end points of the reference line.
[0016] In the specification, in S3, drawing the border includes: calculating the outward push of 10 unit lengths according to the end points of the left and right polylines to draw the ground surface line push rectangle, the distance between the rectangle and the inner border is 10 unit lengths, the distance between the inner border and the outer border is 2 unit lengths, wherein the line width of the outer border is set to 0.8, and the line width of the inner border and the ground surface line push rectangle is set to 0.1.
[0017] In the specification, in S3, closing the object capture includes: first, obtaining the initial value of the system variable of the current object capture mode through the getvar function of Autolisp and saving it, and then setting the system variable to 0 through the setvar function to close all object capture modes.
[0018] In the specification, in S3, selecting the left and right polylines includes: prompting the user to select the left and right polylines using the entsel command, saving the reference object primitive name obtained by the car function to the lineName variable, obtaining the key-value pair set of the variable lineName following the DXF group code standard using entget, and then obtaining the primitive type with group code 0 using the assoc function, and judging whether it is a polyline, if not, exit the processing, finally, traverse the data with group code 10 in the primitive information to extract the vertex coordinates of the selected reference line segment, and save the two end point coordinates of the line segment.
[0019] In the specification, in S4, by defining the function CheckPropsMatch, the objects and attribute combinations in the entire drawing are compared, and the matching objects are added to the selection set, wherein the filtering range is the entire drawing.
[0020] In the specification, in S4, extracting the reference object attributes includes: obtaining the layer, color, line type scale and line width of the reference object, and storing the attribute combination list after removing the duplicates.
[0021] In summary, the present application has at least the following beneficial effects:
[0022] The present application realizes the rapid processing of cutting three-dimensional geological software to text illustrations by compiling the illustration drawing full-process tool chain. The main realizations are: interactive rectangular positioning and cutting based on the ground line cutting function, which converts the traditional manual pruning operation into single frame selection automatic processing, greatly improves the cutting efficiency of geological profile drawing, and realizes the cutting of second-level drawings; the quick border increase function can be flexibly adjusted according to the corresponding drawing specification, and realizes the automatic generation of the border; the attribute-driven batch selection function of graphic objects breaks through the bottleneck of manual screening of complex geological elements, and strictly matches the selected element attributes, which is much better than the similar object selection function in CAD software.
[0023] Compared with the manual cutting of three-dimensional geological model profile drawing into required report illustrations by the geological personnel in the past, the present application greatly improves the work efficiency of the geological personnel by using the full-process secondary development command compiled by Autolisp language, and the drawing of a single profile illustration is compressed from half an hour to 2 minutes, which helps the geological personnel to be freed from repetitive drawing operations and focus on the value creation link. BRIEF DESCRIPTION OF DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0025] Figure 1 The present application relates to a schematic diagram of a three-dimensional geological profile illustration rapid drawing method based on Autolisp.
[0026] Figure 2 The present application relates to a schematic diagram of determining a rectangular range according to diagonal points.
[0027] Figure 3 The present application relates to a schematic diagram of creating a fence point list according to the minimum / maximum coordinates of the rectangle and based on a small offset delta.
[0028] Figure 4 The present application relates to a schematic diagram of the interactive rectangular positioning rapid cutting use method.
[0029] Figure 5 The present application relates to a schematic diagram of the interactive rectangular positioning rapid cutting effect.
[0030] Figure 6The schematic diagram of the method for using the fence mode based quick cropping effect in the present application.
[0031] Figure 7 The schematic diagram of the fence mode based quick cropping effect in the present application.
[0032] Figure 8 The schematic diagram of the specification about the details of the frame of the cross section in the present application.
[0033] Figure 9 The schematic diagram of the method and effect of the quick increase of the frame in the present application.
[0034] Figure 10 The schematic diagram of the effect of the quick increase of the frame in the present application.
[0035] Figure 11 The schematic diagram of the selected graphic object for the attribute driven batch selection function of the graphic object in the present application.
[0036] Figure 12 The schematic diagram of the selected graphic object for the attribute driven batch selection function of the graphic object in the present application.
[0037] Figure 13 The schematic diagram of the selected graphic object for the attribute driven batch selection function of the graphic object in the present application. DETAILED DESCRIPTION
[0038] In the following, only certain exemplary embodiments are simply described. As those skilled in the art can recognize, the described embodiments can be modified in various different ways without departing from the spirit or scope of the embodiments of the present application. Therefore, the drawings and the description are considered to be exemplary in nature rather than limiting.
[0039] The following disclosure provides many different embodiments, or examples, for implementing different structures of the embodiments of the present application. For the purpose of simplifying the present disclosure of the embodiments of the present application, the components and settings of specific examples are described in the following. Of course, they are only examples, and the purpose is not to limit the embodiments of the present application. In addition, the embodiments of the present application can repeatedly refer to numerals and / or reference letters in different examples, and such repetition is for the purpose of simplification and clarity, which itself does not indicate the relationship between the various embodiments and / or settings discussed.
[0040] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0041] As Figure 1 shown, the present embodiment provides a quick drawing method of the Autolisp based three-dimensional geological profile sketch, including the following steps:
[0042] S1. Interactive rectangle positioning quick clipping; obtaining the diagonal points of a rectangle through user interaction, determining the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate of the rectangle according to the diagonal points, drawing a temporary rectangle and generating a closed fence point list based on the four coordinates, clipping the line segments outside the rectangle with the temporary rectangle as the boundary and the closed fence point list as the selector, and obtaining a preliminary clipped profile;
[0043] S2. Quick clipping of the upper part of the ground line based on the fence mode; based on the preliminary clipped profile obtained in S1, obtaining a reference line through user interaction, extracting the key points of the reference line and generating an upper fence point list, and clipping the upper part of the ground line intersecting the upper fence point list to obtain a simplified profile;
[0044] S3. Quickly adding a border; based on the simplified profile obtained in S2, selecting left and right multi-segment lines as reference line objects after object capture is turned off, extracting the end point coordinates of the reference line, calculating the inner and outer border coordinates and drawing the ground line extrapolation rectangle, the inner and outer borders, modifying the line width attribute of the border and restoring the object capture to obtain a profile with a standard border;
[0045] S4. Attribute-driven batch selection of graphic objects; based on the profile with a standard border obtained in S3, selecting a reference object and extracting its attribute combination through user interaction, filtering out objects matching the attribute combination by traversing all objects in the drawing, highlighting and outputting the matching number to obtain a standardized insert drawing that can be directly used for reports.
[0046] In some embodiments, in S1, obtaining the diagonal points of the rectangle includes: using an interaction function to obtain the first corner point and the diagonal point of the rectangle specified by the user, and determining whether the user has completed the selection to proceed to the next step, otherwise, the process is exited.
[0047] In some embodiments, in S1, generating the closed fence point list includes: calculating one-thousandth of the distance between the diagonal points of the rectangle as an offset, expanding the offset based on the minimum and maximum horizontal and vertical coordinates of the rectangle, and generating a closed fence point list connected at the head and tail in the order of top left corner→ top right corner→ bottom right corner→ bottom left corner→ top left corner.
[0048] In some embodiments, in S2, when extracting the key points of the reference line, if the reference line is a closed multi-segment line, it is determined whether the first and last vertices coincide, and the last point is deleted to remove duplicate coordinates, so that the generated fence point list only covers the upper part of the reference line.
[0049] In some embodiments, in S2, generating the upper fence point list includes: extracting the end points or vertices of the reference line, adding an offset to each point coordinate to obtain an initial fence point, and adding an additional offset point at the head and tail of the fence point list to cover the end points of the reference line.
[0050] In some embodiments, the drawing of the frame in S3 comprises: according to the left and right polyline endpoint, calculating the outward push of 10 unit lengths to draw the ground surface line, and pushing the rectangle, which is 10 unit lengths away from the inner frame, and the inner frame is 2 unit lengths away from the outer frame, wherein the outer frame line width is set to 0.8, and the inner frame and the ground surface line push rectangle line width is set to 0.1.
[0051] In some embodiments, the closing of the object capture in S3 comprises: first, obtaining the initial value of the system variable of the current object capture mode through the getvar function of Autolisp and saving it, and then setting the system variable to 0 through the setvar function to close all object capture modes.
[0052] In some embodiments, the selection of the left and right polylines in S3 comprises: prompting the user to select the left and right polylines by using entsel, saving the reference object primitive name obtained by combining the car function to the lineName variable, obtaining the key-value pair set of the variable lineName following the DXF group code standard by using entget, and obtaining the primitive type with group code 0 by using the assoc function, and judging whether it is a polyline, if not, exit the processing, finally, traverse the data with group code 10 in the primitive information to extract the selected reference line segment vertex coordinates, and save the head and tail two end point coordinates of the line segment.
[0053] In some embodiments, in S4, the objects matching the attribute combination are added to the selection set by comparing the objects in the entire drawing with the attribute combination through the self-defined function CheckPropsMatch.
[0054] In some embodiments, in S4, the reference object attributes are extracted, which comprises: obtaining the layer, color, line type scale and line width of the reference object, and storing the de-duplicated attribute combination list.
[0055] The technical concept of the present application is as follows:
[0056] The present application is based on the problem that the manual processing of geological workers to draw a report or design insert drawing from a three-dimensional software geological profile is inefficient, and proposes a CAD secondary development method based on Autolisp language, which realizes the rapid cutting of interactive rectangular positioning, the rapid cutting based on fence mode, the rapid increase of frame, and the attribute-driven batch selection function of primitive objects, etc. Whole process tool chain to realize the rapid drawing of insert drawing. At the same time, considering the selection of various types of line segments, abnormal processing, etc., the overall technical scheme has strong robustness. Autolisp language is used, and the functions are mainly realized through the built-in functions and related self-defined functions of the language, which specifically includes the following steps:
[0057] Step S1: Interactive rectangular positioning rapid cutting, which is used for drawing boundary cleaning and standardization.
[0058] Because the orebody model profiles generated by 3D geological software are relatively large, while the illustrations placed in the report text are relatively small and the geological elements are concentrated, it is necessary to compress the profiles as much as possible to retain the main geological elements. This step is mainly used to automatically trim the outer line segments of the user-selected rectangle after selecting two diagonal points to define the rectangle, for drawing boundary cleaning and preparation for standardized drawing output.
[0059] Step S1.1: Use getpoint to get the first corner point of the user-specified rectangle and save it to variable pt1. Use getcorner to get the opposite corner point of the user-specified rectangle and save it to variable pt2. Determine the rectangle range based on variables pt1 and pt2.
[0060] `getpoint` is an interactive function used in AutoCAD to obtain the coordinates of a point input by the user. It supports mouse clicks, absolute coordinates, and relative coordinates input via keyboard. In this embodiment, since we need to interact with the user to obtain the map clipping range, we use mouse clicks to obtain the coordinates of the diagonal points of the clipping rectangle. `getcorner` is also an interactive function specifically used to obtain the diagonal points of a rectangle. When used in conjunction with the `getpoint` function, AutoCAD displays a dynamic rectangle from the base point obtained by `getpoint` to the current cursor position, visually representing the range of the rectangle selected by the user.
[0061] Preferably, the corner point variables pt1 and pt2 used for interactive acquisition of the saved cropping rectangle range are judged to check whether the user has completed the rectangle selection operation. If so, proceed to step S1.2; otherwise, exit the process.
[0062] The relevant code is as follows:
[0063] (if (and (setq pt1 (getpoint "\nSpecifies the first corner point of the rectangle: "))
[0064] (setq pt2 (getcorner pt1 "\nSpecify diagonal point: ")))
[0065] Step S1.2: With object snapping mode off, use the command to draw a temporary rectangle based on the obtained pt1 and pt2 variables. Then, use entlast to save the newly drawn temporary rectangle in the variable rect for use as the clipping boundary in the clipping operation of step S1.5.
[0066] The command is a key bridge connecting LISP program and AutoCAD command in CAD secondary development, which is used to execute one or more AutoCAD commands and supports variable parameter sequence, each parameter is a response to the command. For example, in the embodiment, the parameter list of the command is "_.rectang" "_non" pt1 "_non" pt2, which indicates that the _.rectang function is used to draw a rectangle by using the coordinates of the variables pt1 and pt2 in the closed object capture mode.
[0067] Preferably, the _.rectang is used for temporary rectangle drawing, which can make the code compatible with different versions of CAD platforms.
[0068] The main function of the "_non" parameter is to temporarily disable all running object capture settings, which ensures that the program uses the precisely specified coordinate points rather than automatically capturing nearby geometric features, and is commonly used for programmed precise drawing.
[0069] Preferably, the "_non" parameter is used to temporarily disable all object captures, which ensures that the precise coordinates are used when drawing the rectangle rather than the nearby captured points, thereby avoiding accidental capture of the coordinate points near pt1 or pt2, and ensuring that the program execution is consistent with the user's intention.
[0070] The entlast is an entity operation function used to obtain the newly created main entity in the graphics database. The entlast is called after the rectangle is drawn by using the command, at which time the newly created entity in the graphics database is the temporary rectangle, which effectively avoids the inefficiency of global search. The temporary rectangle primitive rect obtained by the entlast is used as the clipping boundary in the subsequent step S1.5.
[0071] The related code is as follows:
[0072] (command "_.rectang" "_non" pt1 "_non" pt2)
[0073] (setq rect (entlast))
[0074] Step S1.3: According to the rectangle diagonal points pt1 (x1, y1) and pt2 (x2, y2) obtained by interacting with the user, the minimum horizontal coordinate x1, the maximum horizontal coordinate x2, the minimum vertical coordinate y1 and the maximum vertical coordinate y2 are determined by combining the car, cadr, min and max functions.
[0075] For example, if the two diagonal points of the rectangle obtained by the user are (1, 2) and (3, 4), the minimum horizontal coordinate is 1, the maximum horizontal coordinate is 3, the minimum vertical coordinate is 2, and the maximum vertical coordinate is 4. At this time, the coordinates of the upper left corner of the rectangle are (x1, y2), the coordinates of the upper right corner are (x2, y2), the coordinates of the lower right corner are (x2, y1), and the coordinates of the lower left corner are (x1, y1), as shown in FIG. 4. Figure 2 Since the maximum / minimum horizontal and vertical coordinates can be determined by determining the maximum / minimum horizontal and vertical coordinates, the two diagonal point coordinate values of the rectangle are extracted, which are used in step S1.4 to combine and determine the 4-point coordinates of the rectangle for external expansion to generate the fence point list.
[0076] car and cadr are list operation functions, car returns the first element in the list, and cadr returns the second element in the list, so the horizontal and vertical coordinates of the coordinate point can be obtained using car and cadr.
[0077] The relevant code is as follows:
[0078] (setq x1 (min (car pt1) (car pt2))
[0079] y1 (min (cadr pt1) (cadr pt2))
[0080] x2 (max (car pt1) (car pt2))
[0081] y2 (max (cadr pt1) (cadr pt2)))
[0082] Step S1.4: Calculate a small offset delta according to the size of the rectangle rect, combine the 4 corner point coordinates of the rectangle based on the minimum / maximum horizontal and vertical coordinates, and create a fence point list fencePoints connected at the beginning and end based on the small offset delta.
[0083] Preferably, the small offset delta is calculated according to the size of the rectangle, and the value is recommended to be set to one thousandth of the distance between the two diagonal points pt1 and pt2 of the rectangle, so that the small offset delta can be applied to CAD graphics under different scales, and the offset delta is small compared to the size of the rectangle, so as to ensure compatibility with graphics under different scales. The minimum / maximum coordinates of the rectangle are expanded based on the small offset delta to create a fence point list as shown in FIG. 5. Figure 3
[0084] Based on the maximum / minimum horizontal and vertical coordinates of the rectangle extracted in step S1.3, the coordinate values of the four corner points of the rectangle can be combined to obtain the coordinate values of the four corner points of the rectangle. For example, the coordinates of the upper left corner of the rectangle are (x1, y2) and the coordinates of the lower right corner of the rectangle are (x2, y1). Then, the values of the expanded fence point list are calculated based on the coordinate values of the four corner points of the rectangle and the small offset delta, which are used as the clipping object selector in step S1.5.
[0085] Preferably, since the fence mode uses a polyline as the object selector, only objects intersecting the polyline are selected. If the fence point list is not closed, there may be redundant line segments on one side of the rectangle that cannot be selected for clipping. Only by closing the fence point list to form a continuous rectangular loop can it be ensured that all objects around the temporary rectangle are traversed by the fence point list, guaranteeing the clipping effect. Therefore, the fence point list fencePoints uses a series of coordinates connected end to end. For example, in this embodiment, the fence point list fencePoints is arranged in the manner of "top left corner coordinate → top right corner coordinate → bottom right corner coordinate → bottom left corner coordinate → top left corner coordinate", ensuring full coverage of the clipping area outside the rectangle and quickly clipping redundant geological elements outside the drawing boundary.
[0086] The relevant code is as follows:
[0087] (setq fencePoints (list
[0088] (list (- x1 delta) (- y1 delta)) ; Left-bottom outer expansion point
[0089] (list (- x1 delta) (+ y2 delta)) ; Top-left outer expansion point
[0090] (list (+ x2 delta) (+ y2 delta)) ; Top right outer expansion point
[0091] (list (+ x2 delta) (- y1 delta)) ; Lower right outer expansion point
[0092] (list (- x1 delta) (- y1 delta)) ; Closes back to the starting point))
[0093] Step S1.5: Based on the fence mode, perform the user-enclosed rectangular range external line segment clipping operation using the fence point list fencePoints and the temporary rectangle rect, to achieve the drawing boundary cleaning and preparation for standardization. First, use the command command to call the primitive command _.trim, and use the temporary rectangle rect as the clipping boundary; second, use the command command to switch to the fence mode; third, traverse the fence point list fencePoints, and use the command to input each fence point in order; and finally, use the command command to end the fence point input and perform the clipping.
[0094] "Fence" is an efficient object selection method, especially when executing editing commands such as TRIM and EXTEND, which is used to flexibly select the graphical elements that need to be operated. The core is to select all objects that intersect with a continuous line segment (i.e. "fence line") by drawing a continuous line segment. By drawing a continuous fence polyline by the user, all graphical objects that are crossed by the line will be automatically selected. For example, in the TRIM command, the part of the line segment crossed by the fence line will be directly trimmed, and compared with the rectangular box selection (window intersection), the fence line can adapt to irregular graphics (such as staggered lines and arc structures), accurately control the part that needs to be operated, and avoid misselection.
[0095] Since the fence mode is used to perform clipping operations on the excess part outside the rectangular range obtained by user interaction, the temporary rectangle rect is selected as the reference boundary for the clipping operation, and the fence point list fencePoints is selected as the clipping object selector, which is used to determine which objects need to be clipped, that is, the fence point list fencePoints is only responsible for selecting the clipping objects, and the temporary rectangle defines the clipping boundary. Based on the fence mode clipping, large-area clipping can be completed in a single operation.
[0096] The relevant code is as follows:
[0097] (command "_.trim" rect "")
[0098] (command "_fence")
[0099] (foreach pt fencePoints (command pt))
[0100] (command "" "")
[0101] Step S1.6: Clean up the temporary rectangle object using entdel rect.
[0102] Since the rectangle drawn in step S1.2 is only used as the clipping boundary and is a temporary object, it does not need to be retained. After the clipping is completed, the object needs to be deleted using the entdel command.
[0103] How to use interactive rectangular positioning and quick cropping: Figure 4 As shown, the cropping effect is as follows: Figure 5 As shown.
[0104] Step S2: Quickly trim intersecting segments above the ground line based on the fence pattern
[0105] For report illustrations, since the overall content is relatively compact and the map size needs to be as small as possible, the legend needs to be placed in the blank space of the illustration. Therefore, the coordinate lines above the ground line in the cross-sectional view that do not need to be retained need to be deleted.
[0106] Step S2.1: Use the entsel command to interact with the user to obtain the baseline and save the selected primitive name to the variable en.
[0107] The `entsel` function prompts the user to select a single graphic element by specifying a point and returns a list containing the element name and the coordinates of the pick point. It is often used in conjunction with the `car` function to retrieve the graphic element name of the selected object.
[0108] Preferably, to improve the robustness of the technical solution, it is checked whether the user has selected a baseline. If the user selects a certain graphic object, step S2.2 is executed; otherwise, the process is exited and the user is prompted "no object selected".
[0109] The relevant code is as follows:
[0110] (if (not (setq en (car (entsel "\nSelect baseline (straight line or polyline): ")))))
[0111] (progn (princ "\nNo object selected") (exit)))
[0112] Step S2.2: Extract key points based on the baseline selected by the user, which will be used to generate a fence point list later.
[0113] Step S2.2.1: First, use enget to obtain the set of key-value pairs that conform to the DXF group code standard for variable en; second, use assoc to obtain the primitive type data corresponding to group code 0, and save the primitive type to variable objType; finally, determine whether the type of variable objType is LINE, LWPOLYLINE or other.
[0114] `entget` is a function for accessing drawing data. It converts AutoCAD objects into a program-processable list of associated data. This function returns a set of key-value pairs conforming to the DXF group code standard, where the group code acts as the key to identify data types (such as element types, layers, geometric coordinates, etc.), and the corresponding value stores the specific data. `assoc` is a function for the associated list. It efficiently extracts the value corresponding to a specific group code from the data returned by `entget`. It finds and returns the first matching key-value pair through precise key matching, and its return result can be directly used in the CDR value extraction section. In CAD data processing, it is the primary means of accessing object attributes, and is particularly suitable for processing structured data in DXF format.
[0115] Preferably, this step improves the robustness of the technical solution by obtaining the graphic element type of the user-selected object and performing corresponding operations based on different graphic element types. When the user selects a baseline type of LINE or LWPOLYLINE, the relevant operations are performed; if it is another type, the user is prompted "This graphic element type is not supported" and the process is exited.
[0116] The relevant code is as follows:
[0117] (setq edata (entget en))
[0118] (setq objType (cdr (assoc 0 edata)))
[0119] (cond
[0120] ((= objType "LINE")
[0121] (The user selected a line as the primitive type)
[0122] ((= objType "LWPOLYLINE")
[0123] (The user selected a polyline as the primitive type.)
[0124] (t (princ "\nUnsupported primitive type!") (exit)))
[0125] Step S2.2.2: If the primitive type of the en variable is LINE, use the assoc and cdr functions to obtain the data corresponding to group code 10 and group code 11 to obtain the key points of the line, and save the key points to the variable basePts; if it is of type LWPOLYLINE, use the assoc and cdr functions to obtain the data corresponding to group code 10 to obtain all vertices of the polyline, and save the key points to the variable basePts. At the same time, if it is a closed polyline, delete the tail point.
[0126] DXF (Drawing Interchange Format) group codes are integer code system used in AutoCAD to identify the properties of graphic elements, which is the basis of AutoCAD data exchange format. Each group code corresponds to a specific type of graphic data, and all properties of AutoCAD entities are completely described in the form of digital codes and associated values. For the line type, group code 10 corresponds to the data representing the starting point coordinates of the line, and group code 11 corresponds to the data representing the end point coordinates of the line, while for the polyline type, group code 10 corresponds to the data representing the list of vertex coordinates of the polyline.
[0127] Therefore, if the variable en obtained by entsel is a line, the starting point and end point coordinates of the line are obtained using assoc and cdr, and the coordinates are saved to the basePts variable.
[0128] The relevant code is as follows:
[0129] (setq basePts (list (cdr (assoc 10 edata)) (cdr (assoc 11 edata))))
[0130] If the variable en is a polyline, first, define the filter condition using lambda, create an anonymous function to determine whether the element is a polyline vertex data; second, use vl-remove-if-not for fast filtering to achieve the retention of vertex data; finally, combine mapcar and cdr functions to batch retain part of the list except the first element, and finally obtain the vertex coordinate list variable basePts that can be directly used.
[0131] Lambda function is the implementation of anonymous function in LISP language, which allows to create one-time use function without defining formal function name, suitable for passing as high-order function parameter. Vl-remove-if-not function is used to remove elements from the list that do not meet certain conditions, often used with lambda function to remove all elements that do not meet the test function condition. Mapcar function is used to pass each element of one or more lists as a parameter to a function, and return a new list composed of the return value of the function.
[0132] The relevant code is as follows:
[0133] (setq basePts (mapcar 'cdr (vl-remove-if-not '(lambda (x)(= (car x)10)) edata)))
[0134] The surface line of the profile generated in the three-dimensional modeling software can be a closed coincident curve, i.e. the first end can be connected with the tail end. If the multi-segment line is extended outward, the program execution can be unpredictable, and the clipping effect can be affected.
[0135] Preferably, to ensure that the fence path generated according to the reference surface line selected by the user is only generated above the reference surface line, it is necessary to determine whether the multi-segment line is a closed multi-segment line with the first end connected with the tail end by using the equal function, and if so, the tail point is deleted, and it is strictly ensured that the fence path is only above the reference surface line, so that the clipping object selected according to the fence point list is strictly consistent with the expectation.
[0136] Since the list in the Autolisp language is essentially a singly linked list structure, and there is no built-in function to directly delete the tail element of the list, if the tail point is to be deleted, the entire linked list needs to be traversed, which is low in efficiency. Therefore, double reverse is used to quickly delete the tail element of the list.
[0137] The relevant code is as follows:
[0138] (if (equal (car basePts) (last basePts) 1e-6)
[0139] (setq basePts (reverse (cdr (reverse basePts)))))
[0140] It should be noted that if the running environment supports the butlast function, the following code can be used:
[0141] (if (equal (car basePts) (last basePts) 1e-6)
[0142] (setq basePts (butlast basePts))
[0143] Step S2.3: Using the small offset delta calculated in step S1.4, using lambda and mapcar functions to increase the list variable basePts storing the reference line vertices by a small offset delta, to generate the fence point list fencePts corresponding to the reference surface line for selecting the clipping object in step S2.5.
[0144] Since the clipping boundary is the ground reference line for selection, the purpose of clipping is to clip the upper part of the ground line to clear the illustration position for placing legend information, etc., so the fence point list is different from the outer expansion in step S1. The fence point list is only above the ground line, so the ground reference line vertex coordinates are increased by a small offset delta using mapcar and lambda functions to obtain the fence point list fencePts.
[0145] The relevant code is as follows:
[0146] (setq fencePts
[0147] (mapcar
[0148] '(lambda (pt)
[0149] (list
[0150] (+ (car pt) delta)
[0151] (+ (cadr pt) delta)
[0152] (caddr pt)))
[0153] basePts))
[0154] Step S2.4: Add an additional offset point to the head and tail of the fence point list fencePts.
[0155] To avoid the possibility that the objects to be clipped at the end points may just touch but not pass through the fence line, resulting in these objects being unable to be correctly trimmed, therefore, to ensure that the objects at the end points of the reference line are reliably clipped, an additional offset point is added to the head and tail of the fence point list fencePts using the append function to ensure that the path covers the ground reference line.
[0156] The relevant code is as follows:
[0157] (setq fencePts
[0158] (append
[0159] (list (list (- (caar fencePts) delta) (+ (cadar fencePts) delta)))
[0160] fencePts
[0161] (list (list (+ (car (last fencePts)) delta) (+ (cadr (last fencePts))delta)))))
[0162] Step S2.5: Call the _.trim to perform the trimming operation by the command command.
[0163] The method is similar to S1.5, which will not be repeated, and the relevant code is as follows:
[0164] (command "_.trim" en "")
[0165] (command "_fence")
[0166] (command "" "")
[0167] The method for fast trimming based on the fence mode is shown in Figure 6 , and the trimming effect is shown in Figure 7 .
[0168] Step S3: According to the specification requirements, quickly increase the inner and outer borders and set the line type parameter settings.
[0169] After deleting as much as possible the part that does not need to be retained, in order to make the report illustration more beautiful, it is necessary to draw the border and the like. The present embodiment takes the Zijin “Geological Exploration Work Guide” (Q / Z)-GP-GD-001-2018) specification as an example. The requirement for the profile in this specification is to draw a surface line extrapolation rectangle by extrapolating 10 unit lengths outward from the end point of the trimmed surface line, the line width is 0.1, the distance between the rectangle and the inner border is 10 unit lengths, the inner border line width is also 0.1, the distance between the inner border and the outer border is 2 unit lengths, and the outer border line width is 0.8. The details of the specification about the illustration border are shown in Figure 8 .
[0170] Select the leftmost and rightmost polyline after the trimming in steps S1 and S2 as the reference line, calculate the coordinate values of the vertices of each border with the line segment as the reference line, and then call the pline to draw the polyline by the command command to realize the automatic drawing of the border.
[0171] Step S3.1: Get the current object capture mode (osmode) parameter by the getvar function and save it to the variable osm, and set osmode to 0 to close the object capture mode.
[0172] Object Snap Mode is one of the core features of AutoCAD, allowing users to precisely snap to specific geometric feature points (such as endpoints, midpoints, and centers) of existing graphic objects. Its behavior is controlled by the system variable `osmode`. In LISP programs, the original value of `osmode` must be retrieved and saved using the `getvar` function before modifying it, and restored when the program ends; otherwise, it will disrupt the user's working environment settings.
[0173] Preferably, to avoid the inability to accurately select coordinate points when automatically drawing borders later due to the use of object snap mode, the object snap mode should be turned off. After the automatic border addition process is completed, the value of the variable osm should be reassigned to the system variable osmode to ensure that the object snap mode does not change due to the execution of this command.
[0174] The relevant code is as follows:
[0175] (setq osm (getvar "osmode"))
[0176] (setvar "osmode" 0)
[0177] Step S3.2: Prompt the user to select a baseline object and extract the coordinates of the baseline endpoints. First, use `entsel` to prompt the user to select the left and right polylines, and use the `car` function to save the obtained baseline object primitive name to the `lineName` variable. Second, use `entget` to obtain the set of key-value pairs in the `lineName` variable that conforms to the DXF group code standard. Third, use the `assoc` function to obtain the primitive type with group code 0, and determine whether it is a polyline; if not, exit the process. Finally, use a `foreach` loop to traverse the primitive information and extract the vertex coordinates of the selected baseline segment, and save the coordinates of the two endpoints of the segment to the variables `pLeft1` and `pLeft2`.
[0178] It should be noted that the method for obtaining the coordinates of the endpoints of the polyline on both the left and right sides is the same, so here we will only take obtaining the coordinates of the endpoints of the left baseline as an example.
[0179] The relevant code is as follows:
[0180] (setq s_line (entsel "Please select the polyline on the left:" ))
[0181] (setq line_name (car s_line));s
[0182] (setq line_data (entget line_name))
[0183] (if (= "LWPOLYLINE" (cdr (assoc 0 line_data)))
[0184] (progn
[0185] (setq points nil)
[0186] (foreach ele line_data
[0187] (if (= (car ele) 10)
[0188] (setq points (append points (LIST (cdr ele)))))))
[0189] (alert "Please select polyline!")
[0190] (setq p1 (car points))
[0191] (setq p2 (cadr points))
[0192] Step S3.3: Using the left polyline endpoints pLeft1 and pLeft2 obtained in step S3.2 as reference points, calculate the coordinates of each border vertex.
[0193] The relevant code is as follows:
[0194] pLeft1new and pLeft2new are the top and bottom vertices of the rectangle extrapolated from the left edge of the ground.
[0195] (setq pLeft1new (list (- (car pLeft1) 10) (cadr pLeft1)))
[0196] (setq pLeft2new (list (- (car pLeft2) 10) (cadr pLeft2)))
[0197] (print p1new)(print p2new)
[0198] ;;pleftbottomin and pleftupin are the top and bottom points on the left side of the inner border.
[0199] (setq pleftbottomin (list (- (car pLeft1new ) 10) (- (cadr pLeft1new) 10)))
[0200] (setq pleftupin (list (car pleftbottomin) (+ (cadr pLeft2new ) 45)))
[0201] ;;(command "line" pleftbottomin pLeft1new "")
[0202] ;;pleftbottomout and pleftupout have two points on the top and bottom left of their outer borders.
[0203] (setq pleftbottomout (list (- (car pLeft1new ) 12) (- (cadr pLeft1new) 12)))
[0204] (setq pleftupout (list (car pleftbottomout) (+ (cadr pleftupin) 2)))
[0205] Step S3.4: Based on the coordinates of each border vertex calculated in Step S3.3, use the command command to call pline to draw the ground line extrapolation rectangle and the inner and outer borders respectively. After drawing the ground line extrapolation rectangle, use entlast to save the line segment to the variable changeStyle1 for use in step S3.5 to modify the line segment properties. After drawing the outer border, use entlast to save the line segment to the variable changeStyle2 for use in step S3.5 to modify the line segment properties.
[0206] The command is used to call pline to draw line segments based on the calculated coordinates of the border vertices. For the inner and outer borders, the pline closing function is enabled using the parameter "c". Finally, the empty string parameter "" is used to replace the actual press of the Enter key to end the pline drawing command, complete the polyline drawing and exit the command.
[0207] For primitive objects whose border properties need to be modified, after drawing line segments using the command command, the newly drawn primitive is saved using entlast to avoid the inefficiency of global search and to facilitate obtaining DXF group code information in step S3.5 to modify line segment properties.
[0208] The relevant code is as follows:
[0209] (command "pline" pLeft1 pLeft2 pLeft2new pLeft1new p1Rightnew p2Rightnew pRight2 pRight1 "")
[0210] (setq changeStyle1 (entlast))
[0211] (command "pline" pleftbottomin pleftupin prightupin prightbottomin "c" "")
[0212] (command "pline" pleftbottomout pleftupout prightupout prightbottomout "c" "")
[0213] (setq changeStyle2 (entlast))
[0214] Step S3.5: Modify the border line segment properties. First, the DXF group code data of the changeStyle1 and changeStyle2 variables obtained in step S3.4 are obtained using the entget function; second, the line segment width value corresponding to group code 43 is modified using the subst function; finally, the DXF group code data of the changeStyle1 and changeStyle2 variables is updated using the entmod function, and the display is refreshed using the entupd function.
[0215] The subst function is used to replace specified elements in a list, the entmod function is used to modify the DXF group code data of a DXF entity, and the entup function is used to update the display of a DXF entity on the screen. Since the modified DXF entity attributes are not immediately refreshed on the screen after using the entmod function to modify the DXF entity attributes, the entup function is often used in combination with the entmod function to force the regeneration of the DXF entity display.
[0216] The relevant code is as follows:
[0217] (progn
[0218] (setq obj (entget changeStyle2))
[0219] (setq obj (subst (cons 43 0.8) (assoc 43 obj) obj))
[0220] (entmod obj)
[0221] (entupd changeStyle1))
[0222] Step S3.6: Resuming the object capture mode
[0223] The object capture mode osm variable saved before the specific execution of step S3 in step S3.1 is re-assigned to the system variable osmode, so as to ensure that the user-defined object capture mode is not changed before and after the execution of the step.
[0224] The relevant code is as follows:
[0225] (setvar "osmode" osm) ;; Start object capture.
[0226] The method for quickly increasing the use of the frame is as shown in Figure 9 , and the frame effect is as shown in Figure 10 .
[0227] Step S4: Attribute-driven batch selection of graphic objects (involving two user-defined functions)
[0228] In the report, it is often necessary to make the cross section before and after the construction into an illustration for comparison. The commonly used method is to first draw the illustration before the construction, and then replace the multiple segment lines representing the grade in the illustration before the construction with the filling patterns representing the resource type after the construction. Therefore, a method is needed to quickly and accurately select the multiple segment lines representing the grade and the filling patterns representing the resource type. The built-in selection of similar objects in CAD cannot accurately select the relevant objects, and the operation efficiency is relatively low. This step can quickly and accurately filter out all objects with the same attribute combination in the entire drawing according to the batch selection of reference objects by the user, through accurate matching of the reference object graphic attributes.
[0229] Step S4.1: Prompt the user to select the reference object and obtain the graphic attribute. First, use while and entsel to wait for the selection of reference objects one by one (enter to end); second, use the user-defined function GetEntityProps to obtain the four key attributes (layer (group code 8), color (group code 62), line type scale (group code 48), and line width (group code 370)) of each selected reference object for comparison and screening; finally, use vl-some to realize attribute deduplication processing, check whether the attribute exists, avoid repeated storage, and output the unique combination to the props_list list.
[0230] Preferably, since the layer, color, linetype scale, and line width in the primitive attributes already represent most of the information about primitive attributes, they are an effective distinguishing feature for different objects. Furthermore, in extensive practice and testing, using only these four attributes to match and filter across the entire image is sufficient to accurately filter primitive objects with the same attributes, achieving a balance between effectiveness and efficiency. Simultaneously, in certain special cases where these four attributes cannot effectively filter the entire image, adding additional attributes for matching is also convenient; it only requires adding code to retrieve primitive attributes in the GetEntityProps custom function.
[0231] The relevant code is as follows:
[0232] (princ "\nPlease select a reference object (press Enter to end the selection):")
[0233] (while (setq ent (car (entsel))))
[0234] (if (setq prop (GetEntityProps ent))
[0235] (if (not (vl-some '(lambda (x) (equal x prop)) props_list))
[0236] (setq props_list (cons prop props_list)))
[0237] (princ "\nUnable to retrieve object property!"))
[0238] The GetEntityProps function is used to retrieve combinations of entity attributes (layer, color, linetype scale, line width).
[0239] The relevant code is as follows:
[0240] (defun GetEntityProps (ent / dxf layer color ltscale lweightlayerColor)
[0241] (setq dxf (entget ent))
[0242] (list
[0243] Layers
[0244] (setq layer (cdr (assoc 8 dxf)))
[0245] ;; Color (ByLayer)
[0246] (if (setq color (cdr (assoc 62 dxf)))
[0247] color
[0248] (progn
[0249] (setq layerColor (cdr (assoc 62 (tblsearch "LAYER" layer))))
[0250] (if layerColor layerColor 256) ; 256=ByLayer))
[0251] ;; Line Type Scale (default 1.0)
[0252] (if (setq ltscale (cdr (assoc 48 dxf)))
[0253] ltscale 1.0)
[0255] ;; Line Width (ByLayer)
[0256] (if (setq lweight (cdr (assoc 370 dxf)))
[0257] lweight
[0258] -1 ; -1=ByLayer)))
[0259] Step S4.2: Use ssget to get all objects in the drawing, iterate through all objects, and use the attribute combination stored in the props_list list in step S4.1 as the matching basis to call the CheckPropsMatch custom function for each object to filter all matching objects that meet the attribute combination from the drawing, and add the matching objects to the selection set variable ss_result.
[0260] Preferably, before using ssget to get all objects in the drawing, it is first determined whether the attribute combination stored in the props_list list exists, and if it does not exist, the process is exited.
[0261] The relevant code is as follows:
[0262] (if props_list (progn
[0263] (princ "\nFiltering objects...")
[0264] (if (setq ss_all (ssget "_X"))
[0265] (progn
[0266] (setq ss_result (ssadd))
[0267] (repeat (setq i (sslength ss_all))
[0268] (setq ent (ssname ss_all (setq i (1- i))))
[0269] (if (CheckPropsMatch ent props_list)
[0270] (ssadd ent ss_result)))
[0271] The CheckPropsMatch function is used to check whether an object matches any combination of properties.
[0272] The relevant code is as follows:
[0273] (defun CheckPropsMatch (ent props / current_props)
[0274] (setq current_props (GetEntityProps ent))
[0275] (vl-some '(lambda (x) (equal x current_props)) props))
[0276] Step S4.3: Use the sslength function to determine if there are any filter objects that match the matching attributes. If so, use the sssetfirst function to highlight and activate the matching objects in CAD, and then use the sslength function to output the number of matching objects to the console.
[0277] The `sslength` function is the core function used to obtain the number of objects in the selection set, returning the number of entities contained in the selection set. `sssetfirst` is a key function controlling the selection state in AutoCAD, used to highlight selected objects in the graphical interface.
[0278] The relevant code is as follows:
[0279] (cond
[0280] ((= (sslength ss_result) 0)
[0281] (princ "\nNo matching object found"))
[0282] (t
[0283] (sssetfirst nil ss_result); Highlight the selected object.
[0284] (princ (strcat "\nSelected" (itoa (sslength ss_result)) " matching objects")))).
[0285] Example of a property-driven batch selection of primitive objects: Figure 11 As shown, after the primitive objects are selected by precise batch selection, as shown... Figure 12 As shown, copying the selected graphic objects in batches with the original image is shown in the example. Figure 13 As shown.
[0286] The embodiments described above are for illustrative purposes only and are not intended to limit the invention. Therefore, any changes in numerical values or substitutions of equivalent elements should still fall within the scope of this invention.
[0287] The above detailed description will enable those skilled in the art to understand that the present invention can indeed achieve the aforementioned objectives and has complied with the provisions of the Patent Law.
[0288] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention. The above descriptions are merely preferred embodiments of the invention and are not intended to limit the invention. It should be noted that any modifications, equivalent substitutions, and improvements made within the spirit and principles of the invention should be included within the scope of protection of the invention.
[0289] It should be noted that the above description of the process is for illustrative purposes only and does not limit the scope of this specification. Those skilled in the art can make various modifications and changes to the process under the guidance of this specification. However, these modifications and changes remain within the scope of this specification.
[0290] Having described the basic concepts, it is obvious to those of ordinary skill in the art after reading this disclosure that the above-described disclosure of the application is merely an example and does not limit the present application. Although not explicitly described herein, various modifications, improvements, and corrections can be made by those of ordinary skill in the art after reading this disclosure. Such modifications, improvements, and corrections are suggested in the present application, so such modifications, improvements, and corrections still fall within the spirit and scope of the exemplary embodiments of the present application.
[0291] Meanwhile, specific words are used in the present application to describe the embodiments of the present application. For example, "one embodiment", "an embodiment", and / or "some embodiments" mean a certain feature, structure, or characteristic related to at least one embodiment of the present application. Therefore, it should be emphasized and noted that "an embodiment" or "one embodiment" or "an alternative embodiment" mentioned in different places in the specification does not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of the present application can be properly combined.
[0292] In addition, those of ordinary skill in the art can understand that aspects of the present application can be described and claimed in a broad form or a specific form, including any new and useful process, machine, manufacture, or combination of matter, or any new and useful improvement thereof. Therefore, various aspects of the present application can be implemented entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software can be referred to as "unit", "module" or "system". In addition, aspects of the present application can take the form of a computer program product embodied in one or more computer readable media, in which computer readable program code is contained.
[0293] In addition, unless the order of the processing elements and sequences described in the present application, the use of numerals and letters, or the use of other names is explicitly described in the claims, it is not intended to limit the order of the processes and methods of the present application. Although some presently considered useful embodiments of the application are discussed in the above disclosure through various examples, it should be understood that such details are merely illustrative and the additional claims are not limited to the disclosed embodiments, but rather the claims are intended to cover all modifications and equivalent combinations within the spirit and scope of the embodiments of the present application. For example, although the implementation of the above-described various components can be embodied in a hardware device, it can also be implemented as a pure software solution, for example, as an installation on an existing server or mobile device.
[0294] For similar reasons, it is to be appreciated that the teachings of the present application provided herein can be applied to any embodiment of the present application, and that actual details thereof can depart from those set forth in a given embodiment, or that even methods, or implementations, which do not provide all of the benefits and features set forth herein, are within the scope of the present application.
Claims
1. A method for quickly drawing a three-dimensional geological profile sketch based on Autolisp, characterized in that, The method comprises the following steps: S1. Interactive rectangle positioning and quick clipping; obtaining the diagonal points of a rectangle through user interaction, determining the four coordinates of the rectangle, i.e., the minimum horizontal coordinate, the maximum horizontal coordinate, the minimum vertical coordinate and the maximum vertical coordinate, drawing a temporary rectangle and generating a closed fence point list based on the four coordinates, clipping the line segments outside the rectangle, and obtaining a preliminary clipped profile; S2. Quick clipping of the upper line segments of the ground surface line based on the fence mode; Based on the preliminary clipped profile obtained in S1, obtaining the reference line through user interaction, extracting the key points of the reference line and generating an upper fence point list, clipping the upper line segments of the ground surface line intersecting the upper fence point list, and obtaining a simplified profile; S3. Quick addition of a border; based on the simplified profile obtained in S2, selecting the leftmost and rightmost polylines as reference line objects after object capture is closed, extracting the end point coordinates of the reference line, calculating the inner and outer border coordinates and drawing the ground surface line extrapolation rectangle and the inner and outer borders, modifying the border line width attribute and then restoring the object capture, and obtaining a profile with a standard border; S4. Attribute-driven batch selection of graphic objects; based on the profile with a standard border obtained in S3, selecting a reference object and extracting its attribute combination through user interaction, filtering out objects matching the attribute combination by traversing all objects in the drawing, highlighting and outputting the matching number, and obtaining a standardized insert drawing that can be directly used for reports; In S3, the border drawing comprises: calculating the ground surface line extrapolation rectangle by extrapolating 10 unit lengths outward based on the end points of the left and right polylines, the distance between the rectangle and the inner border being 10 unit lengths, and the distance between the inner border and the outer border being 2 unit lengths, wherein the outer border line width is set to 0.8, and the inner border and the ground surface line extrapolation rectangle line width are set to 0.1; In S3, closing the object capture comprises: first obtaining the initial value of the system variable of the current object capture mode through the getvar function of Autolisp and saving it, and then setting the system variable to 0 through the setvar function to close all object capture modes; In S3, selecting the left and right polylines comprises: prompting the user to select the left and right polylines using the entsel command, saving the obtained reference object graphic name to the lineName variable using the car function, obtaining the key-value pair set of the variable lineName following the DXF group code standard using entget, obtaining the graphic type with group code 0 using the assoc function, determining whether it is a polyline, and if not, exiting the process, and finally, extracting the vertex coordinates of the selected reference line segment using the foreach loop to traverse the data with group code 10 in the graphic information, and saving the head and tail end point coordinates of the line segment.
2. The Autolisp-based method for quickly drawing a three-dimensional geological profile section illustration according to claim 1, wherein, In S1, obtaining the diagonal points of the rectangle comprises: obtaining the first corner point and the diagonal point of the rectangle specified by the user using the interaction function, determining whether the user has completed the selection, and if so, proceeding to the next step, otherwise, exiting the process.
3. The Autolisp-based method for quickly drawing a three-dimensional geological profile section illustration according to claim 1, wherein, In S1, the generating of the closed fence point list comprises: calculating the one-thousandth of the distance between the opposite corners of the rectangle as the offset, and expanding the offset based on the minimum and maximum horizontal and vertical coordinates of the rectangle to generate a closed fence point list connected at the head and tail in the order of top left corner→top right corner→bottom right corner→bottom left corner→top left corner.
4. The Autolisp-based method for quickly drawing a three-dimensional geological profile section illustration according to claim 1, wherein, In S2, when extracting the reference line key points, if the reference line is a closed polyline, by judging whether the head and tail vertices coincide, the tail point is deleted to remove the repeated coordinates, and it is ensured that the generated fence point list only covers the upper area of the reference line.
5. The Autolisp-based method for quickly drawing a three-dimensional geological profile section illustration according to claim 1, wherein, In S2, the generating of the upper fence point list comprises: extracting the end points or vertices of the reference line, adding an offset to the coordinates of each point to obtain the initial fence point, and adding an additional offset point at the head and tail of the fence point list to cover the end points of the reference line.
6. The Autolisp-based method for quickly drawing a three-dimensional geological profile section illustration according to claim 1, wherein, In S4, by using the self-defined function CheckPropsMatch to compare the object and the attribute combination of the entire drawing, the matched object is added to the selection set, and the filtering range is the entire drawing.
7. The Autolisp-based method for quickly drawing a three-dimensional geological profile section illustration according to claim 1, wherein, In S4, the extracting of the reference object attributes comprises: obtaining the layer, color, line type scale and line width of the reference object, and storing the attribute combination list after deduplication.
Citation Information
Patent Citations
A method for rapidly drawing a section map based on a CAD topographic map
CN109035364A
Geological profile map three-dimensional space information extraction method and device and storage medium
CN114898057A