A Method and System for Implementing a CAD Line Type Wandering Effect
By building a linear roaming database and version judgment, calling interfaces or creating custom class objects, the problem that pattern symbols do not meet the needs in CAD line drawing is solved, and flexible adjustment and compatibility of linear symbols are achieved.
Patent Information
- Application Number
- CN202111358251.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2041-11-16
AI Technical Summary
The prior art cannot realize the required patterns at the beginning and end of the line in CAD linear drawing, and the pattern symbol interval between the line patterns cannot be adjusted as needed, and cannot meet the land symbol standards for special land objects such as tree rows, shrub rows, etc.
Build a linear roaming database, judge the CAD version, call the linear rendering interface or create a custom class object, draw a specified pattern at the specified position through the drawing interface, ensure that there is a pattern at the end of the line and adjust the symbol interval.
It realizes that there are required patterns at the beginning and end of the CAD line type. The pattern symbol interval between the line types can be adjusted as needed, and is compatible with the linear walking processing of high and low versions of CAD.
Smart Images

Figure CN114283221B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surveying and mapping applications, and particularly to a method and system for realizing the wandering effect of CAD line types. Background Art
[0002] A line type is one of the attributes of a curve, referring to the shape of the line, such as a thick solid line, a dotted line, a dash-dotted line, etc. In the CAD line type definition, the pattern alignment operation at the end of each straight line, circle, and arc is specified through the alignment field. The program only supports Class A alignment to ensure that the endpoints of straight lines and arcs start and end with a dash. During the actual line drawing process, the first and last segments of the line can be lengthened as needed; if a straight line is too short to accommodate a dash point sequence, a continuous straight line will be drawn between the two endpoints; for an arc, the pattern will be adjusted to draw a dash at the endpoint; and for a circle and other objects without endpoints, the dash-dotted line sequence will be adjusted to provide a reasonable display.
[0003] In most cases, the line types drawn by the above method are reasonably displayed. However, in some special cases, the first and last patterns of the drawn line type are dots or lines, which do not meet the topographic symbol standards. For topographic features such as rows of arbor trees and rows of shrubs, it is required that the first and last line type patterns be drawn with the correct symbols, not dots or lines, and there are requirements for the interval between the pattern symbols of the line types. At this time, it is impossible to draw line type symbols that meet the requirements according to the CAD line type rules.
[0004] The prior art discloses a method and system for drawing a distribution network line based on CAD. This solution sets up that when the background primitive file is inserted into the drawing layer, it automatically identifies the conductor model and stores it in the attribute label of the primitive entity object and introduces a drawing method of one pole with multiple heads. Although it can greatly simplify the problem of storing each different type of pole type, guy wire and other primitive files in the background, it is an optimized method for drawing and statistics. However, the automatic mapping process involved in it only targets symbols that can be drawn at any position according to requirements, and cannot draw line type symbols that meet the requirements. Summary of the Invention
[0005] In order to solve at least one of the above technical defects, the present invention provides a method and system for realizing the wandering effect of CAD line types, so as to realize that there are required patterns at both the head and tail of the CAD line type, the interval between the pattern symbols of the line types can be adjusted as needed, and line type symbols that meet the requirements can be drawn.
[0006] To solve the above technical problems, the technical solution of the present invention is as follows:
[0007] A method for realizing the wandering effect of CAD line types includes the following steps:
[0008] S1: Construct a line type wandering database;
[0009] S2: Determine whether line pattern wandering is required according to the ground feature code to be drawn. If so, execute step S3; otherwise, end.
[0010] S3: Determine whether the current CAD version is a high version. If so, execute step S4; otherwise, execute step S5.
[0011] S4: Call the line pattern rendering interface to redefine the curve line pattern, and execute step S6.
[0012] S5: Create an object of a custom class, add the object to the model space, and call the redraw interface, then execute step S6.
[0013] S6: Call the drawing interface to select the required pattern from the line pattern wandering database, and draw the specified pattern at the specified position according to the curve line pattern determined in step S4 or S5, so as to achieve the effect of line pattern wandering.
[0014] Wherein: the line pattern wandering means controlling the line pattern symbol to be drawn at specified intervals at specified positions; when the position of the line pattern vertex changes, the position of the linear pattern will also change accordingly, but it is necessary to ensure that there are linear patterns at both the starting and ending vertices of the line pattern.
[0015] In the above solution, the model space refers to the ACDB_MODEL_SPACE block table, and adding an object to the model space means adding the object to the ACDB_MODEL_SPACE block table record; the model space is the space for creating an engineering model, which provides a drawing area for users. The redraw interface is the worldDraw redraw interface, which is an interface for drawing entities. Whenever an entity graphic needs to be redrawn, AutoCAD will automatically call the worldDraw function to generate the graphic of the entity on the screen.
[0016] The CAD line patterns drawn through the above solution all have the required patterns at the ends, and the interval of the pattern symbols between the line patterns can be adjusted as needed, and line pattern symbols that meet the requirements can be drawn; at the same time, this solution is also compatible with the line pattern wandering processing of high and low version CADs.
[0017] Since the interfaces of different CAD versions are different, this solution regards the CAD version with a visual object rule redefinition class as a high version CAD, such as AutoCAD 2013 and above versions; the CAD version without this class is a low version CAD. If it is a high version CAD, the visual object rule redefinition interface can be overloaded, and the display form of the line pattern can be redefined according to the usage requirements, while the low version CAD can only adopt the method of custom entities to draw the required pattern symbols.
[0018] Wherein, step S1 includes the following steps:
[0019] S11: Draw the feature pattern styles with their own feature codes that require linear roaming in the default CAD manner and name them with the feature pattern styles as the pattern style names.
[0020] S12: According to the drawn feature pattern styles, organize the linear pattern intervals corresponding to each type of feature as needed.
[0021] S13: Save the organized feature pattern styles, and write the feature codes, pattern style names, and linear pattern intervals of each feature pattern style into a configuration file or dataset to construct a linear roaming database.
[0022] Among them, in the step S3, the method of macro definition marking is used to determine whether the current CAD version is a high version. Since there is a corresponding relationship between the CAD version and the Microsoft Visual Studio software version, therefore, only by judging the Microsoft Visual Studio version at compile time can we obtain whether the current CAD version is a high version.
[0023] Among them, in the step S4, the specific process of constructing the line type rendering interface is as follows: create a class that inherits from the visualization object rule redefinition class; in the constructor of this class, set the type of the added rule entity to a curve, and then overload the worldDraw interface of the visualization object rule redefinition class as the line type rendering interface; during use, when the current CAD version is a high version, the line type rendering interface will be automatically called to redefine the curve line type.
[0024] Among them, in the step S6, during the use of the drawing interface, first pass in the pointers of the entity to be drawn and the drawing object at the drawing interface, and then read the feature code according to the drawing object pointer. If the feature code is empty or does not exist in the linear roaming database, return failure; otherwise, read the corresponding pattern style name and linear pattern interval according to the feature code; construct the absolute dwg path of this pattern style according to the pattern style name; the linear pattern interval read here is the theoretical pattern interval. By obtaining the total length of the curve, dividing it by the theoretical pattern interval, the number of segments obtained is used to divide the total length of the curve to get the actual pattern interval; starting from the starting point position of the curve, obtain the position of the starting point, and then every time the actual pattern interval is accumulated, obtain the position of the point on the curve until the total length of the curve is reached, and obtain the position of the end point; finally, insert the constructed absolute dwg path into the obtained point positions in the form of a CAD block reference entity type, and draw the specified pattern at the specified position to achieve the effect of linear roaming.
[0025] This solution also provides a CAD line style wandering effect implementation system for implementing the CAD line style wandering effect solution, which includes a database construction module, a pre-judgment module, a version judgment module, a line style rendering module, a redefinition module, and a drawing interface module; among them:
[0026] The database construction module is used to construct a line style wandering database;
[0027] The pre-judgment module is used to judge whether line style wandering is required according to the line style pattern to be drawn. If so, it is processed by the version judgment module; otherwise, it ends.
[0028] The version judgment module is used to judge whether the current CAD version is a high version. If so, it is processed by the line style rendering module; otherwise, it is processed by the redefinition module.
[0029] The line style rendering module is used to call the line style rendering interface, redefine the curve line style and transmit the processing result to the drawing interface module;
[0030] The redefinition module is used to create an object of a custom class, add the object to the model space, call the redraw interface, redraw the required line style pattern, and then transmit the result to the drawing interface module;
[0031] The drawing interface module is used to call the drawing interface, select the required pattern from the line style wandering database, and draw the specified pattern at the specified position according to the curve line style of the line style rendering module or the redefinition module, so as to achieve the line style wandering effect;
[0032] Among them: the line style wandering means controlling the line style pattern symbols to be drawn at specified intervals at specified positions; when the positions of the line style vertices change, the positions of the linear patterns will also change accordingly, but it is necessary to ensure that there are linear patterns at the starting and ending vertices of the line style.
[0033] Among them, in the database construction module, the line style wandering database is constructed in the following way: the feature pattern styles with their own feature codes that require line style wandering are respectively drawn in the CAD default way and named with the feature pattern styles as the pattern style names; according to the drawn feature pattern styles, sort out the line style pattern intervals corresponding to each type of feature as needed; save the sorted feature pattern styles, and write the feature codes, pattern style names, and line style pattern intervals of each feature pattern style into the configuration file or dataset to construct the line style wandering database.
[0034] Among them, in the version judgment module, the macro definition marking method is used to judge whether the current CAD version is a high version. Since there is a corresponding relationship between the CAD version and the Microsoft Visual Studio software version, only the Microsoft Visual Studio version during compilation needs to be judged to obtain whether the current CAD version is a high version.
[0035] Among them, in the line type rendering module, the construction process of the line type rendering interface it calls is specifically as follows: create a class that inherits from the visualization object rule redefinition class; in the constructor of this class, set the entity type of the added rule to curve, and then overload the worldDraw interface of the visualization object rule redefinition class as the line type rendering interface; during use, when the current CAD version is a high version, the line type rendering interface will be automatically called to redefine the curve line type.
[0036] Among them, in the drawing interface module, the specific process of using the drawing interface it calls is as follows: first, pass in the entity pointer and drawing object pointer to be drawn at the drawing interface, and then read the feature code according to the drawing object pointer. If the feature code is empty or does not exist in the line type roaming database, return failure; otherwise, read the corresponding pattern style name and line type pattern interval according to the feature code; construct the dwg absolute path of this pattern style according to the pattern style name; the line type pattern interval read here is the theoretical pattern interval. By obtaining the total length of the curve, dividing it by the theoretical pattern interval, the number of segments is obtained, and then dividing the total length of the curve by the number of segments to obtain the actual pattern interval; starting from the starting point position of the curve, obtain the position of the starting point, and then every time the actual pattern interval is accumulated, obtain the position of the point on the curve until the total length of the curve is reached, and obtain the position of the end point; finally, insert the constructed dwg absolute path into the obtained point positions in the form of a CAD block reference entity type, and draw the specified pattern at the specified position to achieve the effect of line type roaming.
[0037] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:
[0038] The present invention proposes a method for realizing the CAD line type wandering effect, which is applied when drawing a line type pattern that needs to be drawn with line type wandering. First, judge the current CAD version, and according to the judgment result, call the line type rendering interface or create an object of a custom class again to determine the curve line type. Finally, after the drawing interface selects the required pattern from the line type wandering database, according to the determined curve line type, draw the specified pattern at the specified position, so as to realize the line type wandering effect. The CAD line types drawn by it all have the required patterns at the ends, and the interval of the pattern symbols between the line types can be adjusted as needed, and line type symbols that meet the requirements can be drawn; at the same time, this solution is also compatible with the line type wandering processing of high and low version CADs. The present invention also proposes a CAD line type wandering effect realization system for realizing the CAD line type wandering effect realization method. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a schematic flow chart of the present invention;
[0040] Figure 2 It is a schematic diagram of the line type "narrow shrubbery" before line type wandering in an embodiment of the present invention;
[0041] Figure 3 It is a schematic diagram of the line type "narrow shrubbery" after line type wandering in an embodiment of the present invention;
[0042] Figure 4 It is a schematic diagram of the line type "narrow bamboo forest" before line type wandering in an embodiment of the present invention;
[0043] Figure 5 It is a schematic diagram of the line type "narrow bamboo forest" after line type wandering in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] The drawings are only for illustrative purposes and should not be construed as a limitation of this patent;
[0045] To better illustrate this embodiment, some components in the drawings will be omitted, enlarged or reduced, and do not represent the dimensions of the actual product;
[0046] For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0047] The technical solutions of the present invention will be further described below with reference to the drawings and embodiments.
[0048] Embodiment 1
[0049] As Figure 1 shown, a method for realizing the CAD line type wandering effect includes the following steps:
[0050] S1: Construct a line type wandering database;
[0051] S2: Determine whether line type wandering is required based on the feature code to be drawn. If so, execute step S3; otherwise, end.
[0052] S3: Determine whether the current CAD version is a high version. If so, execute step S4; otherwise, execute step S5.
[0053] S4: Call the line type rendering interface to redefine the curve line type, and execute step S6.
[0054] S5: Create an object of a custom class, add the object to the model space, and call the redraw interface, then execute step S6.
[0055] S6: Call the drawing interface, select the required pattern from the line type wandering database, and draw the specified pattern at the specified position according to the curve line type determined in step S4 or S5, so as to achieve the effect of line type wandering.
[0056] Wherein: the line type wandering means controlling the line type pattern symbol to be drawn at specified intervals at specified positions; when the position of the line type vertex changes, the position of the linear pattern will also change accordingly, but it is necessary to ensure that there are linear patterns at both the start and end vertices of the line type.
[0057] In the specific implementation process, the model space refers to the ACDB_MODEL_SPACE block table. Adding an object to the model space means adding the object to the ACDB_MODEL_SPACE block table record; the model space is the space for creating an engineering model, which provides a drawing area for users. The redraw interface is the worldDraw redraw interface, which is an interface for drawing entities. Whenever an entity graph needs to be redrawn, AutoCAD will automatically call the worldDraw function to generate the graph of the entity on the screen.
[0058] In the specific process, the CAD line types drawn by the above scheme all have the required patterns at the ends, and the interval of the pattern symbols between the line types can be adjusted as needed, and the line type symbols that meet the requirements can be drawn; at the same time, this scheme is also compatible with the line type wandering processing of high and low version CADs.
[0059] Since the interfaces of different CAD versions are different, this scheme regards the CAD version with a visual object rule redefinition class as a high version CAD, such as AutoCAD 2013 and above versions; the CAD version without this class is a low version CAD. If it is a high version CAD, the visual object rule redefinition interface can be overloaded, and the presentation form of the line type can be redefined according to the usage requirements, while the low version CAD can only use the custom entity method to draw the required pattern symbols.
[0060] More specifically, step S1 includes the following steps:
[0061] S11: Draw the feature pattern styles with their own feature codes that need to move linearly in the dwg in the ways of points, lines, circles, etc. default in CAD and name them with the feature pattern styles, as the pattern style names and the names of the dwg, and save them to the disk dwg resource path;
[0062] S12: According to the drawn feature pattern styles and the standards of "National Basic Scale Map Series Part 1: 1:500 1:1000 1:2000 Topographic Map Series", sort out the linear pattern intervals corresponding to each type of feature;
[0063] S13: Save the sorted feature pattern styles, and write the feature codes, pattern style names, and linear pattern intervals of each feature pattern style into the configuration file or dataset to construct a linear movement database.
[0064] More specifically, in step S3, the way of macro definition marking is used to determine whether the current CAD version is a high version. Since there is a corresponding relationship between the CAD version and the Microsoft Visual Studio software version, therefore, only by judging the Microsoft Visual Studio version during compilation, it is possible to obtain whether the current CAD version is a high version.
[0065] More specifically, in step S4, the construction process of the linear rendering interface is specifically as follows: Create a class that inherits from the visualization object rule redefinition class; in the constructor of this class, set the added rule entity type to curve, and then overload the worldDraw interface of the visualization object rule redefinition class as the linear rendering interface; during use, when the current CAD version is a high version, the linear rendering interface will be automatically called to redefine the curve line type.
[0066] More specifically, in the step S6, during the use of the drawing interface, first, the entity pointer and the drawing object pointer to be drawn are passed in at the drawing interface. Then, the feature code is read according to the drawing object pointer. If the feature code is empty or does not exist in the line pattern wandering database, a failure is returned; otherwise, the corresponding pattern style name and line pattern interval are read according to the feature code. According to the pattern style name, the absolute dwg path of the pattern style is constructed. The implementation method is that the absolute dwg path is equal to the saved dwg resource path + pattern style name + ".dwg". The line pattern interval read here is the theoretical pattern interval. By obtaining the total length of the curve, dividing it by the theoretical pattern interval, the number of segments is obtained, and then dividing the total length of the curve by the number of segments to obtain the actual pattern interval. Starting from the starting point position of the curve, the position of the starting point is obtained (here it can be ensured that there is a pattern symbol at the starting point of the curve), and then every time the actual pattern interval is accumulated, the position of the point on the curve is obtained until the total length of the curve is reached, and the position of the end point is obtained (here it can be ensured that there is a pattern symbol at the end point of the curve). Finally, the constructed absolute dwg path is inserted into the obtained point positions in the form of a CAD block reference entity type, and the specified pattern is drawn at the specified position, so as to achieve the effect of line pattern wandering.
[0067] In the specific implementation process, this method can be written into the program software. During the initialization after the software is started, the feature codes, pattern style names, and pattern intervals of the line pattern wandering are read from the line pattern wandering database and saved in the memory in the form of global variables for subsequent operations.
[0068] Embodiment 2
[0069] This solution also provides a CAD line pattern wandering effect implementation system for implementing the CAD line pattern wandering effect implementation solution, which includes a database construction module, a pre-judgment module, a version judgment module, a line pattern rendering module, a redefinition module, and a drawing interface module; among them:
[0070] The database construction module is used to construct a line pattern wandering database;
[0071] The pre-judgment module is used to judge whether line pattern wandering is required according to the line pattern to be drawn. If so, it is processed by the version judgment module; otherwise, it ends;
[0072] The version judgment module is used to judge whether the current CAD version is a high version. If so, it is processed by the line pattern rendering module; otherwise, it is processed by the redefinition module;
[0073] The line pattern rendering module is used to call the line pattern rendering interface, redefine the curve line pattern, and transmit the processing result to the drawing interface module;
[0074] The redefinition module is used to create an object of a custom class, add the object to the model space, call the redraw interface to redraw the required linetype pattern, and then transfer the result to the drawing interface module;
[0075] The drawing interface module is used to call the drawing interface, select the required pattern from the linetype roaming database, and draw the specified pattern at the specified position according to the curve linetype of the linetype rendering module or the redefinition module, so as to achieve the effect of linetype roaming;
[0076] Wherein: the linetype roaming means controlling the linetype pattern symbols to be drawn at specified intervals at specified positions; when the linetype vertex position changes, the position of the linear pattern will also change accordingly, but it is necessary to ensure that there are linear patterns at the start and end vertices of the linetype.
[0077] Wherein, in the database construction module, the linetype roaming database is constructed in the following way: the feature pattern styles with their own feature codes that require linetype roaming are drawn in the CAD default way and named with the feature pattern styles as the pattern style names; according to the drawn feature pattern styles, the linetype pattern intervals corresponding to each type of feature are sorted out as needed; the sorted feature pattern styles are saved, and the feature codes, pattern style names, and linetype pattern intervals of each feature pattern style are written into the configuration file or dataset to construct the linetype roaming database.
[0078] Wherein, in the version judgment module, the method of macro definition marking is used to judge whether the current CAD version is a high version. Since there is a corresponding relationship between the CAD version and the Microsoft Visual Studio software version, therefore, only by judging the Microsoft Visual Studio version at compile time, it is possible to obtain whether the current CAD version is a high version.
[0079] Wherein, in the linetype rendering module, the construction process of the linetype rendering interface it calls is specifically as follows: create a class that inherits from the visualization object rule redefinition class; in the constructor of this class, set the type of the added rule entity to curve, and then overload the worldDraw interface of the visualization object rule redefinition class as the linetype rendering interface; during use, when the current CAD version is a high version, the linetype rendering interface will be automatically called to redefine the curve linetype.
[0080] Among them, in the drawing interface module, the specific process of using the drawing interface it calls is as follows: First, pass in the entity pointer and the drawing object pointer to be drawn at the drawing interface. Then, read the feature code according to the drawing object pointer. If the feature code is empty or does not exist in the line pattern database, return failure; otherwise, read the corresponding pattern style name and line pattern interval according to the feature code. Construct the dwg absolute path of the pattern style according to the pattern style name. The line pattern interval read here is the theoretical pattern interval. By obtaining the total length of the curve, dividing it by the theoretical pattern interval, the number of segments is obtained, and then dividing the total length of the curve by the number of segments to obtain the actual pattern interval. Starting from the starting point position of the curve, obtain the position of the starting point, and then every time the actual pattern interval is accumulated, obtain the position of the point on the curve until the total length of the curve is reached, and obtain the position of the end point. Finally, insert the constructed dwg absolute path into the obtained point positions in the form of a CAD block reference entity type, and draw the specified pattern at the specified position, so as to achieve the effect of line pattern walking.
[0081] Embodiment 3
[0082] To further illustrate the implementation effect of the present invention, the present invention provides schematic diagrams before and after the line pattern walking of "narrow shrubbery" as shown in Figure 2 、 Figure 3 . In the figure, A1 is the starting point of the line pattern, and B1 is the ending point of the line pattern. It can be seen that the starting points and ending points of the two line features are both a point, and this point is not the correct symbol, and the interval of the feature symbols does not meet the standard. In Figure 2 , A2 is the starting point of the line pattern, and B2 is the ending point of the line pattern. It can be clearly seen that the starting points and ending points of the two line features both have correct symbols, and the interval of the feature symbols has been processed according to the standard. Similarly, by comparing the schematic diagrams before and after the line pattern walking of "narrow shrubbery" shown in Figure 3 、 Figure 4 、 Figure 5 , the same result can be obtained. Among them, in Figure 4 , C1 is the starting point of the line pattern, and D1 is the ending point of the line pattern. In Figure 4 , these two points are not the correct symbols, and the interval of the feature symbols does not meet the standard. After the line pattern walking, in Figure 5 , C2 is the starting point of the line pattern, and D2 is the ending point of the line pattern. It can be seen that the starting points and ending points of the two line features both have correct symbols, and the interval of the feature symbols has been processed according to the standard.
[0083] It can be seen from this that through the re-determination of the curve line pattern, the present solution can draw the specified pattern at the specified position, realizing that there are the required patterns at both the beginning and the end of the CAD line pattern, and the interval of the pattern symbols between the line patterns can be adjusted as needed, and the line pattern symbols that meet the requirements can be drawn.
[0084] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, rather than limitations on the implementation manners of the present invention. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to enumerate all implementation manners here. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the claims of the present invention.
Claims
1. A method for realizing the CAD line type wandering effect, characterized in that Including the following steps: S1: Construct a linear traversal database, including the following steps: S11: Draw the feature pattern styles with their own feature codes that require linear traversal in the default way of CAD and name them with the feature pattern styles as the pattern style names; S12: According to the drawn feature pattern styles, sort out the linear pattern intervals corresponding to each type of feature as needed; S13: Save the sorted feature pattern styles, and write the feature codes, pattern style names, and linear pattern intervals of each feature pattern style into a configuration file or dataset to construct a linear traversal database; S2: Judge whether linear traversal is required according to the feature code to be drawn. If so, execute step S3; otherwise, end; S3: Judge whether the current CAD version is a high version. If so, execute step S4; otherwise, execute step S5; S4: Call the linear rendering interface to redefine the curve line type and execute step S6; S5: Create an object of a custom class, add the object to the model space and call the redraw interface, and execute step S6; S6: Call the drawing interface, select the required pattern from the linear traversal database, and draw the specified pattern at the specified position according to the curve line type determined in step S4 or S5, so as to achieve the effect of linear traversal; Wherein: The linear traversal means controlling the linear pattern symbols to be drawn at specified intervals at specified positions; when the positions of the linear vertices change, the positions of the linear patterns will also change accordingly, but it is necessary to ensure that there are linear patterns at the starting and ending vertices of the line type; In the process of using the drawing interface, first pass in the pointer of the entity to be drawn and the pointer of the drawing object at the drawing interface, and then read the feature code according to the pointer of the drawing object. If the feature code is empty or does not exist in the linear traversal database, return failure; otherwise, read the corresponding pattern style name and linear pattern interval according to the feature code; construct the absolute dwg path of the pattern style according to the pattern style name; the linear pattern interval read here is the theoretical pattern interval. By obtaining the total length of the curve, dividing it by the theoretical pattern interval, the number of segments is obtained, and then dividing the total length of the curve by the number of segments to obtain the actual pattern interval; starting from the starting point position of the curve, obtain the position of the starting point, and then every time the actual pattern interval is accumulated, obtain the position of the point on the curve until the total length of the curve is reached, and obtain the position of the end point; finally, insert the constructed absolute dwg path into the obtained point positions in the form of a CAD block reference entity type to draw the specified pattern at the specified position, so as to achieve the effect of linear traversal.
2. The method for realizing the CAD line type walking effect according to claim 1, wherein In step S3, the method of macro definition marking is used to judge whether the current CAD version is a high version. Since there is a corresponding relationship between the CAD version and the Microsoft Visual Studio software version, therefore, only by judging the Microsoft Visual Studio version at compile time can it be obtained whether the current CAD version is a high version.
3. The method for realizing the CAD line type wandering effect according to claim 2, wherein, In the step S4, the process of constructing the line type rendering interface is specifically as follows: Create a class that inherits from the visualization object rule redefinition class; in the constructor of this class, set the type of the added rule entity to a curve, and then overload the worldDraw interface of the visualization object rule redefinition class as the line type rendering interface; During use, when the current CAD version is a high version, the line type rendering interface will be automatically called to redefine the curve line type.
4. A CAD line type wandering effect implementation system, characterized in that, It includes a database construction module, a pre-judgment module, a version judgment module, a line type rendering module, a redefinition module, and a drawing interface module; among them: The database construction module is used to construct a line type wandering database. Among them, the line type wandering database is constructed in the following way: The feature pattern styles with their own feature codes that require line type wandering are respectively drawn in the CAD default way and named with the feature pattern styles as the pattern style names; according to the drawn feature pattern styles, sort out the line type pattern intervals corresponding to each type of feature as needed; save the sorted feature pattern styles, and write the feature codes, pattern style names, and line type pattern intervals of each feature pattern style into a configuration file or dataset to construct the line type wandering database; The pre-judgment module is used to judge whether line type wandering is required according to the line type pattern to be drawn. If so, it is processed by the version judgment module, otherwise, it ends; The version judgment module is used to judge whether the current CAD version is a high version. If so, it is processed by the line type rendering module, otherwise, it is processed by the redefinition module; The line type rendering module is used to call the line type rendering interface to redefine the curve line type and transmit the processing result to the drawing interface module; The redefinition module is used to create an object of a custom class, add the object to the model space and call the redraw interface to redraw the required line type pattern, and then transmit the result to the drawing interface module; The drawing interface module is used to call the drawing interface, select the required pattern from the line type wandering database, and draw the specified pattern at the specified position according to the curve line type of the line type rendering module or the redefinition module, so as to achieve the effect of line type wandering; Among them: The line type wandering means controlling the line type pattern symbols to be drawn at specified intervals at specified positions; when the positions of the line type vertices change, the positions of the linear patterns will also change accordingly, but it is necessary to ensure that there are linear patterns at the start and end vertices of the line type; In the drawing interface module, the specific process of using the drawing interface it calls is as follows: First, pass in the entity pointer and the drawing object pointer that need to be drawn at the drawing interface. Then, read the feature code according to the drawing object pointer. If the feature code is empty or does not exist in the line pattern roaming database, return failure; otherwise, read the corresponding pattern style name and line pattern interval according to the feature code; construct the absolute dwg path of this pattern style according to the pattern style name; the line pattern interval read here is the theoretical pattern interval. By obtaining the total length of the curve, dividing it by the theoretical pattern interval, the number of segments after segmentation is obtained, and then dividing the total length of the curve by the number of segments to obtain the actual pattern interval; starting from the starting point position of the curve, obtain the position of the starting point, and then every time the actual pattern interval is accumulated, obtain the position of the point on the curve until the total length of the curve is reached, and obtain the position of the end point; finally, insert the constructed absolute dwg path into the obtained point positions in the form of a CAD block reference entity type, and draw the specified pattern at the specified position, so as to achieve the effect of line pattern roaming.
5. The CAD line type wandering effect implementation system according to claim 4, characterized in that, In the version judgment module, the method of using macro definition tags is used to judge whether the current CAD version is a high version. Since there is a corresponding relationship between the CAD version and the Microsoft Visual Studio software version, therefore, only need to judge the Microsoft Visual Studio version at compile time, then it can be obtained whether the current CAD version is a high version.
6. The CAD line type wandering effect implementation system according to claim 5, characterized in that In the line pattern rendering module, the specific process of constructing the line pattern rendering interface it calls is as follows: Create a class that inherits from the visualization object rule redefinition class; in the constructor of this class, set the entity type of the added rule to a curve, and then overload the worldDraw interface of the visualization object rule redefinition class as the line pattern rendering interface; During use, when the current CAD version is a high version, the line pattern rendering interface will be automatically called to redefine the curve line pattern.
Citation Information
Patent Citations
Surface feature symbolization method for realizing map library integration
CN103309944A
Method for processing linear ground features in power transmission line engineering measurement software
CN113127485A