A CAD front-end and back-end interaction method and system based on a service messaging mechanism
The service message-based CAD front-end and back-end interaction mechanism addresses the limitations of current CAD software by decoupling front-end and back-end systems, allowing a unified framework to support multiple platforms with reduced code redundancy and improved usability and data synchronization.
Patent Information
- Application Number
- CN202510400957.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-04-01
AI Technical Summary
The logic of the front and back ends of existing CAD software is highly coupled, resulting in difficulty in maintaining code, limited function expansion, and it is difficult to adapt to various front-end types such as the web and desktop.
The CAD front-end and back-end interaction method based on the service messaging mechanism is adopted. By defining multiple message classes and message processing classes, front-end decoupling is achieved, and public classes and specific classes are created in the unified framework, supporting multi-front-end operation.
It realizes efficient communication and data synchronization between front and back ends, reduces duplicate code, improves the high availability and reusability of the system, and supports interactive engineering modeling design in multi-front-end environments.
Smart Images

Figure CN119903262B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of engineering digitization, and in particular to a CAD front-end and back-end interaction method and system based on a service message transmission mechanism. Background Art
[0002] CAD (Computer Aided Design) is the core digital tool for modern engineering design. Through the deep integration of computer graphics and numerical computing technology, it provides designers with full-process support such as geometric modeling, parameter analysis, solution optimization and drawing generation.
[0003] CAD is an important technical means in the field of modern engineering design. The current mainstream CAD software, such as AutoCAD, Revit, Microstation, CATIA, etc., are all heavy desktop software that require high-performance computers and large software installation packages. With the improvement of design work efficiency, its shortcomings such as high requirements for client computer performance, inconvenient use, difficulty in collaboration, difficulty in data management, and cumbersome software upgrades have gradually emerged. In response to these problems, some cloud CAD solutions have also been derived.
[0004] However, at the current stage, client-side CAD software is still the mainstream, and at the same time, cloud-based CAD platforms are gradually being accepted by designers. However, the existing CAD platform architecture has the following problems: (1) The front-end and back-end logic of existing CAD software are highly coupled, which makes code maintenance difficult and limits functional expansion; (2) Existing CAD software is difficult to adapt to multiple front-end types such as the Web end and the desktop end at the same time. Summary of the invention
[0005] The present invention provides a CAD front-end and back-end interaction method and system based on a service message transmission mechanism, which can realize the decoupling of the front-end and back-end in applications where the CAD platform and the cloud coexist, and support the operation of multiple front-ends through a set of codes, thereby realizing interactive engineering modeling and design in a multiple front-end environment.
[0006] In a first aspect, the present disclosure provides a CAD front-end and back-end interaction method based on a service message transmission mechanism, comprising:
[0007] Step S1: When the system is initialized, according to the front-end type, the process corresponding to the front-end type is started, including: loading all tools, registering public message processing class objects, starting the message manager and tool setting manager, registering the extended message processing class objects and tool setting views corresponding to the front-end type, and starting the tool setting view manager corresponding to the front-end type;
[0008] Among them, the front-end types include the Web end and the desktop end; the common message processing classes include the command message processing class; the extended message processing classes include the Web end tool setting view message processing class and the desktop end tool setting view message processing class;
[0009] Step S2: In response to a user operation, messages are transmitted and processed between the front end and the cloud CAD service, and a modeling operation is performed, including: starting a tool;
[0010] Among them, starting a tool includes the following steps: The user starts a tool through the front end, the front end triggers a command message, and sends the command message to the cloud CAD service. The cloud CAD service receives the command message and distributes the message to the command message processing class object through the message manager for processing, runs the command in the message, and starts a specific tool;
[0011] When constructing a specific tool, by calling the method of the tool setting manager to obtain tool setting data, a tool setting data class object of the specific tool is created or queried, and this tool setting data class object is responsible for maintenance;
[0012] During the loading process of the specific tool, a tool setting view message corresponding to the front-end type is created, and the tool setting view message processing class object corresponding to the front-end type sends the tool setting view message corresponding to the front-end type to the front end;
[0013] The tool setting view manager corresponding to the front-end type receives the tool setting view message, queries the corresponding view, and displays it.
[0014] In some embodiments, when the front-end type is the Web end, the tool setting view message processing class object of the Web end formats the tool setting view message and sends it to the front end through the data channel. The Web end tool setting view manager receives and parses the formatted tool setting view message; when the front-end type is the desktop end, the tool setting view message processing class object of the desktop end realizes the message transmission between the front and back ends through in-process communication and memory sharing.
[0015] In some embodiments, the common message processing classes further include a mouse message processing class and a keyboard message processing class;
[0016] Step S2: In response to a user operation, messages are transmitted and processed between the front end and the cloud CAD service, and a modeling operation is performed, further including: running a tool;
[0017] Among them, running a tool includes the following steps:
[0018] After the tool is started, the system enters the tool state, and the tool running process is carried out through user interaction, specifically including: when running the tool, receiving the mouse message input by the user, which is processed and responded to by the mouse message processing class object; receiving the keyboard message input by the user, which is processed and responded to by the keyboard message processing class object, and the response result is passed to the specific tool;
[0019] The specific tool listens to the mouse message and the keyboard message, and draws the model according to the tool setting data class object of the specific tool.
[0020] In some embodiments, the command message includes an instruction to start / stop a specified tool through the menu and toolbar components in the UI interface.
[0021] In some embodiments, in step S1, the extended message processing class further includes a tool setting data change message processing class;
[0022] In step S2, after the tool is started, the system enters the tool state, and the tool running process is carried out through user interaction, further including:
[0023] When the user performs a model drawing operation through mouse and keyboard operations, and when the cloud CAD service triggers a change in the property value of the tool setting data class object, the tool setting data change message processing class object corresponding to the front-end type sends the change amount to the tool setting view corresponding to the front-end type, and updates the tool setting view corresponding to the front-end type.
[0024] In some embodiments, in step S2, after the tool is started, the system enters the tool state, and the tool running process is carried out through user interaction, further including:
[0025] When the user modifies the property value of the tool setting data class object in the tool setting view corresponding to the front-end type, the tool setting view corresponding to the front-end type sends the change amount to the cloud CAD service, which is processed by the tool setting data change message processing class object corresponding to the front-end type, and updates the tool setting data class object of the corresponding tool;
[0026] The specific tool draws the model according to the modified property value of the tool setting data class object.
[0027] In some embodiments, between the front-end and the cloud CAD service, when the front-end type is the Web side, the tool setting data change message processing class object on the Web side serializes the change amount and sends it to the Web side tool setting view through the data channel, and updates the view; the Web side tool setting view serializes the change amount and sends it to the cloud CAD service through the data channel, which is processed by the tool setting data change message processing class object on the Web side, and parses the change amount through deserialization to update the tool setting data class object;
[0028] When the front - end type is the desktop end, the desktop - end tool setting data change message processing class object and the desktop - end tool setting view achieve front - end and back - end data synchronization through in - process communication and memory sharing.
[0029] In some embodiments, the tool setting data class inherits from the observable object base class, which is an implementation class of the message interface and is used to listen for changes in the property values of its subclass objects. When the property value of the subclass object changes due to an operation at one end of the front - end or cloud - based CAD service, an observable object message is triggered to notify the other end, realizing data synchronization between the front - end and the cloud - based CAD service.
[0030] In some embodiments, the Web - end or desktop - end tool setting data change message processing class relies on the observable object message to achieve the transmission and synchronization of the change amount of the property values of the tool setting data class objects between the front - end and the cloud - based CAD service.
[0031] In a second aspect, the present disclosure provides a CAD front - end and back - end interaction system based on a service message passing mechanism for executing the CAD front - end and back - end interaction method based on the service message passing mechanism. The system includes:
[0032] An initialization module, which, when the system is initialized, starts the process corresponding to the front - end type according to the front - end type, including: loading all tools, registering a common message processing class object, starting a message manager and a tool setting manager, registering an extended message processing class object and a tool setting view corresponding to the front - end type, and starting a tool setting view manager corresponding to the front - end type.
[0033] A system operation module, which is used to respond to user operations, transmit and process messages between the front - end and the cloud - based CAD service, and perform modeling operations.
[0034] The beneficial effects of the present disclosure are as follows. Compared with the prior art, the present disclosure has the following advantages:
[0035] 1) In the technical solution of the present disclosure, by comprehensively considering the co - existence of the middle - end and cloud in the CAD platform, the CAD desktop - end application is SAAS - enabled, realizing front - end and back - end separation, and creating common classes and specific classes for different front - ends in a unified framework, so that a set of code supports multi - front - end operation. Specifically, the Web - end application and the desktop - end application use the same set of code. When the system is initialized, it judges the front - end type and dynamically loads the corresponding implementation method. In this way, on the one hand, it can minimize duplicate code and improve the high availability and reusability of the system code; on the other hand, it can achieve multi - end adaptation, perfectly integrate the Web - end application and the desktop - end application, ensure that a set of code supports multi - front - end operation, and thus realize interactive engineering modeling design in a multi - front - end environment.
[0036] 2) By defining multiple message classes and message handling classes, and creating a tool setting data class and specific tool classes, it ensures the efficient processing and transmission of different types of messages and data between the front-end and the back-end. Through this classification and specialized processing mechanism, efficient communication and operation between the front-end and the back-end in multiple interaction scenarios are achieved.
[0037] 3) In the present disclosure solution, the front-end and the back-end achieve data synchronization based on observable objects. Any data change at either end can trigger real-time synchronization at the other end, reducing the risks of manual coding and data inconsistency. At the same time, due to the complete decoupling of the interface (View) and the business logic, it provides a technical foundation for the multi-front-end integration framework, enabling the platform to flexibly adapt to various front-end applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.
[0039] Figure 1 It is a schematic flowchart of the CAD front-end and back-end interaction method based on the service message passing mechanism provided by the embodiments of the present disclosure;
[0040] Figure 2 It is a schematic diagram of the UI interface of the CAD front-end and back-end interaction based on the service message passing mechanism provided by the embodiments of the present disclosure;
[0041] Figure 3 It is a basic schematic diagram of the multi-front-end implementation framework of the CAD front-end and back-end interaction method based on the service message passing mechanism provided by the embodiments of the present disclosure;
[0042] Figure 4 It is a schematic diagram of the multi-front-end implementation framework of the CAD front-end and back-end interaction method based on the service message passing mechanism provided by the embodiments of the present disclosure.
[0043] Through the above accompanying drawings, the clear embodiments of the present disclosure have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present disclosure in any way, but to illustrate the concept of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] The present disclosure will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present disclosure and cannot be used to limit the protection scope of the present disclosure.
[0045] It should be noted that the order of the steps of the present disclosure is only for illustrative purposes. In actual execution, the order can be adjusted according to needs, or some steps can be executed in parallel, unless the execution of a certain step clearly depends on the result of the previous step. Otherwise, the order between the steps does not constitute a limitation to the present disclosure.
[0046] Example 1
[0047] As Figure 1 shown, this embodiment provides a CAD front-end and back-end interaction method based on a service message passing mechanism, including:
[0048] Step S1: When the system is initialized, according to the front-end type, start the process corresponding to this front-end type, including: loading all tools, registering a public message processing class object, starting a message manager and a tool setting manager, registering an extended message processing class object and a tool setting view corresponding to this front-end type, and starting a tool setting view manager corresponding to this front-end type.
[0049] Among them, the front-end types include the Web end and the desktop end.
[0050] Specifically, the desktop end includes a wpf front-end, a winforms front-end, a QT front-end, etc.
[0051] Optionally, when the front-end type is the Web end, in the step S1, when the system is initialized, according to the front-end type, starting the process corresponding to this front-end type further includes: creating a data channel.
[0052] It should be noted that the public message processing class object, the Web end extended message processing class object, the desktop end extended message processing class object, the message manager, and the tool setting manager are created in the cloud CAD service;
[0053] The Web end tool setting view, the desktop end tool setting view, the Web end tool setting view manager, and the desktop end tool setting view manager are created at the system front end.
[0054] The public message processing class includes a command message processing class.
[0055] The command message processing class depends on the command message. When a command operation is triggered, the command message processing class calls a system method to execute the command.
[0056] As an example, in the CAD platform, the UI interface includes several UI function components configured in regions, including a drawing area (workspace), a tool setting panel component, a resident command interaction component, a property panel component, a message display component, and a menu and toolbar component, etc. As Figure 2 shown, it is divided into six regions A, B, C, D, E, and F, where: Region A: menu and toolbar component; Region B: property panel component; Region C: tool setting view component; Region D: drawing area (workspace); Region E: message display component; Region F: resident command interaction component.
[0057] The command message includes instructions to start / stop a specified tool through menu and toolbar components (area A) in the UI interface, and may also include other modeling commands or auxiliary modeling commands. The command message includes a command string. Specifically, the command message mainly includes modeling commands such as creation, modification, editing, deletion, and query of model elements, as well as auxiliary modeling commands such as view control, snapping, and precise drawing.
[0058] For example, the user starts a tool through the front end, the front end triggers a command message, sends the command message to the back end. The back end receives the command message, which is processed by an object of the command message processing class to obtain the command content, run the command in the message, and start a specific tool. In this embodiment, the extended message processing class includes a Web-side tool setting view message processing class and a desktop-side tool setting view message processing class.
[0059] The Web-side tool setting view message processing class aggregates a data channel object. When the tool setting view needs to be displayed / closed, the tool setting view message is sent to the web front end through the data channel.
[0060] The desktop-side tool setting view message processing class, when the tool setting view needs to be displayed / closed, passes the tool setting view message to the desktop front end through in-process communication and memory sharing.
[0061] Among them, the tool setting view message is used to notify the front end to perform operations including displaying the view and closing the view.
[0062] Optionally, the Web-side tool setting view is an instance of the Web-side tool setting view class. The Web-side tool setting view class inherits from the Web-side tool setting view base class. Among them, the Web-side tool setting view base class provides basic display / close methods, aggregates the data channel and observable object messages, and binds the tool setting data class object to the view. When the property value of the tool setting data class object changes, the Web-side tool setting view base class serializes the change amount and sends it to the cloud CAD service through the data channel.
[0063] Since the Web-side tool setting view class inherits from the Web-side tool setting view base class, the Web-side tool setting view class is used to provide basic display / close methods, aggregates the data channel and observable object messages, and binds the tool setting data class object to the view. Dependent on the observable object message, when the property value of the tool setting data class object changes, the Web-side tool setting view class serializes the change amount and sends it to the cloud CAD service through the data channel.
[0064] Optionally, the desktop tool settings view is an instance of the desktop tool settings view class, which inherits from the desktop tool settings view base class. The desktop tool settings view base class provides basic display / close methods, aggregates observable object messages, and binds the tool settings data class object to the view. When the property value of the tool settings data class object changes, the desktop tool settings view base class serializes the change amount and synchronizes it to the cloud CAD service through inter-process communication and memory sharing.
[0065] Since the desktop tool settings view class inherits from the desktop tool settings view base class, it also provides basic display / close methods, aggregates observable object messages, and binds the tool settings data class object to the view. Dependent on the observable object messages, when the property value of the tool settings data class object changes, the desktop tool settings view class serializes the change amount and synchronizes it to the cloud CAD service through inter-process communication and memory sharing.
[0066] It can be understood that the tool settings view refers to the interface for displaying tool settings data when each tool is launched, generally referring to Figure 2 the C area in
[0067] for displaying and interacting with tool settings data. For example, the tool settings data of the line drawing tool includes several parts such as whether to specify a length, length value input, whether to specify an angle, and angle value input. It can display the length and angle values of the currently freely drawn line segment when the length and angle are not specified, and can also receive user operations to specify the current length value and angle.
[0068] Such as Figure 4 shown, the tool settings data class inherits from the observable object base class. The observable object base class is the data base class for all data that requires front-end and back-end data synchronization operations within the framework described in this example, and is the implementation class of the message interface. It can listen for changes in the property values of its subclass objects (such as tool settings data class objects). When the property value of the subclass object changes due to an operation at either the front-end or the cloud CAD service, it triggers an observable object message to notify the other end, realizing front-end and cloud CAD service data synchronization.
[0069] It can be understood that since the tool setting data class inherits the base class of observable objects, when the property value of the tool setting data class object changes, an observable object message is triggered. When data changes occur during an operation at either the front-end or the cloud CAD service, the other end is notified via the observable object message to achieve data synchronization between the front-end and the cloud CAD service. The tool refers to various interactive tools for creating / editing models, which can be used for free modeling in the drawing area (Area D) via a mouse and keyboard, etc., or for data interaction and parametric modeling via the tool setting view component (Area C). Tools include, for example, a line-drawing tool, a rectangle tool, a spline curve tool, etc.
[0070] The "tool state" refers to the overall state of the system during the tool's operation from startup to termination. A tool is generally a state machine, and the overall state of the system during the entire tool operation is divided into several sub-states. Starting from startup, the transition between sub-states is driven by user interaction (such as mouse and keyboard operations) or parametric input (such as tool setting data) until the tool finishes running. When starting the next tool, the system enters the next tool state.
[0071] Optionally, the tool class inherits from the tool base class, which is a basic class for implementing interactive 2D and 3D modeling, including a tool setting data class object, as well as some mouse and keyboard interaction methods, etc.
[0072] Since the tool class inherits from the tool base class, it also includes a tool setting data class object and is responsible for maintaining this object, that is, aggregating the tool setting data class object. That is, when the front-end changes (user input) the property value of this object, the tool draws the corresponding model according to the modified property value of this object. When the front-end does not change (no user input), the tool completes the modeling operation according to the property value of this instance.
[0073] Optionally, the common message handling class also includes a mouse message handling class and a keyboard message handling class.
[0074] Specifically, the mouse message handling class depends on mouse messages and is used to respond to mouse input in the front-end interface.
[0075] The keyboard message handling class depends on keyboard messages and is used to respond to keyboard input in the front-end interface.
[0076] In this embodiment, all messages are instances of the message class, and the message class is an implementation of the message interface.
[0077] It should be noted that in this embodiment, the mouse messages and keyboard messages specifically refer to the mouse and keyboard operations in the drawing area (area D) in the tool state after the tool is started, for completing view operations (such as panning / rotating / zooming), model element picking, obtaining point coordinates, etc. That is to say, in area D, the mouse messages and keyboard messages will be transmitted to the backend and are respectively processed by the mouse message processing class object and the keyboard message processing class object.
[0078] The mouse and keyboard events in other areas of the UI interface are processed by the frontend and will not be transmitted to the backend. For example, when the user clicks the draw line button, the frontend will process this click event, interpret the behavior of clicking the draw line button as starting the draw line tool, and construct a command to start the draw line tool and transmit it to the backend. Then, when the user inputs parameters on the tool settings view of the draw line tool, after the frontend obtains the keyboard input, it sends the change amount of the tool settings data to the backend, which is processed by the tool settings data change message processing class object. That is to say, different from the "mouse messages and keyboard messages" in this embodiment, the mouse and keyboard events in other areas of the UI interface can be considered global, and each interactive tool requires the cooperation of the mouse and keyboard.
[0079] Optionally, in the cloud CAD service, the message manager is used to manage all messages and message processing class objects, maintain the relationship between the message type and the corresponding message processing class object, mainly including methods such as registering message processing methods, unregistering message processing methods, and triggering message methods. When the triggering message method is called, the message will be forwarded to the specific message processing class object for processing.
[0080] The tool settings manager is used to maintain the relationship between the tool and the tool settings data class object, depends on the tool settings view message and the message manager, and includes methods such as obtaining tool settings data method and displaying / closing the tool settings view method.
[0081] Among them, the method of obtaining tool settings data is to obtain the current tool settings data class object according to the current tool type and tool settings data type. The tool settings data class object is in the singleton pattern, and the tool settings manager maintains its singleton state, that is, the tool settings data class object is created only when the method of obtaining tool settings data is called for the first time, and no new tool settings data class object will be generated in subsequent calls, thereby improving the system response efficiency and ensuring the consistency and global accessibility of the tool settings data.
[0082] The method of displaying / closing the tool settings view is to trigger the tool settings view message through the message manager, and call the tool settings view message processing class object on the Web side or the desktop side to transmit the tool settings view message to the frontend to implement the operation of displaying / closing the view.
[0083] Optionally, in the front end, the tool setting view manager is used to manage the tool setting views of all the system tools and maintain the relationship between the tool setting data class objects and the specific tool setting views. Among them, the tool setting view manager includes the Web-side tool setting view manager and the desktop-side tool setting view manager.
[0084] Step S2: In response to the user operation, messages are transmitted and processed between the front end and the cloud CAD service, and modeling operations are performed.
[0085] It should be noted that since the front and back ends of the desktop software are only logically separated, their data can still be accessed from each other in memory, while the front and back ends of the Web application are physically separated, and the front and back end data can only be transmitted through the network and a dedicated data channel needs to be established. Therefore, in the multi-front-end implementation, the main difference between the desktop side and the Web side lies in the data transmission method.
[0086] Based on this, in this embodiment, the multi-front-end framework determines the running logic of the entire program, mainly different in the processing methods of the message processing class.
[0087] Specifically, Step S2: In response to the user operation, messages are transmitted and processed between the front end and the cloud CAD service, and modeling operations are performed, including: 1) Starting the tool.
[0088] 1) Starting the tool includes the following steps:
[0089] Step S2.1, the user starts the tool through the front end, the front end triggers a command message, sends the command message to the cloud CAD service, the cloud CAD service receives the command message, distributes the message to the command message processing class object through the message manager for processing, runs the command in the message, and constructs a tool class instance, that is, starts a specific tool;
[0090] Step S2.2, when constructing the specific tool, by calling the method of the tool setting manager to obtain the tool setting data, create or query the tool setting data class object of the specific tool, and be responsible for maintaining the tool setting data class object;
[0091] Step S2.3, during the loading process of the specific tool, create the tool setting view message corresponding to the front end type, and the tool setting view message processing class object corresponding to the front end type sends the tool setting view message corresponding to the front end type to the front end;
[0092] Step S2.4, the tool setting view manager corresponding to the front end type receives the tool setting view message, queries the corresponding view, and displays it.
[0093] Among them, when the front-end type is the Web side, the message sending / receiving method between the front and back ends includes: the Web-side tool sets the view message processing class object to format the tool setting view message, and sends it to the front end through the data channel. The Web-side tool setting view manager receives and parses the formatted tool setting view message.
[0094] When the front-end type is the desktop side, the desktop-side tool sets the view message processing class object to implement front-back end message passing through in-process communication and memory sharing.
[0095] As an optional implementation method, when the front end is the Web side, the system startup tool is implemented as follows:
[0096] The user triggers a command message through the front-end startup tool, and sends the command message to the cloud CAD service module through the data channel. The cloud CAD service receives the command message, distributes the message to the command message processing class object through the message manager for processing, obtains and runs the command in the message, constructs a tool class instance, that is, starts a specific tool;
[0097] When constructing a specific tool, by calling the method of the tool setting manager to obtain tool setting data, create or query the tool setting data class object of the current tool, and be responsible for maintaining the tool setting data class object;
[0098] During the loading process of the specific tool, call the method of the tool setting manager to display the tool setting view, create a tool setting view message, and according to this object, call the method of the message manager to trigger the message event, distribute the message, and the Web-side tool setting view message processing class object formats the tool setting view message and passes it to the web front end through the data channel;
[0099] The Web-side tool setting view manager receives and parses the formatted tool setting view message, and queries and displays the corresponding view according to the tool setting data type and tool setting view registered and bound during initialization.
[0100] When the front end is the desktop side, the system startup tool is implemented as follows:
[0101] The user triggers a command message through the front-end startup tool, and sends the command message to the cloud CAD service module. The cloud CAD service receives the command message, distributes the message to the command message processing class object through the message manager for processing, obtains and runs the command in the message, constructs a tool class instance, that is, starts a specific tool;
[0102] When constructing a specific tool, by calling the method of the tool setting manager to obtain tool setting data, create or query the tool setting data class object of the current tool, and be responsible for maintaining the tool setting data class object;
[0103] During the specific tool loading process, the display tool setting view method of the tool setting manager is called to create a tool setting view message. According to this object, the trigger message event method of the message manager is called to distribute the message. The tool setting view message is sent to the front end by the object of the desktop-side tool setting view message processing class.
[0104] The desktop-side tool setting view manager receives the tool setting view message, queries the corresponding view according to the tool setting data type registered and bound during initialization and the corresponding desktop-side tool setting view, and displays it.
[0105] Among them, the corresponding message processing class object on the desktop side realizes the front-end and back-end message transmission through in-process communication and memory sharing.
[0106] Optionally, step S2: Respond to user operations, transfer and process messages between the front end and the cloud CAD service, and perform modeling operations, further including: 2) Run the tool.
[0107] 2) Running the tool includes the following steps: After starting the tool, the system enters the tool state, and the tool running process is carried out through user interaction, specifically including:
[0108] Step S2.5, when running the tool, receive the mouse message input by the user, which is processed by the mouse message processing class object, and respond to the mouse message (including messages such as mouse movement, button, and scroll wheel); receive the keyboard message input by the user, which is processed by the keyboard message processing class object, respond to all keyboard button messages, and transfer the response result to the specific tool.
[0109] Step S2.6, the specific tool listens to the mouse message and keyboard message, and draws the model according to the tool setting data class object of the specific tool.
[0110] Embodiment 2
[0111] Based on the method described in Embodiment 1, this embodiment further defines steps S1 - S2, and the specific solution is as follows:
[0112] In step S1, the extended message processing class further includes a tool setting data change message processing class. That is to say, when the system is initialized, according to the front-end type, the process corresponding to the front-end type is started, and further including: registering the tool setting data change message processing class corresponding to the front-end type.
[0113] It should be noted that in this embodiment, the tool setting data change message processing class takes effect only in the tool state after the tool is started, and its functions include: responding to the user's modification operation on the tool setting data class object in the tool setting view component (area C) of the front-end UI interface, and when the cloud CAD service operation causes a change in the attribute value of the tool setting data class object, synchronizing these changes to the tool setting view.
[0114] Specifically, the Web-side tool setting data change message processing class is used to serialize the change amount by the Web-side tool setting data change message processing class object when the cloud CAD service operation causes a change in the attribute value of the tool setting data class object, and then send it to the Web-side tool setting view through the data channel to update the Web-side tool setting view.
[0115] When the user modifies the attribute value of the tool setting data class object in the Web-side tool setting view, the Web-side tool setting view serializes the change amount and sends it to the cloud CAD service through the data channel, which is processed by the Web-side tool setting data change message processing class object to parse and update the tool setting data class object of the corresponding tool.
[0116] Among them, the Web-side tool setting data change message processing class depends on the observable object message to realize the transmission and synchronization of the change amount of the attribute value of the tool setting data class object between the front and back ends, and aggregates a data channel object.
[0117] The desktop-side tool setting data change message processing class is used to send the change amount to the desktop-side tool setting view by the desktop-side tool setting data change message processing class object when the cloud CAD service operation causes a change in the attribute value of the tool setting data class object, and update the desktop-side tool setting view.
[0118] When the user modifies the attribute value of the tool setting data class object in the desktop-side tool setting view, the desktop-side tool setting view sends the change amount to the cloud CAD service, which is processed by the desktop-side tool setting data change message processing class object to parse and update the tool setting data class object of the corresponding tool.
[0119] The desktop-side tool setting data change message processing class depends on the observable object message to realize the transmission and synchronization of the change amount of the attribute value of the tool setting data class object between the front and back ends, and realizes the data transfer between the front and back ends through in-process communication and memory sharing.
[0120] In step S2, 2) running the tool includes the following steps:
[0121] After the tool is started, the system enters the tool state, and the tool running process is carried out through user interaction, specifically including:
[0122] Step S2.5, when running the tool, receive the mouse messages input by the user, which are processed by the mouse message handling class object to respond to the mouse messages (including messages such as mouse movement, button presses, and scroll wheel operations); receive the keyboard messages input by the user, which are processed by the keyboard message handling class object to respond to the keyboard key messages, and pass the response results to the specific tool;
[0123] Step S2.6, the specific tool listens to the mouse messages and keyboard messages, and draws the model according to the tool setting data class object of this specific tool;
[0124] Step S2.7, when the user performs model drawing operations through mouse operations and keyboard operations, and when the tool setting data class object attribute value change is triggered in the cloud CAD service at the front end, the tool setting data change message handling class object corresponding to this front end type sends the change amount to the tool setting view corresponding to this front end type, and updates the tool setting view corresponding to this front end type;
[0125] Further optionally, after the step S2.7, the following steps may also be included:
[0126] Step S2.8, when the user modifies the tool setting data class object attribute value in the tool setting view corresponding to this front end type, the tool setting view corresponding to this front end type sends the change amount to the cloud CAD service, which is processed by the tool setting data change message handling class object corresponding to this front end type, and updates the tool setting data class object of the corresponding tool;
[0127] Step S2.9, the specific tool draws the model according to the modified tool setting data class object attribute value.
[0128] Among them, between the front end and the cloud CAD service, when the front end type is the Web end, the tool setting data change message handling class object of the Web end serializes the change amount and sends it to the Web end tool setting view through the data channel, and updates the view; the Web end tool setting view serializes the change amount and sends it to the cloud CAD service, which is processed by the tool setting data change message handling class object of the Web end, and parses the change amount through deserialization to update the tool setting data class object;
[0129] When the front end type is the desktop end, the tool setting data change message handling class object and the tool setting view of the desktop end achieve front-end and back-end data synchronization through in-process communication and memory sharing.
[0130] The tool setting data change message handling class of the Web end or the desktop end depends on the observable object message to achieve the transmission and synchronization of the change amount of the tool setting data class object attribute value between the front end and the back end.
[0131] It can be seen that in this embodiment, the front-end and the back-end achieve data synchronization based on observable objects, and any data change at either end can trigger the synchronization of the other end in real time, reducing the risks of manual coding and data inconsistency. At the same time, due to the complete decoupling of the interface (View) and the business logic, it provides a technical foundation for the multi-front-end integration framework, enabling the platform to flexibly adapt to various front-end applications.
[0132] Embodiment 3
[0133] Based on the methods described in Embodiment 1 - Embodiment 2, this embodiment further defines step S2, and the specific solution is as follows:
[0134] Optionally, step S2: In response to a user operation, messages are transmitted and processed between the front-end and the cloud CAD service, and a modeling operation is performed. It further includes: 3) After starting or running a tool, switch the tool.
[0135] 3) After starting or running a tool, switching the tool includes the following steps:
[0136] Step S2.10, the user starts a new tool through the front-end, the front-end triggers a command message, and sends the command message to the cloud CAD service. After receiving the command message, the cloud CAD service distributes the message to a command message processing class object through the message manager for processing, runs the command in the message object, and ends the current tool;
[0137] Step S2.11, call the close tool settings view method of the tool settings manager, create a tool settings view message, and according to this object, call the trigger message event method of the message manager to distribute the message. The tool settings view message processing class object corresponding to this front-end type sends the tool settings view message to the front-end;
[0138] Step S2.12, the tool settings view manager corresponding to this front-end type receives the tool settings view message, and according to the tool settings data type and tool settings view registered and bound during initialization, queries the corresponding view and closes it;
[0139] Step S2.13, run the command in the command message, start the new tool, and run the steps of starting the tool, that is, return to step S2.1.
[0140] Among them, when the front-end type is the Web end, the tool settings view message processing class object of the Web end formats the tool settings view message and sends it to the front-end through the data channel. The Web end tool settings view manager receives and parses the formatted tool settings view message.
[0141] When the front-end type is the desktop end, the message processing class object corresponding to the desktop end realizes front-back-end message synchronization through in-process communication and memory sharing.
[0142] Specifically, the formatting of messages can be transmitted using data formats such as JSON or XML, and the serialization and deserialization of messages can use standard serialization libraries, such as Jackson for Java or the pickle library for Python, etc.
[0143] In the above embodiments, as Figure 3 , Figure 4 shown, the message processing classes (including the common message processing class and the extended message processing class) are an implementation of the message processing interface, which is used to respond to and process specific messages. That is, the message processing interface defines the types of all message processing classes within the framework described in this embodiment, and all message processing classes within the framework of this embodiment are an implementation of this interface. The processing includes but is not limited to: message interfaces, serialized message interface strings, and various other forms of messages.
[0144] It should be noted that for the embodiments of the present disclosure, during the operation of the system, after the cloud CAD service receives a message, the message manager distributes the message to the corresponding message processing class object for processing. Therefore, regardless of whether it is explicitly stated in the above steps, after the cloud CAD service receives a message, the message manager distributes the message to the corresponding message processing class object for processing.
[0145] In an alternative embodiment, the extended message processing classes further include a Web - end prompt message processing class, a Web - end view size setting message processing class, a desktop - end prompt message processing class, a desktop - end view size setting message processing class, etc.
[0146] The Web - end prompt message processing class aggregates a data channel. When the prompt message method is called in the tool class, the prompt message processing class serializes the message and sends the prompt message to the web front - end through the data channel, and the web front - end synchronizes the interface data according to the message content;
[0147] Specifically, the prompt message refers to a message that feedbacks the operation status, error information, warning or suggestion to the user in the CAD platform, such as operation success / failure prompts, progress information, and warning reminders, etc.
[0148] The Web - end view size setting message processing class includes an encoder object and a view object. When the front - end view changes, it triggers the view size setting message, and the Web - end view size setting message processing class sets the size of the encoder and the size of the view according to the message content.
[0149] The desktop - end prompt message processing class, when the prompt message method is called in the tool class, notifies the front - end to synchronize the interface data according to the message content;
[0150] The desktop-side view size setting message processing class includes a view object. When the front-end view changes, a view size setting message is triggered, and the view size setting message processing class sets the size of the view according to the message content.
[0151] It can be seen that in the solution of the present disclosure, by defining various message classes and message processing classes, and creating a tool setting data class and specific tool classes, the efficient processing and transmission of different types of messages and data between the front and back ends are ensured. Through this classification and specialized processing mechanism, efficient communication and operation between the front and back ends in various interaction scenarios are achieved.
[0152] Embodiment 4
[0153] Based on the methods described in Embodiments 1-3, this embodiment further defines step S1, and the specific solution is as follows: Optionally, step S1 specifically includes:
[0154] Step S1.1: When the system is initialized, in response to the startup of the system, determine the front-end type. If the front-end type is the Web side, go to step S1.2; if the front-end type is the desktop side, go to step S1.3;
[0155] Step S1.2: Start the web-side process, including: creating a data channel, loading all tools, and registering public message processing class and Web-side extension message processing class objects; calling the register message processing method of the message manager to register and bind the public message processing class object and the Web-side extension message processing class object to the corresponding message types respectively; calling the Web-side tool setting view manager to bind the tool setting data type to the corresponding tool setting view on the Web side.
[0156] Step S1.3: Start the desktop-side process, including: loading all tools, and registering public message processing class and desktop-side extension message processing class objects; calling the register message processing method of the message manager to register and bind the public message processing class object and the desktop-side extension message processing class object to the corresponding message types respectively; calling the desktop-side tool setting view manager to bind the tool setting data type to the corresponding tool setting view on the desktop side.
[0157] Embodiment 5
[0158] This embodiment provides a CAD front-back end interaction system based on a service message passing mechanism for executing the CAD front-back end interaction method based on the service message passing mechanism described in Embodiments 1-4. The system includes:
[0159] An initialization module, which is used to start the processes corresponding to the front-end type according to the front-end type during system initialization, including: loading all tools, registering public message handling class objects, starting the message manager and the tool setting manager, registering the extension message handling class objects and tool setting views corresponding to the front-end type, and starting the tool setting view manager corresponding to the front-end type.
[0160] A system operation module, which is used to respond to user operations, transfer and process messages between the front-end and the cloud CAD service, and perform modeling operations.
[0161] As can be seen from the above embodiments, by comprehensively considering the coexistence of the middle end and the cloud in the CAD platform, the CAD desktop application is SAASified, the front-end and back-end are separated, and public classes and specific classes for different front-ends are created in a unified framework, so that a set of codes can support the operation of multiple front-ends. Specifically, the web application and the desktop application use the same set of codes. The system judges the front-end type during initialization and dynamically loads the corresponding implementation methods. In this way, on the one hand, it can minimize duplicate codes and improve the high availability and reusability of the system codes; on the other hand, it can achieve multi-terminal adaptation, perfectly integrate the web application and the desktop application, ensure that a set of codes supports the operation of multiple front-ends, and thus realize interactive engineering modeling design in a multi-front-end environment.
[0162] The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0163] Through the description of the above implementation manners, those skilled in the art can clearly understand that each implementation manner can be realized by means of software plus a necessary general hardware platform, and of course, it can also be realized by hardware. Based on such an understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0164] It should be understood that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than limiting them; although the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A CAD front-end and back-end interaction method based on a service message passing mechanism, characterized in that Including: Step S1: When the system is initialized, according to the front-end type, start the process corresponding to this front-end type, including: loading all tools, registering the public message handling class object, starting the message manager and the tool setting manager, registering the extended message handling class object and the tool setting view corresponding to this front-end type, and starting the tool setting view manager corresponding to this front-end type; Among them, the front-end types include the Web end and the desktop end; the public message handling classes include the command message handling class; the extended message handling classes include the Web end tool setting view message handling class and the desktop end tool setting view message handling class; Step S2: In response to user operations, transfer and process messages between the front-end and the cloud CAD service, and perform modeling operations, including: starting a tool; Among them, starting a tool includes the following steps: The user starts a tool through the front-end, the front-end triggers a command message, sends the command message to the cloud CAD service, the cloud CAD service receives the command message, and distributes the message to the command message handling class object through the message manager for processing, runs the command in the message, and starts a specific tool; When constructing a specific tool, by calling the method of obtaining tool setting data of the tool setting manager, create or query the tool setting data class object of the specific tool, and be responsible for maintaining the tool setting data class object; During the loading process of the specific tool, create the tool setting view message corresponding to this front-end type, and the tool setting view message handling class object corresponding to this front-end type sends the tool setting view message corresponding to this front-end type to the front-end; The tool setting view manager corresponding to the front-end type receives the tool setting view message, queries the corresponding view, and displays it; The tool setting data class inherits the base class of observable objects. The base class of observable objects is the data base class for all data synchronization operations between the front-end and the back-end, and is the implementation class of the message interface, which is used to realize the data synchronization between the front-end and the cloud CAD service.
2. The CAD front-end and back-end interaction method based on the service message passing mechanism according to claim 1, characterized in that When the front-end type is the Web end, the tool setting view message handling class object formats the tool setting view message and sends it to the front-end through the data channel. The Web end tool setting view manager receives and parses the formatted tool setting view message; When the front-end type is the desktop end, the desktop end tool setting view message handling class object realizes the message transfer between the front-end and the back-end through in-process communication and memory sharing.
3. The CAD front-end and back-end interaction method based on the service messaging mechanism according to claim 2, wherein The public message handling classes also include the mouse message handling class and the keyboard message handling class; Step S2: In response to user operations, transfer and process messages between the front-end and the cloud CAD service, and perform modeling operations, also including: running a tool; Among them, running a tool includes the following steps: After starting the tool, the system enters the tool state, and the tool running process is carried out through user interaction. Specifically, when running the tool, receive the mouse message input by the user, and the mouse message handling class object processes and responds; receive the keyboard message input by the user, and the keyboard message handling class object processes and responds, and transfer the response result to the specific tool; The specific tool listens to the mouse message and the keyboard message, and draws a model according to the tool setting data class object of the specific tool.
4. The CAD front-end and back-end interaction method based on the service message passing mechanism according to claim 1, wherein The command message includes instructions to start / stop a specified tool through menu and toolbar components in the UI interface.
5. The CAD front-end and back-end interaction method based on the service message passing mechanism according to claim 3, wherein In step S1, the extended message processing class further includes a tool setting data change message processing class; In step S2, after the tool is started, the system enters the tool state, and the tool running process through user interaction further includes: When the user performs model drawing operations through mouse and keyboard operations, and the tool setting data class object attribute value changes are triggered in the cloud CAD service, the tool setting data change message processing class object corresponding to this front-end type sends the change amount to the tool setting view corresponding to this front-end type and updates the tool setting view corresponding to this front-end type.
6. The CAD front-end and back-end interaction method based on the service messaging mechanism according to claim 5, characterized in that In step S2, after the tool is started, the system enters the tool state, and the tool running process through user interaction further includes: When the user modifies the tool setting data class object attribute value in the tool setting view corresponding to this front-end type, the tool setting view corresponding to this front-end type sends the change amount to the cloud CAD service, which is processed by the tool setting data change message processing class object corresponding to this front-end type to update the tool setting data class object of the corresponding tool; The specific tool draws the model according to the modified tool setting data class object attribute value.
7. The CAD front-end and back-end interaction method based on the service message passing mechanism according to claim 6, characterized in that, Among them, Between the front-end and the cloud CAD service, when the front-end type is the Web end, the tool setting data change message processing class object of the Web end serializes the change amount and sends it to the Web end tool setting view through the data channel and updates the view; the Web end tool setting view serializes the change amount and sends it to the cloud CAD service through the data channel, which is processed by the tool setting data change message processing class object of the Web end, and parses the change amount through deserialization to update the tool setting data class object; When the front-end type is the desktop end, the tool setting data change message processing class object and the desktop end tool setting view of the desktop end achieve front-end and back-end data synchronization through in-process communication and memory sharing.
8. The CAD front-end and back-end interaction method based on the service messaging mechanism according to any one of claims 5-7, characterized in that The tool setting data class inherits from the observable object base class, and the observable object base class is an implementation class of the message interface, which is used to listen for changes in the attribute values of its subclass objects. When the attribute value changes of the subclass object are caused by an operation at one end of the front-end or the cloud CAD service, the observable object message is triggered to notify the other end to achieve front-end and cloud CAD service data synchronization.
9. The CAD front-end and back-end interaction method based on the service messaging mechanism according to claim 8, wherein The Web end or desktop end tool setting data change message processing class relies on the observable object message to achieve the transmission and synchronization of the tool setting data class object attribute value change amounts between the front-end and the cloud CAD service.
10. A CAD front-end and back-end interaction system based on a service message passing mechanism, which is used to execute the CAD front-end and back-end interaction method based on the service message passing mechanism according to any one of claims 1-9, characterized in that, The system includes: An initialization module, which is used to start the process corresponding to this front-end type according to the front-end type during system initialization, including: loading all tools, registering public message processing class objects, starting the message manager and the tool setting manager, registering the extended message processing class object and the tool setting view corresponding to this front-end type, and starting the tool setting view manager corresponding to this front-end type; A system operation module, which is used to respond to user operations, transfer and process messages between the front-end and the cloud CAD service, and perform modeling operations.
Citation Information
Patent Citations
Security protocol formal verification method using expanded UML model as framework
CN105049420A
Cloud CAD processing method and system, computer equipment and storage medium
CN115665120A